diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fff6bc45..d2487a23e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Pending changes +- [#376](https://github.com/bumble-tech/appyx/issues/376) – **Changed**: Androidx lifecycle version updated to 2.6.1. +- [#376](https://github.com/bumble-tech/appyx/issues/376) – **Updated**: Kotlin and Compose compiler version updated to 1.8.10 to align kotlin version used in androidx lifecycle - [#375](https://github.com/bumble-tech/appyx/issues/375) – **Fixed**: SaveableStateHolder does no longer save state for destroyed elements --- diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 52060ae2a..562f9bd12 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,15 +5,15 @@ androidCompileSdk = "33" androidMinSdk = "21" androidTargetSdk = "32" accompanist = "0.28.0" -androidx-lifecycle = "2.5.1" +androidx-lifecycle = "2.6.1" androidx-navigation-compose = "2.5.1" coil = "2.2.1" composeBom = "2023.01.00" -composeCompiler = "1.3.1" -ribs = "0.36.1" +composeCompiler = "1.4.4" +ribs = "0.38.0" mvicore = "1.2.6" coroutines = "1.6.4" -kotlin = "1.7.10" +kotlin = "1.8.10" junit5 = "5.8.2" detekt = "1.21.0" dependencyAnalysis = "1.13.1" @@ -74,7 +74,7 @@ junit-vintage = { module = "org.junit.vintage:junit-vintage-engine", version.ref plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } plugin-detekt = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" } -plugin-android = "com.android.tools.build:gradle:7.3.1" +plugin-android = "com.android.tools.build:gradle:7.4.0" detekt-compose = "com.twitter.compose.rules:detekt:0.0.26" toolargetool = "com.gu.android:toolargetool:0.3.0" diff --git a/libraries/core/build.gradle.kts b/libraries/core/build.gradle.kts index f9efec2b5..388839946 100644 --- a/libraries/core/build.gradle.kts +++ b/libraries/core/build.gradle.kts @@ -36,18 +36,18 @@ dependencies { api(composeBom) api(project(":libraries:customisations")) - api(libs.kotlin.coroutines.android) api(libs.androidx.lifecycle.common) api(libs.compose.animation.core) api(libs.compose.runtime) api(libs.androidx.appcompat) + api(libs.kotlin.coroutines.android) implementation(composeBom) implementation(libs.androidx.activity.compose) implementation(libs.androidx.lifecycle.java8) - implementation(libs.androidx.lifecycle.runtime) implementation(libs.compose.foundation.layout) + testImplementation(project(":libraries:testing-junit4")) testImplementation(libs.androidx.arch.core.testing) testImplementation(libs.junit) diff --git a/libraries/core/src/main/kotlin/com/bumble/appyx/core/lifecycle/MinimumCombinedLifecycle.kt b/libraries/core/src/main/kotlin/com/bumble/appyx/core/lifecycle/MinimumCombinedLifecycle.kt index f50db5e2a..2bf92eca0 100644 --- a/libraries/core/src/main/kotlin/com/bumble/appyx/core/lifecycle/MinimumCombinedLifecycle.kt +++ b/libraries/core/src/main/kotlin/com/bumble/appyx/core/lifecycle/MinimumCombinedLifecycle.kt @@ -28,8 +28,8 @@ internal class MinimumCombinedLifecycle( lifecycles.sortedBy { it.currentState }.forEach { manage(it) } } - override fun getLifecycle(): Lifecycle = - registry + override val lifecycle: Lifecycle + get() = registry fun manage(lifecycle: Lifecycle) { lifecycles += lifecycle diff --git a/libraries/core/src/main/kotlin/com/bumble/appyx/core/lifecycle/NodeLifecycleImpl.kt b/libraries/core/src/main/kotlin/com/bumble/appyx/core/lifecycle/NodeLifecycleImpl.kt index f4355f457..f32108116 100644 --- a/libraries/core/src/main/kotlin/com/bumble/appyx/core/lifecycle/NodeLifecycleImpl.kt +++ b/libraries/core/src/main/kotlin/com/bumble/appyx/core/lifecycle/NodeLifecycleImpl.kt @@ -8,8 +8,8 @@ internal class NodeLifecycleImpl(owner: LifecycleOwner) : NodeLifecycle { private val lifecycleRegistry = LifecycleRegistry(owner) - override fun getLifecycle(): Lifecycle = - lifecycleRegistry + override val lifecycle: Lifecycle + get() = lifecycleRegistry override fun updateLifecycleState(state: Lifecycle.State) { lifecycleRegistry.currentState = state diff --git a/libraries/core/src/main/kotlin/com/bumble/appyx/core/node/Node.kt b/libraries/core/src/main/kotlin/com/bumble/appyx/core/node/Node.kt index 6e652dea8..63104881e 100644 --- a/libraries/core/src/main/kotlin/com/bumble/appyx/core/node/Node.kt +++ b/libraries/core/src/main/kotlin/com/bumble/appyx/core/node/Node.kt @@ -168,8 +168,8 @@ open class Node @VisibleForTesting internal constructor( } } - override fun getLifecycle(): Lifecycle = - nodeLifecycle.lifecycle + override val lifecycle: Lifecycle + get() = nodeLifecycle.lifecycle override fun updateLifecycleState(state: Lifecycle.State) { if (lifecycle.currentState == state) return diff --git a/libraries/core/src/test/kotlin/com/bumble/appyx/core/lifecycle/TestLifecycle.kt b/libraries/core/src/test/kotlin/com/bumble/appyx/core/lifecycle/TestLifecycle.kt index ec20c4e2a..75eb29111 100644 --- a/libraries/core/src/test/kotlin/com/bumble/appyx/core/lifecycle/TestLifecycle.kt +++ b/libraries/core/src/test/kotlin/com/bumble/appyx/core/lifecycle/TestLifecycle.kt @@ -17,6 +17,7 @@ class TestLifecycle() : LifecycleOwner { registry.currentState = value } - override fun getLifecycle(): Lifecycle = registry + override val lifecycle: Lifecycle + get() = registry } diff --git a/libraries/core/src/test/kotlin/com/bumble/appyx/core/plugin/NodeLifecycleAwareTest.kt b/libraries/core/src/test/kotlin/com/bumble/appyx/core/plugin/NodeLifecycleAwareTest.kt index 71a36ee7c..994c77601 100644 --- a/libraries/core/src/test/kotlin/com/bumble/appyx/core/plugin/NodeLifecycleAwareTest.kt +++ b/libraries/core/src/test/kotlin/com/bumble/appyx/core/plugin/NodeLifecycleAwareTest.kt @@ -8,7 +8,6 @@ import androidx.lifecycle.LifecycleObserver import com.bumble.appyx.core.modality.BuildContext import com.bumble.appyx.core.node.Node import com.bumble.appyx.core.node.build -import com.bumble.appyx.core.plugin.NodeLifecycleAware import com.bumble.appyx.testing.junit4.util.MainDispatcherRule import org.junit.Assert.assertEquals import org.junit.Assert.assertNotEquals @@ -32,7 +31,8 @@ class NodeLifecycleAwareTest { // no-op } - override fun getCurrentState() = State.DESTROYED + override val currentState: State = State.DESTROYED + } private val nodeLifecycleAwarePlugin = object : NodeLifecycleAware { diff --git a/libraries/interop-ribs/build.gradle.kts b/libraries/interop-ribs/build.gradle.kts index 45aab1aa4..bbfc3a923 100644 --- a/libraries/interop-ribs/build.gradle.kts +++ b/libraries/interop-ribs/build.gradle.kts @@ -28,6 +28,7 @@ android { dependencies { api(project(":libraries:core")) api(libs.ribs.base) + api(libs.ribs.compose) val composeBom = platform(libs.compose.bom) @@ -36,7 +37,6 @@ dependencies { implementation(libs.androidx.lifecycle.java8) implementation(libs.androidx.activity.compose) implementation(libs.compose.ui.ui) - implementation(libs.ribs.compose) androidTestImplementation(composeBom) androidTestImplementation(libs.androidx.activity.compose) diff --git a/libraries/interop-ribs/src/main/kotlin/com/bumble/appyx/interop/ribs/InteropBackPressHandler.kt b/libraries/interop-ribs/src/main/kotlin/com/bumble/appyx/interop/ribs/InteropBackPressHandler.kt index 5dde59127..b269149c0 100644 --- a/libraries/interop-ribs/src/main/kotlin/com/bumble/appyx/interop/ribs/InteropBackPressHandler.kt +++ b/libraries/interop-ribs/src/main/kotlin/com/bumble/appyx/interop/ribs/InteropBackPressHandler.kt @@ -23,10 +23,10 @@ internal class InteropBackPressHandler : NodeLifecycleAware { private val dispatcher = OnBackPressedDispatcher() - private lateinit var lifecycle: Lifecycle + private lateinit var nodeLifecycle: Lifecycle override fun onCreate(nodeLifecycle: Lifecycle) { - lifecycle = nodeLifecycle + this.nodeLifecycle = nodeLifecycle } override fun handleBackPress(): Boolean = @@ -37,7 +37,8 @@ internal class InteropBackPressHandler : false } - override fun getLifecycle(): Lifecycle = lifecycle + override val lifecycle: Lifecycle + get() = nodeLifecycle override fun getOnBackPressedDispatcher(): OnBackPressedDispatcher = dispatcher diff --git a/libraries/interop-rx2/src/test/kotlin/com/bumble/appyx/interop/rx2/connectable/Rx2NodeConnectorTest.kt b/libraries/interop-rx2/src/test/kotlin/com/bumble/appyx/interop/rx2/connectable/Rx2NodeConnectorTest.kt index 98d227845..ab8de6d70 100644 --- a/libraries/interop-rx2/src/test/kotlin/com/bumble/appyx/interop/rx2/connectable/Rx2NodeConnectorTest.kt +++ b/libraries/interop-rx2/src/test/kotlin/com/bumble/appyx/interop/rx2/connectable/Rx2NodeConnectorTest.kt @@ -27,7 +27,7 @@ class Rx2NodeConnectorTest { private val lifecycle = object : Lifecycle() { private val lifecycleOwner = object : LifecycleOwner { - override fun getLifecycle(): Lifecycle = LifecycleRegistry(this) + override val lifecycle: Lifecycle = LifecycleRegistry(this) } override fun addObserver(observer: LifecycleObserver) { @@ -40,7 +40,8 @@ class Rx2NodeConnectorTest { // Deliberately empty } - override fun getCurrentState() = lifecycleState + override val currentState: State + get() = lifecycleState } sealed class Output { diff --git a/libraries/interop-rx3/src/main/kotlin/com/bumble/appyx/interop/rx3/connectable/NodeConnector.kt b/libraries/interop-rx3/src/main/kotlin/com/bumble/appyx/interop/rx3/connectable/NodeConnector.kt index f610176e3..7aec6269d 100644 --- a/libraries/interop-rx3/src/main/kotlin/com/bumble/appyx/interop/rx3/connectable/NodeConnector.kt +++ b/libraries/interop-rx3/src/main/kotlin/com/bumble/appyx/interop/rx3/connectable/NodeConnector.kt @@ -1,5 +1,6 @@ package com.bumble.appyx.interop.rx3.connectable +import android.annotation.SuppressLint import androidx.lifecycle.Lifecycle import com.bumble.appyx.core.lifecycle.subscribe import com.jakewharton.rxrelay3.PublishRelay @@ -53,6 +54,7 @@ class NodeConnector( } } + @SuppressLint("CheckResult") private fun switchToExhaust() { intake.subscribe { exhaust.accept(it) } cacheSubscription.dispose() diff --git a/libraries/interop-rx3/src/test/kotlin/com/bumble/appyx/interop/rx3/connectable/Rx3NodeConnectorTest.kt b/libraries/interop-rx3/src/test/kotlin/com/bumble/appyx/interop/rx3/connectable/Rx3NodeConnectorTest.kt index 53b907569..a7775123a 100644 --- a/libraries/interop-rx3/src/test/kotlin/com/bumble/appyx/interop/rx3/connectable/Rx3NodeConnectorTest.kt +++ b/libraries/interop-rx3/src/test/kotlin/com/bumble/appyx/interop/rx3/connectable/Rx3NodeConnectorTest.kt @@ -26,7 +26,8 @@ internal class Rx3NodeConnectorTest { private val lifecycle = object : Lifecycle() { private val lifecycleOwner = object : LifecycleOwner { - override fun getLifecycle(): Lifecycle = LifecycleRegistry(this) + override val lifecycle: Lifecycle + get() = LifecycleRegistry(this) } override fun addObserver(observer: LifecycleObserver) { @@ -39,7 +40,8 @@ internal class Rx3NodeConnectorTest { // Deliberately empty } - override fun getCurrentState() = lifecycleState + override val currentState: State + get() = lifecycleState } sealed class Output { diff --git a/samples/app/build.gradle.kts b/samples/app/build.gradle.kts index 9e0540b8f..c81dc54ca 100644 --- a/samples/app/build.gradle.kts +++ b/samples/app/build.gradle.kts @@ -65,7 +65,6 @@ dependencies { implementation(libs.androidx.appcompat) implementation(libs.androidx.core.splashscreen) implementation(libs.androidx.lifecycle.java8) - implementation(libs.androidx.lifecycle.runtime) implementation(libs.compose.material) implementation(libs.compose.ui.tooling) implementation(libs.compose.ui.ui) diff --git a/samples/sandbox/build.gradle.kts b/samples/sandbox/build.gradle.kts index 5fe2421ee..fba769c17 100644 --- a/samples/sandbox/build.gradle.kts +++ b/samples/sandbox/build.gradle.kts @@ -61,7 +61,6 @@ dependencies { implementation(libs.androidx.activity.compose) implementation(libs.androidx.appcompat) implementation(libs.androidx.lifecycle.java8) - implementation(libs.androidx.lifecycle.runtime) implementation(libs.compose.material) implementation(libs.compose.ui.tooling) implementation(libs.compose.ui.ui) diff --git a/samples/sandbox/lint-baseline.xml b/samples/sandbox/lint-baseline.xml index b3a2e338b..e19136970 100644 --- a/samples/sandbox/lint-baseline.xml +++ b/samples/sandbox/lint-baseline.xml @@ -1,16 +1,5 @@ - - - - - + + + + + + + + +