Skip to content

Commit c9441c2

Browse files
authored
Merge pull request #251 from Tlaster/compose-1.6
Compose 1.6
2 parents 9fc94e1 + c40cad7 commit c9441c2

File tree

28 files changed

+677
-415
lines changed

28 files changed

+677
-415
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ allprojects {
3434
}
3535

3636
extra.apply {
37-
set("precomposeVersion", "1.5.11")
37+
set("precomposeVersion", "1.6.0-rc05")
3838

3939
set("jvmTarget", "11")
4040

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ org.gradle.jvmargs=-Xmx4g
1818
org.jetbrains.compose.experimental.jscanvas.enabled=true
1919
org.jetbrains.compose.experimental.macos.enabled=true
2020
org.jetbrains.compose.experimental.uikit.enabled=true
21+
org.jetbrains.compose.experimental.wasm.enabled=true
2122
kotlin.mpp.androidSourceSetLayoutVersion=2
2223
android.defaults.buildfeatures.buildconfig=true
2324
android.nonTransitiveRClass=false

gradle/libs.versions.toml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
[versions] # also check project root build.gradle.kts for versions
2-
androidx-animation = "1.5.3"
3-
androidx-foundation = "1.5.3"
2+
androidx-animation = "1.6.1"
3+
androidx-foundation = "1.6.1"
44
androidx-appcompat = "1.6.1"
55
androidx-coreKtx = "1.12.0"
6-
androidxActivityVer = "1.8.0"
7-
androidGradlePlugin = "8.1.1"
6+
androidxActivityVer = "1.8.2"
7+
androidGradlePlugin = "8.2.2"
88
junit = "4.13.2"
99
junitJupiterEngine = "5.10.1"
1010
junitJupiterApi = "5.10.1"
11-
kotlin = "1.9.21"
12-
kotlinxCoroutinesCore = "1.7.3"
13-
lifecycleRuntimeKtx = "2.6.2"
14-
material = "1.5.0"
11+
kotlin = "1.9.22"
12+
lifecycleRuntimeKtx = "2.7.0"
13+
material = "1.6.1"
14+
kotlinxCoroutinesCore = "1.8.0"
1515
moleculeRuntime = "1.3.2"
1616
savedstateKtx = "1.2.1"
1717
spotless = "6.25.0"
18-
jetbrainsComposePlugin = "1.5.11"
19-
skiko = "0.7.90"
20-
koin = "3.5.0"
21-
koin-compose = "1.1.2"
18+
jetbrainsComposePlugin = "1.6.0"
19+
skiko = "0.7.93"
20+
koin = "3.6.0-alpha3"
21+
uuid = "0.8.2"
2222

2323
[libraries]
2424
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "androidxActivityVer" }
@@ -41,11 +41,12 @@ molecule-runtime = { module = "app.cash.molecule:molecule-runtime", version.ref
4141
skiko = { module = "org.jetbrains.skiko:skiko", version.ref = "skiko" }
4242
skiko-js = { module = "org.jetbrains.skiko:skiko-js-wasm-runtime", version.ref = "skiko" }
4343
koin = { module = "io.insert-koin:koin-core", version.ref = "koin" }
44-
koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koin-compose" }
44+
koin-compose = { module = "io.insert-koin:koin-compose", version = "1.2.0-alpha3" }
45+
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
4546

4647
[plugins]
4748
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
4849
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
4950
jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "jetbrainsComposePlugin" }
5051
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
51-
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
52+
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }

precompose-koin/build.gradle.kts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ group = "moe.tlaster"
1212
version = rootProject.extra.get("precomposeVersion") as String
1313

