feat(app): add licences screen

This commit is contained in:
Anthony 2024-06-11 19:51:48 +02:00
parent 3a1afc3c9f
commit 4cfee38bf4
4 changed files with 46 additions and 5 deletions

View File

@ -8,6 +8,7 @@ plugins {
alias(libs.plugins.jetbrainsCompose) alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.compose.compiler) alias(libs.plugins.compose.compiler)
alias(libs.plugins.kotlinxSerialization) alias(libs.plugins.kotlinxSerialization)
alias(libs.plugins.aboutLibraries)
} }
kotlin { kotlin {
@ -51,6 +52,9 @@ kotlin {
implementation(libs.voyager.navigator) implementation(libs.voyager.navigator)
implementation(libs.voyager.tab) implementation(libs.voyager.tab)
implementation(libs.voyager.screenmodel) implementation(libs.voyager.screenmodel)
implementation(libs.aboutlibraries.core)
implementation(libs.aboutlibraries.material3)
} }
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,36 @@
package tab
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import cafe.adriel.voyager.core.screen.Screen
import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer
import org.jetbrains.compose.resources.ExperimentalResourceApi
import veganenumbers.composeapp.generated.resources.Res.readBytes
object Licenses : Screen {
@OptIn(ExperimentalResourceApi::class)
private suspend fun loadLicenses(): String {
val bytes = readBytes("files/aboutlibraries.json")
val json = bytes.decodeToString()
return json
}
@OptIn(ExperimentalResourceApi::class)
@Composable
override fun Content() {
var licenses by remember{ mutableStateOf("") }
LaunchedEffect(currentCompositeKeyHash) {
licenses = loadLicenses()
}
LibrariesContainer(
licenses,
Modifier.fillMaxSize()
)
}
}

View File

@ -1,4 +1,5 @@
[versions] [versions]
aboutLibraries = "11.2.1"
agp = "8.2.0" agp = "8.2.0"
android-compileSdk = "34" android-compileSdk = "34"
android-minSdk = "24" android-minSdk = "24"
@ -37,18 +38,17 @@ androidx-constraintlayout = { group = "androidx.constraintlayout", name = "const
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
androidx-material3-android = { group = "androidx.compose.material3", name = "material3-android", version.ref = "material3Android" } androidx-material3-android = { group = "androidx.compose.material3", name = "material3-android", version.ref = "material3Android" }
# Koin # AboutLibraries
koin-bom = { module = "io.insert-koin:koin-bom", version.ref = "koin-bom" } aboutlibraries-core = { module = "com.mikepenz:aboutlibraries-core", version.ref = "aboutLibraries" }
koin-core = { module = "io.insert-koin:koin-core" } aboutlibraries-material3 = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutLibraries" }
koin-compose = { module = "io.insert-koin:koin-compose" }
# Voyager # Voyager
voyager-navigator = { group = "cafe.adriel.voyager", name = "voyager-navigator", version.ref = "voyager" } voyager-navigator = { group = "cafe.adriel.voyager", name = "voyager-navigator", version.ref = "voyager" }
voyager-tab = { group = "cafe.adriel.voyager", name = "voyager-tab-navigator", version.ref = "voyager" } voyager-tab = { group = "cafe.adriel.voyager", name = "voyager-tab-navigator", version.ref = "voyager" }
voyager-screenmodel = { group = "cafe.adriel.voyager", name = "voyager-screenmodel", version.ref = "voyager" } voyager-screenmodel = { group = "cafe.adriel.voyager", name = "voyager-screenmodel", version.ref = "voyager" }
voyager-koin = { group = "cafe.adriel.voyager", name = "voyager-koin", version.ref = "voyager" }
[plugins] [plugins]
aboutLibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutLibraries"}
androidApplication = { id = "com.android.application", version.ref = "agp" } androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" } androidLibrary = { id = "com.android.library", version.ref = "agp" }
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" } jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }