From 3cbdcb259c36150f4331c140b1e401d8442c1e39 Mon Sep 17 00:00:00 2001 From: Gerard Paligot Date: Sat, 25 Nov 2023 21:05:52 +0100 Subject: [PATCH] refactor(openfeedback-m2): remove the module. --- README.md | 4 +- build-logic/build.gradle.kts | 4 - .../io/openfeedback/plugins/LibraryPlugin.kt | 24 ------ build.gradle.kts | 2 +- openfeedback-m2/build.gradle.kts | 24 ------ .../io/openfeedback/android/m2/Loading.kt | 25 ------- .../android/m2/OpenFeedbackLayout.kt | 75 ------------------- .../io/openfeedback/android/m2/PoweredBy.kt | 61 --------------- .../io/openfeedback/android/m2/VoteCard.kt | 75 ------------------- .../io/openfeedback/android/m2/VoteItems.kt | 39 ---------- .../openfeedback/android/m2/data/FakeVotes.kt | 39 ---------- sample-app/build.gradle.kts | 9 +-- .../android/sample/MainActivity.kt | 52 +++---------- .../android/sample/theme/Colors.kt | 17 ----- .../android/sample/theme/OpenFeedbackTheme.kt | 39 +++------- settings.gradle.kts | 3 +- 16 files changed, 30 insertions(+), 462 deletions(-) delete mode 100644 build-logic/src/main/kotlin/io/openfeedback/plugins/LibraryPlugin.kt delete mode 100644 openfeedback-m2/build.gradle.kts delete mode 100644 openfeedback-m2/src/main/java/io/openfeedback/android/m2/Loading.kt delete mode 100644 openfeedback-m2/src/main/java/io/openfeedback/android/m2/OpenFeedbackLayout.kt delete mode 100644 openfeedback-m2/src/main/java/io/openfeedback/android/m2/PoweredBy.kt delete mode 100644 openfeedback-m2/src/main/java/io/openfeedback/android/m2/VoteCard.kt delete mode 100644 openfeedback-m2/src/main/java/io/openfeedback/android/m2/VoteItems.kt delete mode 100644 openfeedback-m2/src/main/java/io/openfeedback/android/m2/data/FakeVotes.kt delete mode 100644 sample-app/src/main/java/io/openfeedback/android/sample/theme/Colors.kt diff --git a/README.md b/README.md index 5d4d650..cec83e5 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ repositories { val openfeedbackVersion = "0.1.2" dependencies { // Material 3 - implementation("io.openfeedback:feedback-android-sdk-m3:$openfeedbackVersion") + implementation("io.openfeedback:feedback-sdk-m3:$openfeedbackVersion") // ViewModel - implementation("io.openfeedback:feedback-android-sdk-viewmodel:$openfeedbackVersion") + implementation("io.openfeedback:feedback-sdk-viewmodel:$openfeedbackVersion") } ``` diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 77fc0d1..270147a 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -18,10 +18,6 @@ dependencies { gradlePlugin { plugins { - register("io.openfeedback.plugins.lib") { - id = "io.openfeedback.plugins.lib" - implementationClass = "io.openfeedback.plugins.LibraryPlugin" - } register("io.openfeedback.plugins.lib.multiplatform") { id = "io.openfeedback.plugins.lib.multiplatform" implementationClass = "io.openfeedback.plugins.MultiplatformPlugin" diff --git a/build-logic/src/main/kotlin/io/openfeedback/plugins/LibraryPlugin.kt b/build-logic/src/main/kotlin/io/openfeedback/plugins/LibraryPlugin.kt deleted file mode 100644 index cb56230..0000000 --- a/build-logic/src/main/kotlin/io/openfeedback/plugins/LibraryPlugin.kt +++ /dev/null @@ -1,24 +0,0 @@ -package io.openfeedback.plugins - -import com.android.build.gradle.LibraryExtension -import io.openfeedback.extensions.configureKotlinAndroid -import io.openfeedback.extensions.configureKotlinCompiler -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.kotlin.dsl.configure - -class LibraryPlugin : Plugin { - override fun apply(target: Project) { - with(target.pluginManager) { - apply("com.android.library") - apply("org.jetbrains.kotlin.android") - apply("org.jetbrains.kotlin.plugin.serialization") - } - - target.extensions.configure { - configureKotlinAndroid() - defaultConfig.targetSdk = 34 - } - target.tasks.configureKotlinCompiler() - } -} diff --git a/build.gradle.kts b/build.gradle.kts index afe635e..4812b6c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,7 @@ import io.openfeedback.extensions.configureRoot plugins { - id("io.openfeedback.plugins.lib") apply false + id("io.openfeedback.plugins.lib.multiplatform") apply false alias(libs.plugins.moko.resources.generator) apply false alias(libs.plugins.jetbrains.compose) apply false } diff --git a/openfeedback-m2/build.gradle.kts b/openfeedback-m2/build.gradle.kts deleted file mode 100644 index b43bd8b..0000000 --- a/openfeedback-m2/build.gradle.kts +++ /dev/null @@ -1,24 +0,0 @@ - -plugins { - id("io.openfeedback.plugins.lib") - id("io.openfeedback.plugins.publishing") - alias(libs.plugins.jetbrains.compose) -} - -android { - namespace = "io.openfeedback.android.m2" -} - -openfeedback { - configurePublishing("feedback-android-sdk-m2") -} - -dependencies { - api(projects.openfeedback) - api(projects.openfeedbackViewmodel) - - implementation(libs.moko.mvvm.compose) - implementation(compose.material) - implementation(compose.ui) - implementation(compose.uiTooling) -} diff --git a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/Loading.kt b/openfeedback-m2/src/main/java/io/openfeedback/android/m2/Loading.kt deleted file mode 100644 index f6b7d33..0000000 --- a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/Loading.kt +++ /dev/null @@ -1,25 +0,0 @@ -package io.openfeedback.android.m2 - -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material.CircularProgressIndicator -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview - -@Composable -fun Loading(modifier: Modifier = Modifier) { - Box( - modifier = modifier.fillMaxSize(), - contentAlignment = Alignment.Center - ) { - CircularProgressIndicator() - } -} - -@Preview -@Composable -internal fun LoadingPreview() { - Loading() -} diff --git a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/OpenFeedbackLayout.kt b/openfeedback-m2/src/main/java/io/openfeedback/android/m2/OpenFeedbackLayout.kt deleted file mode 100644 index 5231103..0000000 --- a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/OpenFeedbackLayout.kt +++ /dev/null @@ -1,75 +0,0 @@ -package io.openfeedback.android.m2 - -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.runtime.Composable -import androidx.compose.runtime.collectAsState -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import com.vanniktech.locale.Locale -import com.vanniktech.locale.Locales -import dev.icerock.moko.mvvm.compose.getViewModel -import dev.icerock.moko.mvvm.compose.viewModelFactory -import io.openfeedback.viewmodels.OpenFeedbackFirebaseConfig -import io.openfeedback.viewmodels.OpenFeedbackUiState -import io.openfeedback.viewmodels.OpenFeedbackViewModel -import io.openfeedback.viewmodels.models.UISessionFeedback -import io.openfeedback.viewmodels.models.UIVoteItem - -@Deprecated("Please use m3 artifact to display OpenFeedback") -@Composable -fun OpenFeedback( - config: OpenFeedbackFirebaseConfig, - projectId: String, - sessionId: String, - modifier: Modifier = Modifier, - locale: Locale = Locale.from(Locales.currentLocaleString()), - loading: @Composable () -> Unit = { Loading(modifier = modifier) } -) { - val viewModel: OpenFeedbackViewModel = getViewModel( - key = sessionId, - factory = viewModelFactory { - OpenFeedbackViewModel( - firebaseApp = config.firebaseApp.value, - projectId = projectId, - sessionId = sessionId, - locale = locale - ) - } - ) - val uiState = viewModel.uiState.collectAsState() - when (uiState.value) { - is OpenFeedbackUiState.Loading -> loading() - is OpenFeedbackUiState.Success -> { - val session = (uiState.value as OpenFeedbackUiState.Success).session - OpenFeedbackLayout( - sessionFeedback = session, - modifier = modifier, - onClick = { voteItem -> viewModel.vote(voteItem = voteItem) } - ) - } - } -} - -@Deprecated("Please use m3 artifact to display OpenFeedback") -@Composable -fun OpenFeedbackLayout( - sessionFeedback: UISessionFeedback, - modifier: Modifier = Modifier, - onClick: (voteItem: UIVoteItem) -> Unit -) { - Column(modifier = modifier) { - VoteItems(voteItems = sessionFeedback.voteItem, onClick = onClick) - Box( - modifier = Modifier - .fillMaxWidth() - .padding(top = 5.dp), - contentAlignment = Alignment.Center - ) { - PoweredBy() - } - } -} diff --git a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/PoweredBy.kt b/openfeedback-m2/src/main/java/io/openfeedback/android/m2/PoweredBy.kt deleted file mode 100644 index d44f7f3..0000000 --- a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/PoweredBy.kt +++ /dev/null @@ -1,61 +0,0 @@ -package io.openfeedback.android.m2 - -import androidx.compose.foundation.Image -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.height -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.material.darkColors -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.res.stringResource -import androidx.compose.ui.semantics.contentDescription -import androidx.compose.ui.semantics.semantics -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import io.openfeedback.R as ROF - -@Composable -fun PoweredBy( - modifier: Modifier = Modifier, - style: TextStyle = MaterialTheme.typography.body2, - color: Color = MaterialTheme.colors.onBackground -) { - val logo = - if (MaterialTheme.colors.isLight) ROF.drawable.openfeedback_light - else ROF.drawable.openfeedback_dark - val poweredBy = stringResource(id = ROF.string.powered_by) - Row( - modifier = modifier.semantics(mergeDescendants = true) { - contentDescription = "$poweredBy Openfeedback" - }, - horizontalArrangement = Arrangement.spacedBy(4.dp), - verticalAlignment = Alignment.Top - ) { - Text(text = poweredBy, style = style, color = color) - Image( - painter = painterResource(id = logo), - contentDescription = null, - modifier = Modifier.height(style.fontSize.value.dp + 13.dp) - ) - } -} - -@Preview -@Composable -internal fun PoweredByPreview() { - Column { - MaterialTheme { - PoweredBy() - } - MaterialTheme(colors = darkColors()) { - PoweredBy() - } - } -} diff --git a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/VoteCard.kt b/openfeedback-m2/src/main/java/io/openfeedback/android/m2/VoteCard.kt deleted file mode 100644 index 360f945..0000000 --- a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/VoteCard.kt +++ /dev/null @@ -1,75 +0,0 @@ -package io.openfeedback.android.m2 - -import androidx.compose.foundation.BorderStroke -import androidx.compose.foundation.Canvas -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.material.ExperimentalMaterialApi -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Surface -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.geometry.Offset -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.Shape -import androidx.compose.ui.graphics.drawscope.Fill -import androidx.compose.ui.text.TextStyle -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import io.openfeedback.android.m2.data.fakeVotes -import io.openfeedback.viewmodels.models.UIVoteItem - -@OptIn(ExperimentalMaterialApi::class) -@Composable -fun VoteCard( - voteModel: UIVoteItem, - modifier: Modifier = Modifier, - style: TextStyle = MaterialTheme.typography.body2, - backgroundColor: Color = MaterialTheme.colors.surface, - contentColor: Color = MaterialTheme.colors.onSurface, - shape: Shape = MaterialTheme.shapes.medium, - onClick: (voteItem: UIVoteItem) -> Unit -) { - val border = if (voteModel.votedByUser) 4.dp else 1.dp - Surface( - shape = shape, - border = BorderStroke(border, contentColor.copy(alpha = .2f)), - color = backgroundColor, - modifier = modifier, - onClick = { onClick(voteModel) } - ) { - Box(modifier = Modifier.height(100.dp)) { - Canvas(modifier = Modifier.fillMaxSize()) { - voteModel.dots.forEach { dot -> - val offset = Offset(x = this.size.width * dot.x, y = this.size.height * dot.y) - drawCircle( - color = Color( - dot.color.substring(0, 2).toInt(16), - dot.color.substring(2, 4).toInt(16), - dot.color.substring(4, 6).toInt(16), - 255 / 3 - ), - radius = 30.dp.value, - center = offset, - style = Fill - ) - } - } - Text( - text = voteModel.text, - style = style, - color = contentColor, - modifier = Modifier.padding(10.dp), - ) - } - } -} - -@Preview -@Composable -internal fun VoteCardPreview() { - VoteCard(voteModel = fakeVotes[0], onClick = {}) -} diff --git a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/VoteItems.kt b/openfeedback-m2/src/main/java/io/openfeedback/android/m2/VoteItems.kt deleted file mode 100644 index 03f7542..0000000 --- a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/VoteItems.kt +++ /dev/null @@ -1,39 +0,0 @@ -package io.openfeedback.android.m2 - -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp -import io.openfeedback.viewmodels.models.UIVoteItem - -@Composable -internal fun VoteItems( - voteItems: List, - modifier: Modifier = Modifier, - columnCount: Int = 2, - onClick: (voteItem: UIVoteItem) -> Unit -) { - val spaceGrid = 8.dp - Row( - modifier = modifier, - horizontalArrangement = Arrangement.spacedBy(spaceGrid) - ) { - 0.until(columnCount).forEach { column -> - Box(modifier = Modifier.weight(1f)) { - Column(verticalArrangement = Arrangement.spacedBy(spaceGrid)) { - voteItems.filterIndexed { index, _ -> - index % columnCount == column - }.forEach { voteItem -> - VoteCard( - voteModel = voteItem, - onClick = onClick - ) - } - } - } - } - } -} diff --git a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/data/FakeVotes.kt b/openfeedback-m2/src/main/java/io/openfeedback/android/m2/data/FakeVotes.kt deleted file mode 100644 index 66d6200..0000000 --- a/openfeedback-m2/src/main/java/io/openfeedback/android/m2/data/FakeVotes.kt +++ /dev/null @@ -1,39 +0,0 @@ -package io.openfeedback.android.m2.data - -import io.openfeedback.viewmodels.models.UIDot -import io.openfeedback.viewmodels.models.UIVoteItem -import kotlin.math.absoluteValue -import kotlin.random.Random - -internal val fakeVotes = listOf( - fakeVoteItem("Drôle/original \uD83D\uDE03", 3), - fakeVoteItem("Trèsenrichissant enrichissant enrichissant \uD83E\uDD13", 1), - fakeVoteItem("Super intéressant \uD83D\uDC4D", 8), - fakeVoteItem("Très bon orateur \uD83D\uDC4F", 21), - fakeVoteItem("Pas clair \uD83E\uDDD0", 2) -) - -internal fun dots(count: Int, possibleColors: List): List { - return 0.until(count).map { - UIDot( - Random.nextFloat(), - Random.nextFloat(), - possibleColors[Random.nextInt().absoluteValue % possibleColors.size] - ) - } -} - -internal fun fakeVoteItem(text: String, count: Int): UIVoteItem { - val color = listOf( - "7cebcd", - "0822cb", - "d5219d", - "8eec1a" - ) - return UIVoteItem( - id = Random.nextInt().toString(), - text = text, - dots = dots(count, color), - votedByUser = count % 2 == 0 - ) -} diff --git a/sample-app/build.gradle.kts b/sample-app/build.gradle.kts index f736780..fe74e23 100644 --- a/sample-app/build.gradle.kts +++ b/sample-app/build.gradle.kts @@ -12,13 +12,12 @@ android { } dependencies { + implementation(projects.openfeedbackM3) + implementation(libs.androidx.core) - implementation("androidx.appcompat:appcompat:1.5.1") - implementation("androidx.activity:activity-compose:1.7.0-alpha02") + implementation("androidx.appcompat:appcompat:1.6.1") + implementation("androidx.activity:activity-compose:1.8.1") - implementation(compose.material) implementation(compose.material3) - implementation(projects.openfeedbackM2) - implementation(projects.openfeedbackM3) } diff --git a/sample-app/src/main/java/io/openfeedback/android/sample/MainActivity.kt b/sample-app/src/main/java/io/openfeedback/android/sample/MainActivity.kt index 50e7981..c608550 100644 --- a/sample-app/src/main/java/io/openfeedback/android/sample/MainActivity.kt +++ b/sample-app/src/main/java/io/openfeedback/android/sample/MainActivity.kt @@ -22,9 +22,8 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import io.openfeedback.android.m2.OpenFeedback -import io.openfeedback.android.sample.theme.DesignSystem import io.openfeedback.android.sample.theme.OpenFeedbackTheme +import io.openfeedback.m3.OpenFeedback class MainActivity : AppCompatActivity() { @SuppressLint("UnusedMaterialScaffoldPaddingParameter") @@ -34,43 +33,26 @@ class MainActivity : AppCompatActivity() { val sessionId = "173222" val openFeedbackFirebaseConfig = (application as MainApplication).openFeedbackFirebaseConfig setContent { - var designSystem by rememberSaveable { mutableStateOf(DesignSystem.M3) } val isDark = isSystemInDarkTheme() var isLight by rememberSaveable(isDark) { mutableStateOf(isDark.not()) } OpenFeedbackTheme( - designSystem = designSystem, isLight = isLight ) { Scaffold { LazyColumn(contentPadding = it) { item { ThemeSwitcher( - designSystem = designSystem, - isLight = isLight, - onDesignSystemChanged = { designSystem = it }, - onLightDarkChanged = { isLight = it } - ) + isLight = isLight + ) { isLight = it } } item { - when (designSystem) { - DesignSystem.M2 -> - OpenFeedback( - config = openFeedbackFirebaseConfig, - projectId = projectId, - sessionId = sessionId, - modifier = Modifier - .padding(horizontal = 8.dp, vertical = 4.dp) - ) - - DesignSystem.M3 -> - io.openfeedback.m3.OpenFeedback( - config = openFeedbackFirebaseConfig, - projectId = projectId, - sessionId = sessionId, - modifier = Modifier - .padding(horizontal = 8.dp, vertical = 4.dp) - ) - } + OpenFeedback( + config = openFeedbackFirebaseConfig, + projectId = projectId, + sessionId = sessionId, + modifier = Modifier + .padding(horizontal = 8.dp, vertical = 4.dp) + ) } } } @@ -81,9 +63,7 @@ class MainActivity : AppCompatActivity() { @Composable fun ThemeSwitcher( - designSystem: DesignSystem, isLight: Boolean, - onDesignSystemChanged: (DesignSystem) -> Unit, onLightDarkChanged: (Boolean) -> Unit ) { Column( @@ -91,18 +71,6 @@ fun ThemeSwitcher( verticalArrangement = Arrangement.spacedBy(4.dp), modifier = Modifier.fillMaxWidth() ) { - Row( - horizontalArrangement = Arrangement.spacedBy(8.dp), - verticalAlignment = Alignment.CenterVertically - ) { - Text(text = "Material 2") - Switch(checked = designSystem == DesignSystem.M3, onCheckedChange = { - onDesignSystemChanged( - if (designSystem == DesignSystem.M2) DesignSystem.M3 else DesignSystem.M2 - ) - }) - Text(text = "Material 3") - } Row( horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically diff --git a/sample-app/src/main/java/io/openfeedback/android/sample/theme/Colors.kt b/sample-app/src/main/java/io/openfeedback/android/sample/theme/Colors.kt deleted file mode 100644 index 6bbc02a..0000000 --- a/sample-app/src/main/java/io/openfeedback/android/sample/theme/Colors.kt +++ /dev/null @@ -1,17 +0,0 @@ -package io.openfeedback.android.sample.theme - -import androidx.compose.material.lightColors -import androidx.compose.ui.graphics.Color - -object ColorPalette { - val black = Color(52, 52, 52) - val greyLight = Color(237, 237, 237) - val white = Color.White -} - -val light = lightColors( - background = ColorPalette.white, - onBackground = ColorPalette.black, - surface = ColorPalette.greyLight, - onSurface = ColorPalette.black -) diff --git a/sample-app/src/main/java/io/openfeedback/android/sample/theme/OpenFeedbackTheme.kt b/sample-app/src/main/java/io/openfeedback/android/sample/theme/OpenFeedbackTheme.kt index ddea15c..4b0af90 100644 --- a/sample-app/src/main/java/io/openfeedback/android/sample/theme/OpenFeedbackTheme.kt +++ b/sample-app/src/main/java/io/openfeedback/android/sample/theme/OpenFeedbackTheme.kt @@ -1,9 +1,7 @@ package io.openfeedback.android.sample.theme import android.os.Build -import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material.MaterialTheme -import androidx.compose.material.darkColors +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.darkColorScheme import androidx.compose.material3.dynamicDarkColorScheme import androidx.compose.material3.dynamicLightColorScheme @@ -11,35 +9,22 @@ import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalContext -enum class DesignSystem { - M2, M3 -} - @Composable fun OpenFeedbackTheme( - designSystem: DesignSystem, isLight: Boolean, content: @Composable () -> Unit ) { - when (designSystem) { - DesignSystem.M2 -> MaterialTheme( - colors = if (isLight) light else darkColors(), - content = content - ) - DesignSystem.M3 -> { - val colorScheme = when { - Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { - val context = LocalContext.current - if (isLight) dynamicLightColorScheme(context) - else dynamicDarkColorScheme(context) - } - - else -> if (isLight) lightColorScheme() else darkColorScheme() - } - androidx.compose.material3.MaterialTheme( - colorScheme = colorScheme, - content = content - ) + val colorScheme = when { + Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> { + val context = LocalContext.current + if (isLight) dynamicLightColorScheme(context) + else dynamicDarkColorScheme(context) } + + else -> if (isLight) lightColorScheme() else darkColorScheme() } + MaterialTheme( + colorScheme = colorScheme, + content = content + ) } diff --git a/settings.gradle.kts b/settings.gradle.kts index f14734f..513f0cb 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -18,9 +18,8 @@ includeBuild("build-logic") include( ":openfeedback", - ":openfeedback-m2", - ":openfeedback-m3", ":openfeedback-viewmodel", + ":openfeedback-m3", ":sample-app" )