Skip to content

Commit

Permalink
Merge pull request #883 from fumiya-kume/kuu/add-license-screen
Browse files Browse the repository at this point in the history
[feature] Implement License Screen
  • Loading branch information
momomomo111 authored Aug 26, 2023
2 parents 99a14d9 + c06afc0 commit 10c25bd
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions app-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 8 additions & 0 deletions app-android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
</intent-filter>
</activity>

<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar" />

<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar" />

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<Project> {
override fun apply(target: Project) {
with(target) {
pluginManager.apply("com.google.android.gms.oss-licenses-plugin")

dependencies {
implementation(libs.library("ossLicenses"))
}
}
}
}
7 changes: 7 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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" }
Expand Down Expand Up @@ -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" }
Expand All @@ -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 = [
Expand All @@ -158,5 +164,6 @@ plugins = [
"kotlinxSerializationGradlePlugin",
"completeKotlinPlugin",
"detektGradlePlugin",
"ossLicensesPlugin",
"koverPlugin"
]

0 comments on commit 10c25bd

Please sign in to comment.