1414
kotlin {
15-
1615
applyDefaultHierarchyTemplate {
1716
common {
1817
group("jvmAndroid") {
@@ -41,6 +40,10 @@ kotlin {
4140
js(IR) {
4241
browser()
4342
}
43+
wasmJs {
44+
browser()
45+
binaries.executable()
46+
}
4447
sourceSets {
4548
val commonMain by getting {
4649
dependencies {
@@ -106,6 +109,10 @@ kotlin {
106109
}
107110
}
108111

112+
// adding it here to make sure skiko is unpacked and available in web tests
113+
compose.experimental {
114+
web.application {}
115+
}
109116
android {
110117
compileSdk = rootProject.extra.get("android-compile") as Int
111118
buildToolsVersion = rootProject.extra.get("android-build-tools") as String
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package moe.tlaster.precompose.molecule
22

3+
import app.cash.molecule.DisplayLinkClock
34
import kotlinx.coroutines.Dispatchers
45
import kotlin.coroutines.CoroutineContext
56

6-
internal actual fun providePlatformDispatcher(): CoroutineContext = Dispatchers.Main
7+
internal actual fun providePlatformDispatcher(): CoroutineContext = DisplayLinkClock + Dispatchers.Main

precompose-viewmodel/build.gradle.kts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ kotlin {
4040
js(IR) {
4141
browser()
4242
}
43+
wasmJs {
44+
browser()
45+
binaries.executable()
46+
}
4347
sourceSets {
4448
val commonMain by getting {
4549
dependencies {
@@ -99,9 +103,17 @@ kotlin {
99103
implementation(compose.foundation)
100104
}
101105
}
106+
val wasmJsMain by getting {
107+
dependencies {
108+
implementation(compose.foundation)
109+
}
110+
}
102111
}
103112
}
104-
113+
// adding it here to make sure skiko is unpacked and available in web tests
114+
compose.experimental {
115+
web.application {}
116+
}
105117
android {
106118
compileSdk = rootProject.extra.get("android-compile") as Int
107119
buildToolsVersion = rootProject.extra.get("android-build-tools") as String

precompose/build.gradle.kts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import org.jetbrains.compose.ExperimentalComposeLibrary
2+
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
3+
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
14
import java.util.Properties
25

36
plugins {
@@ -20,6 +23,16 @@ kotlin {
2023
iosSimulatorArm64()
2124
androidTarget {
2225
publishLibraryVariants("release", "debug")
26+
27+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
28+
instrumentedTestVariant {
29+
sourceSetTree.set(KotlinSourceSetTree.test)
30+
31+
dependencies {
32+
implementation("androidx.compose.ui:ui-test-junit4-android:1.5.4")
33+
debugImplementation("androidx.compose.ui:ui-test-manifest:1.5.4")
34+
}
35+
}
2336
}
2437
jvm {
2538
compilations.all {
@@ -32,13 +45,18 @@ kotlin {
3245
js(IR) {
3346
browser()
3447
}
48+
wasmJs {
49+
browser()
50+
binaries.executable()
51+
}
3552
sourceSets {
3653
val commonMain by getting {
3754
dependencies {
3855
compileOnly(compose.foundation)
3956
compileOnly(compose.animation)
4057
compileOnly(compose.material)
4158
api(libs.kotlinx.coroutines.core)
59+
implementation(libs.uuid)
4260
}
4361
}
4462
val commonTest by getting {
@@ -48,6 +66,8 @@ kotlin {
4866
implementation(kotlin("test-common"))
4967
implementation(kotlin("test-annotations-common"))
5068
implementation(libs.kotlinx.coroutines.test)
69+
@OptIn(ExperimentalComposeLibrary::class)
70+
implementation(compose.uiTest)
5171
// @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
5272
// implementation(compose.uiTestJUnit4)
5373
}
@@ -91,6 +111,7 @@ kotlin {
91111
implementation(kotlin("test-junit5"))
92112
implementation(libs.junit.jupiter.api)
93113
runtimeOnly(libs.junit.jupiter.engine)
114+
implementation(compose.desktop.currentOs)
94115
}
95116
}
96117
val jsMain by getting {
@@ -112,15 +133,26 @@ kotlin {
112133
implementation(compose.material)
113134
}
114135
}
136+
val wasmJsMain by getting {
137+
dependencies {
138+
implementation(compose.foundation)
139+
implementation(compose.animation)
140+
implementation(compose.material)
141+
}
142+
}
115143
}
116144
}
117-
145+
// adding it here to make sure skiko is unpacked and available in web tests
146+
compose.experimental {
147+
web.application {}
148+
}
118149
android {
119150
compileSdk = rootProject.extra.get("android-compile") as Int
120151
buildToolsVersion = rootProject.extra.get("android-build-tools") as String
121152
namespace = "moe.tlaster.precompose"
122153
defaultConfig {
123154
minSdk = rootProject.extra.get("androidMinSdk") as Int
155+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
124156
}
125157
compileOptions {
126158
sourceCompatibility = JavaVersion.toVersion(rootProject.extra.get("jvmTarget") as String)

precompose/src/androidMain/kotlin/moe/tlaster/precompose/lifecycle/PreComposeViewModel.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package moe.tlaster.precompose.lifecycle
22

3+
import androidx.activity.BackEventCompat
34
import androidx.activity.OnBackPressedCallback
45
import moe.tlaster.precompose.stateholder.StateHolder
56
import moe.tlaster.precompose.ui.BackDispatcher
@@ -26,6 +27,18 @@ internal class PreComposeViewModel :
2627
override fun handleOnBackPressed() {
2728
backDispatcher.onBackPress()
2829
}
30+
31+
override fun handleOnBackStarted(backEvent: BackEventCompat) {
32+
backDispatcher.onBackStarted()
33+
}
34+
35+
override fun handleOnBackProgressed(backEvent: BackEventCompat) {
36+
backDispatcher.onBackProgressed(backEvent.progress)
37+
}
38+
39+
override fun handleOnBackCancelled() {
40+
backDispatcher.onBackCancelled()
41+
}
2942
}
3043

3144
override fun onCleared() {

0 commit comments

Comments
 (0)