From 9299fc0c55e431f2ccc5262493d47ebef24d3440 Mon Sep 17 00:00:00 2001 From: Shabinder Date: Thu, 27 Jan 2022 02:05:25 +0530 Subject: [PATCH] Compose,Kotlin,Gradle and Deps Update and Deprecated Code Migration --- android/build.gradle.kts | 9 ------ .../com/shabinder/spotiflyer/MainActivity.kt | 4 +-- buildSrc/deps.versions.toml | 28 +++++++++---------- .../shabinder/common/uikit/DesktopDialog.kt | 3 ++ .../shabinder/common/root/SpotiFlyerRoot.kt | 2 +- .../root/integration/SpotiFlyerRootImpl.kt | 7 ++++- desktop/src/jvmMain/kotlin/Main.kt | 7 +++-- gradle/wrapper/gradle-wrapper.properties | 2 +- 8 files changed, 31 insertions(+), 31 deletions(-) diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 62c2f962..bb8a5273 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -82,15 +82,6 @@ android { packagingOptions { exclude("META-INF/*") } - configurations { - "implementation" { - exclude(group = "androidx.compose.animation") - exclude(group = "androidx.compose.foundation") - exclude(group = "androidx.compose.material") - exclude(group = "androidx.compose.runtime") - exclude(group = "androidx.compose.ui") - } - } } dependencies { implementation(compose.material) diff --git a/android/src/main/java/com/shabinder/spotiflyer/MainActivity.kt b/android/src/main/java/com/shabinder/spotiflyer/MainActivity.kt index 3d63b8a8..86ce3483 100644 --- a/android/src/main/java/com/shabinder/spotiflyer/MainActivity.kt +++ b/android/src/main/java/com/shabinder/spotiflyer/MainActivity.kt @@ -250,7 +250,7 @@ class MainActivity : ComponentActivity() { if (long) android.widget.Toast.LENGTH_LONG else android.widget.Toast.LENGTH_SHORT ).show() } - Log.i("Toasting",string) + Log.i("Toasting", string) } @Suppress("DEPRECATION") @@ -267,7 +267,7 @@ class MainActivity : ComponentActivity() { SpotiFlyerRoot( componentContext, dependencies = object : SpotiFlyerRoot.Dependencies { - override val storeFactory = LoggingStoreFactory(DefaultStoreFactory) + override val storeFactory = LoggingStoreFactory(DefaultStoreFactory()) override val database = this@MainActivity.fileManager.db override val fetchQuery = this@MainActivity.fetcher override val fileManager: FileManager = this@MainActivity.fileManager diff --git a/buildSrc/deps.versions.toml b/buildSrc/deps.versions.toml index f61031c8..df5b8449 100644 --- a/buildSrc/deps.versions.toml +++ b/buildSrc/deps.versions.toml @@ -1,24 +1,24 @@ [versions] -kotlin = "1.5.31" +kotlin = "1.6.10" androidCoroutines = "1.5.1" ktLint = "10.1.0" mosaic = "0.1.0" koin = "3.1.2" kermit = "0.1.9" mokoParcelize = "0.7.1" -ktor = "1.6.3" -kotlinxSerialization = "1.3.0" -sqlDelight = "1.5.1" +ktor = "1.6.7" +kotlinxSerialization = "1.3.1" +sqlDelight = "1.5.3" sqliteJdbcDriver = "3.34.0" slf4j = "1.7.31" i18n4k = "0.1.3" -essenty = "0.1.3" +essenty = "0.2.2" multiplatformSettings = "0.7.7" -decompose = "0.3.1" -mviKotlin = "2.0.4" -accompanist = "0.18.0" -statelyVersion = "1.1.10" -statelyIsoVersion = "1.2.0-nmm" +decompose = "0.5.0" +mviKotlin = "3.0.0-alpha03" +accompanist = "0.22.0-rc" +statelyVersion = "1.2.1" +statelyIsoVersion = "1.2.1" androidxLifecycle = "2.4.0-alpha03" @@ -29,12 +29,12 @@ kotlin-kotlinTestCommon = { group = "org.jetbrains.kotlin", name = "kotlin-test- kotlin-kotlinTestJs = { group = "org.jetbrains.kotlin", name = "kotlin-test-js", version.ref = "kotlin" } kotlin-kotlinTestJunit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" } kotlin-kotlinTestAnnotationsCommon = { group = "org.jetbrains.kotlin", name = "kotlin-test-annotations-common", version.ref = "kotlin" } -kotlin-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.5.2-native-mt" } +kotlin-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.6.0" } kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerialization" } -kotlinx-atomicfu = { group = "org.jetbrains.kotlinx", name = "atomicfu", version = "0.16.3" } -kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version = "0.2.1" } +kotlinx-atomicfu = { group = "org.jetbrains.kotlinx", name = "atomicfu", version = "0.17.0" } +kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version = "0.3.2" } -kotlin-compose-gradle = { group = "org.jetbrains.compose", name = "compose-gradle-plugin", version = "1.0.0-alpha4-build366" } +kotlin-compose-gradle = { group = "org.jetbrains.compose", name = "compose-gradle-plugin", version = "1.0.1" } mosaic-gradle = { group = "com.jakewharton.mosaic", name = "mosaic-gradle-plugin", version.ref = "mosaic" } essenty-lifecycle = { group = "com.arkivanov.essenty", name = "lifecycle", version.ref = "essenty" } diff --git a/common/compose/src/desktopMain/kotlin/com/shabinder/common/uikit/DesktopDialog.kt b/common/compose/src/desktopMain/kotlin/com/shabinder/common/uikit/DesktopDialog.kt index 87176aff..ce6a4d0f 100644 --- a/common/compose/src/desktopMain/kotlin/com/shabinder/common/uikit/DesktopDialog.kt +++ b/common/compose/src/desktopMain/kotlin/com/shabinder/common/uikit/DesktopDialog.kt @@ -6,6 +6,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.painter.BitmapPainter import androidx.compose.ui.res.loadImageBitmap import androidx.compose.ui.res.useResource +import androidx.compose.ui.unit.dp +import androidx.compose.ui.window.DialogState @OptIn(ExperimentalAnimationApi::class) @Composable @@ -17,6 +19,7 @@ actual fun Dialog( AnimatedVisibility(isVisible) { androidx.compose.ui.window.Dialog( onDismiss, + state = DialogState(width = 350.dp, height = 340.dp), title = "SpotiFlyer", icon = BitmapPainter(useResource("drawable/spotiflyer.png", ::loadImageBitmap)) ) { diff --git a/common/root/src/commonMain/kotlin/com/shabinder/common/root/SpotiFlyerRoot.kt b/common/root/src/commonMain/kotlin/com/shabinder/common/root/SpotiFlyerRoot.kt index fd75a9e8..1c569299 100644 --- a/common/root/src/commonMain/kotlin/com/shabinder/common/root/SpotiFlyerRoot.kt +++ b/common/root/src/commonMain/kotlin/com/shabinder/common/root/SpotiFlyerRoot.kt @@ -17,7 +17,7 @@ package com.shabinder.common.root import com.arkivanov.decompose.ComponentContext -import com.arkivanov.decompose.RouterState +import com.arkivanov.decompose.router.RouterState import com.arkivanov.decompose.value.Value import com.arkivanov.mvikotlin.core.store.StoreFactory import com.shabinder.common.core_components.analytics.AnalyticsManager diff --git a/common/root/src/commonMain/kotlin/com/shabinder/common/root/integration/SpotiFlyerRootImpl.kt b/common/root/src/commonMain/kotlin/com/shabinder/common/root/integration/SpotiFlyerRootImpl.kt index 8abf2ba1..86862e11 100644 --- a/common/root/src/commonMain/kotlin/com/shabinder/common/root/integration/SpotiFlyerRootImpl.kt +++ b/common/root/src/commonMain/kotlin/com/shabinder/common/root/integration/SpotiFlyerRootImpl.kt @@ -19,6 +19,11 @@ package com.shabinder.common.root.integration import co.touchlab.stately.ensureNeverFrozen import co.touchlab.stately.freeze import com.arkivanov.decompose.* +import com.arkivanov.decompose.router.RouterState +import com.arkivanov.decompose.router.pop +import com.arkivanov.decompose.router.popWhile +import com.arkivanov.decompose.router.push +import com.arkivanov.decompose.router.router import com.arkivanov.decompose.value.Value import com.arkivanov.essenty.parcelable.Parcelable import com.arkivanov.essenty.parcelable.Parcelize @@ -26,8 +31,8 @@ import com.shabinder.common.core_components.analytics.AnalyticsEvent import com.shabinder.common.core_components.analytics.AnalyticsView import com.shabinder.common.list.SpotiFlyerList import com.shabinder.common.main.SpotiFlyerMain -import com.shabinder.common.models.Consumer import com.shabinder.common.models.Actions +import com.shabinder.common.models.Consumer import com.shabinder.common.preference.SpotiFlyerPreference import com.shabinder.common.root.SpotiFlyerRoot import com.shabinder.common.root.SpotiFlyerRoot.Child diff --git a/desktop/src/jvmMain/kotlin/Main.kt b/desktop/src/jvmMain/kotlin/Main.kt index ff142202..7c923b3d 100644 --- a/desktop/src/jvmMain/kotlin/Main.kt +++ b/desktop/src/jvmMain/kotlin/Main.kt @@ -16,6 +16,7 @@ import androidx.compose.desktop.DesktopMaterialTheme import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.MaterialTheme import androidx.compose.material.Surface import androidx.compose.ui.Modifier import androidx.compose.ui.awt.ComposeWindow @@ -69,7 +70,7 @@ private lateinit var appWindow: ComposeWindow fun main() { val lifecycle = LifecycleRegistry() val rootComponent = spotiFlyerRoot(DefaultComponentContext(lifecycle)) - val windowState = WindowState(size = WindowSize(450.dp, 800.dp)) + val windowState = WindowState(width = 450.dp, height = 800.dp) singleWindowApplication( title = "SpotiFlyer", state = windowState, @@ -82,7 +83,7 @@ fun main() { color = Color.Black, contentColor = colorOffWhite ) { - DesktopMaterialTheme( + MaterialTheme( colors = SpotiFlyerColors, typography = SpotiFlyerTypography, shapes = SpotiFlyerShapes @@ -110,7 +111,7 @@ private fun spotiFlyerRoot(componentContext: ComponentContext): SpotiFlyerRoot = componentContext = componentContext, dependencies = object : SpotiFlyerRoot.Dependencies { override val appInit: ApplicationInit = koin.get() - override val storeFactory = DefaultStoreFactory + override val storeFactory = DefaultStoreFactory() override val fetchQuery: FetchPlatformQueryResult = koin.get() override val fileManager: FileManager = koin.get() override val database: Database? = fileManager.db diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 66b43b88..af8e209e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists #distributionSha256Sum=7faa7198769f872826c8ef4f1450f839ec27f0b4d5d1e51bade63667cbccd205 -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists