From 90540c13a42b737ee6db874f1b1e0cc6228f0d4d Mon Sep 17 00:00:00 2001 From: theronrogers Date: Tue, 25 Jul 2023 21:06:52 -0600 Subject: [PATCH 01/12] Update Kotlin, Compose & Jb Compose ver Kotlin 1.8.20 -> 1.9.0 Jetpack Compose 1.4.2 -> 1.5.0-beta03 Jetbrains Compose 1.4.0 -> 1.5.0-dev1122 This required replacing `AnimatedContentScope` with `AnimatedContentTransitionScope` because `AnimatedContentScope` is now a sealed interface. Also needed to swap deprecated `EnterTransition.with` calls for `EnterTransition.togetherWith` --- buildSrc/src/main/kotlin/Versions.kt | 6 +++--- .../moe/tlaster/precompose/navigation/NavHost.kt | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 78cc86b4..baaafcae 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -10,7 +10,7 @@ object Versions { } object Kotlin { - const val lang = "1.8.20" + const val lang = "1.9.0" const val coroutines = "1.7.1" } @@ -21,8 +21,8 @@ object Versions { const val spotless = "6.7.0" const val ktlint = "0.45.2" - const val compose = "1.4.2" - const val compose_jb = "1.4.0" + const val compose = "1.5.0-beta03" + const val compose_jb = "1.5.0-dev1122" object AndroidX { const val activity = "1.7.0" diff --git a/precompose/src/commonMain/kotlin/moe/tlaster/precompose/navigation/NavHost.kt b/precompose/src/commonMain/kotlin/moe/tlaster/precompose/navigation/NavHost.kt index 244f13b1..8be02c9f 100644 --- a/precompose/src/commonMain/kotlin/moe/tlaster/precompose/navigation/NavHost.kt +++ b/precompose/src/commonMain/kotlin/moe/tlaster/precompose/navigation/NavHost.kt @@ -1,12 +1,12 @@ package moe.tlaster.precompose.navigation import androidx.compose.animation.AnimatedContent -import androidx.compose.animation.AnimatedContentScope +import androidx.compose.animation.AnimatedContentTransitionScope import androidx.compose.animation.ContentTransform import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition import androidx.compose.animation.ExperimentalAnimationApi -import androidx.compose.animation.with +import androidx.compose.animation.togetherWith import androidx.compose.foundation.gestures.Orientation import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxWithConstraints @@ -96,16 +96,16 @@ fun NavHost( ) } - val transitionSpec: AnimatedContentScope.() -> ContentTransform = { + val transitionSpec: AnimatedContentTransitionScope.() -> ContentTransform = { val actualTransaction = run { if (navigator.stackManager.contains(initialState)) targetState else initialState }.navTransition ?: navTransition if (!navigator.stackManager.contains(initialState)) { - actualTransaction.resumeTransition.with(actualTransaction.destroyTransition).apply { + actualTransaction.resumeTransition.togetherWith(actualTransaction.destroyTransition).apply { targetContentZIndex = actualTransaction.enterTargetContentZIndex } } else { - actualTransaction.createTransition.with(actualTransaction.pauseTransition).apply { + actualTransaction.createTransition.togetherWith(actualTransaction.pauseTransition).apply { targetContentZIndex = actualTransaction.exitTargetContentZIndex } } @@ -186,7 +186,7 @@ fun NavHost( backStackEntry, transitionSpec = { if (prevWasSwiped) { - EnterTransition.None with ExitTransition.None + EnterTransition.None togetherWith ExitTransition.None } else { transitionSpec() } From 2d45abef87250b5a971073abd300aa25447c921b Mon Sep 17 00:00:00 2001 From: theronrogers Date: Tue, 25 Jul 2023 21:57:21 -0600 Subject: [PATCH 02/12] Update Coroutines & AndroidX Activity --- buildSrc/src/main/kotlin/Versions.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index baaafcae..1752616d 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -11,7 +11,7 @@ object Versions { object Kotlin { const val lang = "1.9.0" - const val coroutines = "1.7.1" + const val coroutines = "1.7.2" } object Java { @@ -25,7 +25,7 @@ object Versions { const val compose_jb = "1.5.0-dev1122" object AndroidX { - const val activity = "1.7.0" + const val activity = "1.7.2" const val appcompat = "1.6.1" } } From 4625427eb09d185a830c0e305310a6ba35dd0724 Mon Sep 17 00:00:00 2001 From: theronrogers Date: Tue, 25 Jul 2023 22:11:30 -0600 Subject: [PATCH 03/12] Update Jetbrains Compose usage This may affect window or app titles on iOS. I've left the unused title param for now. --- .../kotlin/moe/tlaster/precompose/ComposeWindow.kt | 2 -- .../kotlin/moe/tlaster/precompose/PreComposeApplication.kt | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/precompose/src/macosMain/kotlin/moe/tlaster/precompose/ComposeWindow.kt b/precompose/src/macosMain/kotlin/moe/tlaster/precompose/ComposeWindow.kt index aa3b627d..67126b45 100644 --- a/precompose/src/macosMain/kotlin/moe/tlaster/precompose/ComposeWindow.kt +++ b/precompose/src/macosMain/kotlin/moe/tlaster/precompose/ComposeWindow.kt @@ -3,7 +3,6 @@ package moe.tlaster.precompose import androidx.compose.runtime.Composable import androidx.compose.ui.createSkiaLayer -import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Rect import androidx.compose.ui.input.pointer.PointerIcon import androidx.compose.ui.native.ComposeLayer @@ -98,7 +97,6 @@ internal class ComposeWindow( val layer = ComposeLayer( layer = createSkiaLayer(), platform = platform, - getTopLeftOffset = { Offset.Zero }, input = macosTextInputService.input ) val title: String diff --git a/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt b/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt index ef69d3c5..b1ad781c 100644 --- a/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt +++ b/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt @@ -3,7 +3,7 @@ package moe.tlaster.precompose import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.remember -import androidx.compose.ui.window.Application +import androidx.compose.ui.window.ComposeUIViewController import moe.tlaster.precompose.lifecycle.LifecycleOwner import moe.tlaster.precompose.lifecycle.LifecycleRegistry import moe.tlaster.precompose.lifecycle.LocalLifecycleOwner @@ -18,9 +18,7 @@ fun PreComposeApplication( title: String, content: @Composable () -> Unit ): UIViewController { - return Application( - title - ) { + return ComposeUIViewController { val holder = remember { PreComposeWindowHolder() } From c898ffcd2200d531ee10b83a6b18970db9102891 Mon Sep 17 00:00:00 2001 From: Theron Rogers Date: Wed, 26 Jul 2023 09:10:12 -0600 Subject: [PATCH 04/12] Update Kotlin Coroutines version 1.7.2 -> 1.7.3 --- buildSrc/src/main/kotlin/Versions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 1752616d..f0452064 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -11,7 +11,7 @@ object Versions { object Kotlin { const val lang = "1.9.0" - const val coroutines = "1.7.2" + const val coroutines = "1.7.3" } object Java { From ea22cb74912ed7bcb60850bf8ab1a4f8c6c3665b Mon Sep 17 00:00:00 2001 From: Theron Rogers Date: Wed, 26 Jul 2023 12:30:21 -0600 Subject: [PATCH 05/12] suppress warning on function name --- .../kotlin/moe/tlaster/precompose/PreComposeApplication.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt b/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt index b1ad781c..7ab94a5e 100644 --- a/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt +++ b/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt @@ -14,6 +14,7 @@ import moe.tlaster.precompose.ui.BackDispatcherOwner import moe.tlaster.precompose.ui.LocalBackDispatcherOwner import platform.UIKit.UIViewController +@Suppress("FunctionName") fun PreComposeApplication( title: String, content: @Composable () -> Unit From fb762b07070810445bd9c121cca6a942310523cf Mon Sep 17 00:00:00 2001 From: Theron Rogers Date: Wed, 26 Jul 2023 12:38:10 -0600 Subject: [PATCH 06/12] remove unused title params --- .../kotlin/moe/tlaster/precompose/PreComposeApplication.kt | 5 +++-- sample/todo/ios/src/uikitMain/kotlin/main.uikit.kt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt b/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt index 7ab94a5e..07e5b245 100644 --- a/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt +++ b/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt @@ -3,6 +3,7 @@ package moe.tlaster.precompose import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.remember +import androidx.compose.ui.uikit.ComposeUIViewControllerConfiguration import androidx.compose.ui.window.ComposeUIViewController import moe.tlaster.precompose.lifecycle.LifecycleOwner import moe.tlaster.precompose.lifecycle.LifecycleRegistry @@ -16,10 +17,10 @@ import platform.UIKit.UIViewController @Suppress("FunctionName") fun PreComposeApplication( - title: String, + configure: ComposeUIViewControllerConfiguration.() -> Unit, content: @Composable () -> Unit ): UIViewController { - return ComposeUIViewController { + return ComposeUIViewController(configure) { val holder = remember { PreComposeWindowHolder() } diff --git a/sample/todo/ios/src/uikitMain/kotlin/main.uikit.kt b/sample/todo/ios/src/uikitMain/kotlin/main.uikit.kt index 51753238..37b733b8 100644 --- a/sample/todo/ios/src/uikitMain/kotlin/main.uikit.kt +++ b/sample/todo/ios/src/uikitMain/kotlin/main.uikit.kt @@ -47,7 +47,7 @@ class SkikoAppDelegate : UIResponder, UIApplicationDelegateProtocol { override fun application(application: UIApplication, didFinishLaunchingWithOptions: Map?): Boolean { window = UIWindow(frame = UIScreen.mainScreen.bounds).apply { - rootViewController = PreComposeApplication("PreCompose") { + rootViewController = PreComposeApplication { Column { Spacer( modifier = Modifier From ef362269a918e7f033e6fc28f8e498e4885c9689 Mon Sep 17 00:00:00 2001 From: Theron Rogers Date: Wed, 26 Jul 2023 12:51:01 -0600 Subject: [PATCH 07/12] set default empty unit for configure in PreComposeApplication --- .../kotlin/moe/tlaster/precompose/PreComposeApplication.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt b/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt index 07e5b245..a195a344 100644 --- a/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt +++ b/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt @@ -17,7 +17,7 @@ import platform.UIKit.UIViewController @Suppress("FunctionName") fun PreComposeApplication( - configure: ComposeUIViewControllerConfiguration.() -> Unit, + configure: ComposeUIViewControllerConfiguration.() -> Unit ={}, content: @Composable () -> Unit ): UIViewController { return ComposeUIViewController(configure) { From 89e83f0ef70fe8cb8008dc9ee1463abb77c5f5b7 Mon Sep 17 00:00:00 2001 From: Theron Rogers Date: Wed, 26 Jul 2023 21:55:51 -0600 Subject: [PATCH 08/12] fix formatting with spotlessApply --- .../kotlin/moe/tlaster/precompose/PreComposeApplication.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt b/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt index a195a344..a4fdb84d 100644 --- a/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt +++ b/precompose/src/uikitMain/kotlin/moe/tlaster/precompose/PreComposeApplication.kt @@ -17,7 +17,7 @@ import platform.UIKit.UIViewController @Suppress("FunctionName") fun PreComposeApplication( - configure: ComposeUIViewControllerConfiguration.() -> Unit ={}, + configure: ComposeUIViewControllerConfiguration.() -> Unit = {}, content: @Composable () -> Unit ): UIViewController { return ComposeUIViewController(configure) { From 65d74e744a71a4017449fb6feef2525ee0365dfb Mon Sep 17 00:00:00 2001 From: Theron Rogers Date: Thu, 27 Jul 2023 17:23:23 -0600 Subject: [PATCH 09/12] remove title parameter from PreComposeApplication in molecule sample --- .../kotlin/moe/tlaster/precompose/molecule/sample/Main.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample/molecule/src/uikitMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt b/sample/molecule/src/uikitMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt index 7fd8c188..1a6e1444 100644 --- a/sample/molecule/src/uikitMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt +++ b/sample/molecule/src/uikitMain/kotlin/moe/tlaster/precompose/molecule/sample/Main.kt @@ -34,7 +34,7 @@ class SkikoAppDelegate : UIResponder, UIApplicationDelegateProtocol { override fun application(application: UIApplication, didFinishLaunchingWithOptions: Map?): Boolean { window = UIWindow(frame = UIScreen.mainScreen.bounds).apply { - rootViewController = PreComposeApplication("PreCompose Molecule Sample") { + rootViewController = PreComposeApplication { App() } makeKeyAndVisible() From 6a7edc6dc68878e2a1be6bc07353ac29294494f1 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Mon, 31 Jul 2023 08:49:27 +0900 Subject: [PATCH 10/12] upgrade to compose 1.5.0-beta01 --- buildSrc/src/main/kotlin/Versions.kt | 2 +- precompose-viewmodel/build.gradle.kts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index f0452064..0353c6d3 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -22,7 +22,7 @@ object Versions { const val spotless = "6.7.0" const val ktlint = "0.45.2" const val compose = "1.5.0-beta03" - const val compose_jb = "1.5.0-dev1122" + const val compose_jb = "1.5.0-beta01" object AndroidX { const val activity = "1.7.2" diff --git a/precompose-viewmodel/build.gradle.kts b/precompose-viewmodel/build.gradle.kts index 5b9dbeb5..575be095 100644 --- a/precompose-viewmodel/build.gradle.kts +++ b/precompose-viewmodel/build.gradle.kts @@ -89,6 +89,11 @@ kotlin { implementation(compose.foundation) } } + val jsTest by getting { + dependencies { + implementation(kotlin("test-js")) + } + } val iosMain by creating { dependsOn(commonMain) dependencies { From 2ddad8cbe4f498be4d30918b53a5d73fd7ac4f31 Mon Sep 17 00:00:00 2001 From: Tlaster Date: Mon, 31 Jul 2023 09:26:17 +0900 Subject: [PATCH 11/12] upgrade ci to java 17 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d736b48d..adfa0b2b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Apply Signing if: ${{ github.event_name != 'pull_request' }} From d725afd873664e00fe90f9a72b1dfaf5baf4a39e Mon Sep 17 00:00:00 2001 From: Tlaster Date: Mon, 31 Jul 2023 11:21:56 +0900 Subject: [PATCH 12/12] update precompose version to 1.5.0-beta01 --- buildSrc/src/main/kotlin/Versions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 0353c6d3..0aacc4e5 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -1,7 +1,7 @@ import org.gradle.api.JavaVersion object Versions { - const val precompose = "1.4.4" + const val precompose = "1.5.0-beta01" object Android { const val min = 21 const val compile = 33