diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataScreenModel.kt index 35d7d39a..0426fa87 100644 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataScreenModel.kt +++ b/samples/android/src/main/java/cafe/adriel/voyager/sample/liveDataIntegration/LiveDataScreenModel.kt @@ -1,6 +1,6 @@ package cafe.adriel.voyager.sample.liveDataIntegration -import cafe.adriel.voyager.core.model.coroutineScope +import cafe.adriel.voyager.core.model.screenModelScope import cafe.adriel.voyager.livedata.LiveScreenModel import cafe.adriel.voyager.sample.sampleItems import kotlinx.coroutines.delay @@ -16,7 +16,7 @@ class LiveDataScreenModel : LiveScreenModel(State.Loa private val items = sampleItems fun getItems() { - coroutineScope.launch { + screenModelScope.launch { delay(1_000) mutableState.postValue(State.Result(items)) } diff --git a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/DetailsScreenModel.kt b/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/DetailsScreenModel.kt index 07d680b4..3e31e1e5 100644 --- a/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/DetailsScreenModel.kt +++ b/samples/android/src/main/java/cafe/adriel/voyager/sample/screenModel/DetailsScreenModel.kt @@ -1,7 +1,7 @@ package cafe.adriel.voyager.sample.screenModel import cafe.adriel.voyager.core.model.StateScreenModel -import cafe.adriel.voyager.core.model.coroutineScope +import cafe.adriel.voyager.core.model.screenModelScope import kotlinx.coroutines.delay import kotlinx.coroutines.launch @@ -15,7 +15,7 @@ class DetailsScreenModel( } fun getItem(index: Int) { - coroutineScope.launch { + screenModelScope.launch { delay(1_000) mutableState.value = State.Result("Item #$index") } diff --git a/voyager-core/src/commonMain/kotlin/cafe/adriel/voyager/core/stack/SnapshotStateStack.kt b/voyager-core/src/commonMain/kotlin/cafe/adriel/voyager/core/stack/SnapshotStateStack.kt index 1616e49e..d6e7adb8 100644 --- a/voyager-core/src/commonMain/kotlin/cafe/adriel/voyager/core/stack/SnapshotStateStack.kt +++ b/voyager-core/src/commonMain/kotlin/cafe/adriel/voyager/core/stack/SnapshotStateStack.kt @@ -79,10 +79,6 @@ public class SnapshotStateStack( stateStack.lastOrNull() } - public override val lastOrNull: Item? by derivedStateOf { - lastItemOrNull - } - public override val size: Int by derivedStateOf { stateStack.size } diff --git a/voyager-hilt/build.gradle.kts b/voyager-hilt/build.gradle.kts index 0b0f24e9..41cbdcf4 100644 --- a/voyager-hilt/build.gradle.kts +++ b/voyager-hilt/build.gradle.kts @@ -19,6 +19,7 @@ kapt { } dependencies { + api(projects.voyagerScreenmodel) api(projects.voyagerNavigator) implementation(libs.compose.runtime) diff --git a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModel.kt b/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModel.kt index 26f5841b..26dce615 100644 --- a/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModel.kt +++ b/voyager-hilt/src/main/java/cafe/adriel/voyager/hilt/ScreenModel.kt @@ -4,11 +4,11 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.platform.LocalContext import cafe.adriel.voyager.core.annotation.ExperimentalVoyagerApi import cafe.adriel.voyager.core.model.ScreenModel +import cafe.adriel.voyager.core.model.rememberNavigatorScreenModel import cafe.adriel.voyager.core.model.rememberScreenModel import cafe.adriel.voyager.core.screen.Screen import cafe.adriel.voyager.hilt.internal.componentActivity import cafe.adriel.voyager.navigator.Navigator -import cafe.adriel.voyager.navigator.screenModel.rememberNavigatorScreenModel import dagger.hilt.android.EntryPointAccessors /** diff --git a/voyager-kodein/build.gradle.kts b/voyager-kodein/build.gradle.kts index d6bea9d9..13c4efeb 100644 --- a/voyager-kodein/build.gradle.kts +++ b/voyager-kodein/build.gradle.kts @@ -16,6 +16,7 @@ kotlin { val commonMain by getting { dependencies { api(projects.voyagerCore) + api(projects.voyagerScreenmodel) api(projects.voyagerNavigator) compileOnly(compose.runtime) compileOnly(compose.runtimeSaveable) diff --git a/voyager-kodein/src/commonMain/kotlin/cafe/adriel/voyager/kodein/ScreenModel.kt b/voyager-kodein/src/commonMain/kotlin/cafe/adriel/voyager/kodein/ScreenModel.kt index 70c3d332..a9057f79 100644 --- a/voyager-kodein/src/commonMain/kotlin/cafe/adriel/voyager/kodein/ScreenModel.kt +++ b/voyager-kodein/src/commonMain/kotlin/cafe/adriel/voyager/kodein/ScreenModel.kt @@ -3,10 +3,10 @@ package cafe.adriel.voyager.kodein import androidx.compose.runtime.Composable import cafe.adriel.voyager.core.annotation.ExperimentalVoyagerApi import cafe.adriel.voyager.core.model.ScreenModel +import cafe.adriel.voyager.core.model.rememberNavigatorScreenModel import cafe.adriel.voyager.core.model.rememberScreenModel import cafe.adriel.voyager.core.screen.Screen import cafe.adriel.voyager.navigator.Navigator -import cafe.adriel.voyager.navigator.screenModel.rememberNavigatorScreenModel import org.kodein.di.compose.localDI import org.kodein.di.direct import org.kodein.di.provider diff --git a/voyager-koin/build.gradle.kts b/voyager-koin/build.gradle.kts index a70337c1..7e3ad373 100644 --- a/voyager-koin/build.gradle.kts +++ b/voyager-koin/build.gradle.kts @@ -19,6 +19,7 @@ kotlin { val commonMain by getting { dependencies { api(projects.voyagerCore) + api(projects.voyagerScreenmodel) api(projects.voyagerNavigator) compileOnly(compose.runtime) diff --git a/voyager-koin/src/commonMain/kotlin/cafe/adriel/voyager/koin/ScreenModel.kt b/voyager-koin/src/commonMain/kotlin/cafe/adriel/voyager/koin/ScreenModel.kt index 38539bb5..b01a3a9a 100644 --- a/voyager-koin/src/commonMain/kotlin/cafe/adriel/voyager/koin/ScreenModel.kt +++ b/voyager-koin/src/commonMain/kotlin/cafe/adriel/voyager/koin/ScreenModel.kt @@ -3,10 +3,10 @@ package cafe.adriel.voyager.koin import androidx.compose.runtime.Composable import cafe.adriel.voyager.core.annotation.ExperimentalVoyagerApi import cafe.adriel.voyager.core.model.ScreenModel +import cafe.adriel.voyager.core.model.rememberNavigatorScreenModel import cafe.adriel.voyager.core.model.rememberScreenModel import cafe.adriel.voyager.core.screen.Screen import cafe.adriel.voyager.navigator.Navigator -import cafe.adriel.voyager.navigator.screenModel.rememberNavigatorScreenModel import org.koin.compose.getKoin import org.koin.core.parameter.ParametersDefinition import org.koin.core.qualifier.Qualifier diff --git a/voyager-livedata/build.gradle.kts b/voyager-livedata/build.gradle.kts index 610e8615..86d92754 100644 --- a/voyager-livedata/build.gradle.kts +++ b/voyager-livedata/build.gradle.kts @@ -15,6 +15,7 @@ android { dependencies { api(projects.voyagerCore) + api(projects.voyagerScreenmodel) implementation(libs.compose.runtimeLiveData) diff --git a/voyager-rxjava/build.gradle.kts b/voyager-rxjava/build.gradle.kts index 05881e86..436a65f4 100644 --- a/voyager-rxjava/build.gradle.kts +++ b/voyager-rxjava/build.gradle.kts @@ -15,6 +15,7 @@ kotlin { val jvmMain by getting { dependencies { api(projects.voyagerCore) + api(projects.voyagerScreenmodel) compileOnly(libs.rxjava) } }