@@ -4,17 +4,11 @@ import androidx.compose.material.Scaffold |
4 | 4 | import androidx.compose.material.Text |
5 | 5 | import androidx.compose.material.TopAppBar |
6 | 6 | import androidx.compose.runtime.getValue |
7 | | -import androidx.compose.runtime.mutableStateOf |
8 | | -import androidx.compose.runtime.remember |
9 | 7 | import androidx.compose.ui.ExperimentalComposeUiApi |
10 | 8 | import androidx.compose.ui.Modifier |
11 | | -import androidx.compose.ui.platform.LocalUriHandler |
12 | 9 | import androidx.compose.ui.window.CanvasBasedWindow |
13 | | -import com.mikepenz.aboutlibraries.entity.Library |
14 | 10 | import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer |
15 | | -import com.mikepenz.aboutlibraries.ui.compose.LicenseDialog |
16 | 11 | import com.mikepenz.aboutlibraries.ui.compose.rememberLibraries |
17 | | -import com.mikepenz.aboutlibraries.ui.compose.util.htmlReadyLicenseContent |
18 | 12 | import org.jetbrains.compose.resources.ExperimentalResourceApi |
19 | 13 |
|
20 | 14 | @OptIn(ExperimentalComposeUiApi::class, ExperimentalResourceApi::class) |
@@ -27,38 +21,10 @@ fun main() { |
27 | 21 | val libraries by rememberLibraries { |
28 | 22 | Res.readBytes("files/aboutlibraries.json").decodeToString() |
29 | 23 | } |
30 | | - val uriHandler = LocalUriHandler.current |
31 | | - val openDialog = remember { mutableStateOf<Library?>(null) } |
32 | | - |
33 | 24 | LibrariesContainer( |
34 | 25 | libraries, |
35 | 26 | Modifier.fillMaxSize(), |
36 | | - onLibraryClick = { library -> |
37 | | - val license = library.licenses.firstOrNull() |
38 | | - if (!license?.url.isNullOrBlank()) { |
39 | | - license?.url?.also { |
40 | | - try { |
41 | | - uriHandler.openUri(it) |
42 | | - } catch (t: Throwable) { |
43 | | - println("Failed to open url: ${it}") |
44 | | - } |
45 | | - } |
46 | | - } else if (!license?.htmlReadyLicenseContent.isNullOrBlank()) { |
47 | | - openDialog.value = library |
48 | | - } |
49 | | - }, |
50 | 27 | ) |
51 | | - |
52 | | - |
53 | | - val library = openDialog.value |
54 | | - if (library != null) { |
55 | | - // TODO use https://android-review.googlesource.com/c/platform/frameworks/support/+/3024604 |
56 | | - LicenseDialog(library, body = { |
57 | | - Text(library.licenses.firstOrNull()?.htmlReadyLicenseContent ?: "") |
58 | | - }) { |
59 | | - openDialog.value = null |
60 | | - } |
61 | | - } |
62 | 28 | } |
63 | 29 | } |
64 | 30 | } |
|