diff --git a/app-android/build.gradle.kts b/app-android/build.gradle.kts index 18b3f86d7..46b004faf 100644 --- a/app-android/build.gradle.kts +++ b/app-android/build.gradle.kts @@ -10,6 +10,7 @@ plugins { id("droidkaigi.primitive.detekt") id("droidkaigi.primitive.android.roborazzi") id("droidkaigi.primitive.kover") + id("droidkaigi.primitive.osslicenses") } val keystorePropertiesFile = file("keystore.properties") diff --git a/app-android/src/main/AndroidManifest.xml b/app-android/src/main/AndroidManifest.xml index d21214924..524f48e16 100644 --- a/app-android/src/main/AndroidManifest.xml +++ b/app-android/src/main/AndroidManifest.xml @@ -28,6 +28,14 @@ + + + + diff --git a/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt b/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt index 74a19f120..36bdf6eec 100644 --- a/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt +++ b/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt @@ -17,6 +17,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext +import androidx.core.content.ContextCompat.startActivity import androidx.core.net.toUri import androidx.core.os.bundleOf import androidx.hilt.navigation.compose.hiltViewModel @@ -27,6 +28,7 @@ import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController import androidx.window.layout.DisplayFeature import co.touchlab.kermit.Logger +import com.google.android.gms.oss.licenses.OssLicensesMenuActivity import io.github.droidkaigi.confsched2023.about.aboutScreenRoute import io.github.droidkaigi.confsched2023.about.navigateAboutScreen import io.github.droidkaigi.confsched2023.about.nestedAboutScreen @@ -148,7 +150,7 @@ private fun NavGraphBuilder.mainScreen( Sponsors -> navController.navigateSponsorsScreen() CodeOfConduct -> externalNavController.navigate(url = "https://portal.droidkaigi.jp/about/code-of-conduct") Contributors -> mainNestedNavController.navigate(contributorsScreenRoute) - License -> TODO() + License -> externalNavController.navigateToLicenseScreen() Medium -> externalNavController.navigate(url = "https://medium.com/droidkaigi") PrivacyPolicy -> externalNavController.navigate(url = "https://portal.droidkaigi.jp/about/privacy") Staff -> navController.navigateStaffScreen() @@ -259,6 +261,10 @@ private class ExternalNavController( } } + fun navigateToLicenseScreen() { + context.startActivity(Intent(context, OssLicensesMenuActivity::class.java)) + } + @Suppress("SwallowedException") @RequiresApi(Build.VERSION_CODES.R) private fun navigateToNativeAppApi30(context: Context, uri: Uri): Boolean { diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 3990d7375..b947c7b15 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -98,6 +98,10 @@ gradlePlugin { id = "droidkaigi.primitive.detekt" implementationClass = "io.github.droidkaigi.confsched2023.primitive.DetektPlugin" } + register("oss-licenses") { + id = "droidkaigi.primitive.osslicenses" + implementationClass = "io.github.droidkaigi.confsched2023.primitive.OssLicensesPlugin" + } // Conventions register("androidFeature") { diff --git a/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/OssLicensePlugin.kt b/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/OssLicensePlugin.kt new file mode 100644 index 000000000..40ee3c124 --- /dev/null +++ b/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/OssLicensePlugin.kt @@ -0,0 +1,17 @@ +package io.github.droidkaigi.confsched2023.primitive + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies + +class OssLicensesPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + pluginManager.apply("com.google.android.gms.oss-licenses-plugin") + + dependencies { + implementation(libs.library("ossLicenses")) + } + } + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ca883d2cb..f9894e9b6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,6 +32,8 @@ multiplatformFirebase = "1.8.1" kermit = "1.2.2" okHttp = "4.11.0" ktorfit = "1.5.0" +ossLicensesPlugin = "0.10.6" +ossLicenses = "17.0.1" detekt = "1.23.1" twitterComposeRule = "0.0.26" kover = "0.7.3" @@ -50,6 +52,7 @@ completeKotlinPlugin = { module = "com.louiscad.complete-kotlin:plugin", version detektGradlePlugin = { group = "io.gitlab.arturbosch.detekt", name = "detekt-gradle-plugin", version.ref = "detekt" } detektFormatting = { group = "io.gitlab.arturbosch.detekt", name = "detekt-formatting", version.ref = "detekt" } twitterComposeRule = { module = "com.twitter.compose.rules:detekt", version.ref = "twitterComposeRule" } +ossLicensesPlugin = { group = "com.google.android.gms", name = "oss-licenses-plugin", version.ref = "ossLicensesPlugin" } koverPlugin = { module = "org.jetbrains.kotlinx:kover-gradle-plugin", version.ref = "kover" } androidDesugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" } @@ -125,6 +128,8 @@ ktorfitKsp = { module = "de.jensklingenberg.ktorfit:ktorfit-ksp", version.ref = # Test +ossLicenses = { module = "com.google.android.gms:play-services-oss-licenses", version.ref = "ossLicenses" } + junit = { module = "junit:junit", version.ref = "junit" } androidxTestExtJunit = { module = "androidx.test.ext:junit", version.ref = "androidxTestExt" } androidxTestEspressoEspressoCore = { module = "androidx.test.espresso:espresso-core", version.ref = "androidxTestEspresso" } @@ -144,6 +149,7 @@ roborazziGradlePlugin = { id = "io.github.takahirom.roborazzi", version.ref = "r kspGradlePlugin = { id = "com.google.devtools.ksp", version.ref = "ksp" } kotlinxKover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } detektGradlePlugin = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } +ossLicensesPlugin = { id = "com.google.android.gms.oss-licenses-plugin", version.ref = "ossLicensesPlugin" } [bundles] plugins = [ @@ -158,5 +164,6 @@ plugins = [ "kotlinxSerializationGradlePlugin", "completeKotlinPlugin", "detektGradlePlugin", + "ossLicensesPlugin", "koverPlugin" ]