Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Implement License Screen #883

Merged
merged 15 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Specify the AppCompat theme for the OSS license plugin's screen

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

<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:theme="@style/Theme.AppCompat.Light.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"
Copy link
Member

@takahirom takahirom Aug 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! We might have to use droidkaigi.primitive.*android*.osslicenses because the license list plugin is based on AGP plugin.

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"

Expand All @@ -49,6 +51,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" }

androidDesugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" }

Expand Down Expand Up @@ -123,6 +126,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 @@ -142,6 +147,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 = "0.7.3" }
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 @@ -156,4 +162,5 @@ plugins = [
"kotlinxSerializationGradlePlugin",
"completeKotlinPlugin",
"detektGradlePlugin",
"ossLicensesPlugin"
]