Skip to content

Commit

Permalink
Add licenses screen
Browse files Browse the repository at this point in the history
  • Loading branch information
zsmb13 committed Jan 18, 2025
1 parent 77d75f0 commit c2ba9c1
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
alias(libs.plugins.aboutLibraries) apply false
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.jetbrainsCompose) apply false
Expand All @@ -15,4 +16,4 @@ tasks.wrapper {
gradleVersion = "8.10.2"
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-bin.zip"
distributionSha256Sum = "31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26"
}
}
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[versions]
aboutlibraries = "11.4.0"
agp = "8.7.1"
android-compileSdk = "35"
android-minSdk = "24"
Expand Down Expand Up @@ -94,7 +95,10 @@ android-svg = { module = "com.caverock:androidsvg-aar", version.ref = "android-s
coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coil" }
coil-network-ktor3 = { module = "io.coil-kt.coil3:coil-network-ktor3", version.ref = "coil" }

aboutlibraries-compose = { module = "com.mikepenz:aboutlibraries-compose", version.ref = "aboutlibraries" }

[plugins]
aboutLibraries = { id= "com.mikepenz.aboutlibraries.plugin", version.ref="aboutlibraries"}
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" }
Expand Down
10 changes: 10 additions & 0 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import com.mikepenz.aboutlibraries.plugin.DuplicateMode
import com.mikepenz.aboutlibraries.plugin.DuplicateRule
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeFeatureFlag

plugins {
alias(libs.plugins.aboutLibraries)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.kotlinParcelize)
Expand Down Expand Up @@ -71,6 +74,8 @@ kotlin {

implementation(libs.androidx.navigation.compose)
implementation(libs.ktor.client.core)

implementation(libs.aboutlibraries.compose)
}

commonTest.dependencies {
Expand Down Expand Up @@ -167,3 +172,8 @@ val buildWebApp by tasks.creating(Copy::class) {
composeCompiler {
featureFlags.add(ComposeFeatureFlag.OptimizeNonSkippingGroups)
}

aboutLibraries {
duplicationMode = DuplicateMode.MERGE
duplicationRule = DuplicateRule.SIMPLE
}
5 changes: 5 additions & 0 deletions shared/src/commonMain/kotlin/org/jetbrains/kotlinconf/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import org.jetbrains.kotlinconf.screens.AboutAppScreen
import org.jetbrains.kotlinconf.screens.AboutConference
import org.jetbrains.kotlinconf.screens.CodeOfConduct
import org.jetbrains.kotlinconf.screens.InfoScreen
import org.jetbrains.kotlinconf.screens.LicensesScreen
import org.jetbrains.kotlinconf.screens.PartnerDetails
import org.jetbrains.kotlinconf.screens.Partners
import org.jetbrains.kotlinconf.screens.PrivacyPolicyForVisitors
Expand Down Expand Up @@ -97,6 +98,7 @@ fun App(context: ApplicationContext) {
StyledText("Partners", Modifier.clickable { navController.navigate(PartnersScreen) })
StyledText("Schedule", Modifier.clickable { navController.navigate(ScheduleScreen) })
StyledText("Speakers", Modifier.clickable { navController.navigate(SpeakersScreen) })
StyledText("Licenses", Modifier.clickable { navController.navigate(LicensesScreen) })
}
}
composable<AboutAppScreen> {
Expand Down Expand Up @@ -172,6 +174,9 @@ fun App(context: ApplicationContext) {
val sessionId = it.toRoute<TalkDetailsScreen>().talkId
Session(service.sessionById(sessionId))
}
composable<LicensesScreen> {
LicensesScreen(onBack = navController::popBackStack)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ data class TalkDetailsScreen(val talkId: SessionId)
@Serializable
data object SpeakersScreen

@Serializable
data object LicensesScreen

@Serializable
data class SpeakerDetailsScreen(val speakerId: SpeakerId)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.jetbrains.kotlinconf.screens

import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer
import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults
import com.mikepenz.aboutlibraries.ui.compose.rememberLibraries
import kotlinconfapp.shared.generated.resources.Res
import org.jetbrains.compose.resources.ExperimentalResourceApi
import org.jetbrains.kotlinconf.ScreenWithTitle
import org.jetbrains.kotlinconf.ui.theme.KotlinConfTheme

@Composable
fun LicensesScreen(
onBack: () -> Unit,
) {
ScreenWithTitle(title = "Licenses", onBack = onBack) {
val libraries = rememberLibraries {
// To update licenses:
// gradlew :shared:exportLibraryDefinitions -PaboutLibraries.exportPath=src/commonMain/composeResources/files
@OptIn(ExperimentalResourceApi::class)
Res.readBytes("files/aboutlibraries.json").decodeToString()
}.value

if (libraries != null) {
LibrariesContainer(
{ libraries },
Modifier.weight(1f),
colors = LibraryDefaults.libraryColors(
backgroundColor = KotlinConfTheme.colors.mainBackground,
contentColor = KotlinConfTheme.colors.primaryText,
badgeBackgroundColor = KotlinConfTheme.colors.tileBackground,
badgeContentColor = KotlinConfTheme.colors.secondaryText,
dialogConfirmButtonColor = KotlinConfTheme.colors.accentText,
)
)
}
}
}

0 comments on commit c2ba9c1

Please sign in to comment.