diff --git a/examples/todoapp/android/src/main/java/example/todo/android/MainActivity.kt b/examples/todoapp/android/src/main/java/example/todo/android/MainActivity.kt index 3c06a1fc99..063c27f4d4 100755 --- a/examples/todoapp/android/src/main/java/example/todo/android/MainActivity.kt +++ b/examples/todoapp/android/src/main/java/example/todo/android/MainActivity.kt @@ -6,7 +6,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.compose.material.MaterialTheme import androidx.compose.material.Surface import com.arkivanov.decompose.ComponentContext -import com.arkivanov.decompose.extensions.compose.jetbrains.rememberRootComponent +import com.arkivanov.decompose.defaultComponentContext import com.arkivanov.mvikotlin.logging.store.LoggingStoreFactory import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory import com.arkivanov.mvikotlin.timetravel.store.TimeTravelStoreFactory @@ -20,10 +20,12 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + val root = todoRoot(defaultComponentContext()) + setContent { ComposeAppTheme { Surface(color = MaterialTheme.colors.background) { - TodoRootContent(rememberRootComponent(::todoRoot)) + TodoRootContent(root) } } } @@ -32,7 +34,7 @@ class MainActivity : AppCompatActivity() { private fun todoRoot(componentContext: ComponentContext): TodoRoot = TodoRootComponent( componentContext = componentContext, - storeFactory = LoggingStoreFactory(TimeTravelStoreFactory(DefaultStoreFactory)), + storeFactory = LoggingStoreFactory(TimeTravelStoreFactory(DefaultStoreFactory())), database = DefaultTodoSharedDatabase(TodoDatabaseDriver(context = this)) ) } diff --git a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt index f742f198ff..e96e50807f 100644 --- a/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt +++ b/examples/todoapp/buildSrc/buildSrc/src/main/kotlin/Deps.kt @@ -13,7 +13,7 @@ object Deps { object Compose { // __LATEST_COMPOSE_RELEASE_VERSION__ - private const val VERSION = "1.0.0-alpha1" + private const val VERSION = "1.0.0-alpha2" const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION" } } @@ -38,7 +38,7 @@ object Deps { object ArkIvanov { object MVIKotlin { - private const val VERSION = "2.0.3" + private const val VERSION = "3.0.0-alpha01" const val rx = "com.arkivanov.mvikotlin:rx:$VERSION" const val mvikotlin = "com.arkivanov.mvikotlin:mvikotlin:$VERSION" const val mvikotlinMain = "com.arkivanov.mvikotlin:mvikotlin-main:$VERSION" @@ -48,7 +48,7 @@ object Deps { } object Decompose { - private const val VERSION = "0.2.6" + private const val VERSION = "0.3.1" const val decompose = "com.arkivanov.decompose:decompose:$VERSION" const val extensionsCompose = "com.arkivanov.decompose:extensions-compose-jetbrains:$VERSION" } diff --git a/examples/todoapp/common/main/src/commonTest/kotlin/example/todo/common/main/integration/TodoMainTest.kt b/examples/todoapp/common/main/src/commonTest/kotlin/example/todo/common/main/integration/TodoMainTest.kt index 7d34263c38..2ce2159b99 100644 --- a/examples/todoapp/common/main/src/commonTest/kotlin/example/todo/common/main/integration/TodoMainTest.kt +++ b/examples/todoapp/common/main/src/commonTest/kotlin/example/todo/common/main/integration/TodoMainTest.kt @@ -1,7 +1,7 @@ package example.todo.common.main.integration import com.arkivanov.decompose.DefaultComponentContext -import com.arkivanov.decompose.lifecycle.LifecycleRegistry +import com.arkivanov.essenty.lifecycle.LifecycleRegistry import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory import com.badoo.reaktive.scheduler.overrideSchedulers import com.badoo.reaktive.subject.publish.PublishSubject @@ -32,7 +32,7 @@ class TodoMainTest { private val impl by lazy { TodoMainComponent( componentContext = DefaultComponentContext(lifecycle = lifecycle), - storeFactory = DefaultStoreFactory, + storeFactory = DefaultStoreFactory(), database = database, output = outputSubject ) diff --git a/examples/todoapp/common/main/src/commonTest/kotlin/example/todo/common/main/store/TodoMainStoreTest.kt b/examples/todoapp/common/main/src/commonTest/kotlin/example/todo/common/main/store/TodoMainStoreTest.kt index 4a74b7fa18..c5ace73e79 100644 --- a/examples/todoapp/common/main/src/commonTest/kotlin/example/todo/common/main/store/TodoMainStoreTest.kt +++ b/examples/todoapp/common/main/src/commonTest/kotlin/example/todo/common/main/store/TodoMainStoreTest.kt @@ -15,7 +15,7 @@ import kotlin.test.assertTrue class TodoMainStoreTest { private val database = TestTodoMainStoreDatabase() - private val provider = TodoMainStoreProvider(storeFactory = DefaultStoreFactory, database = database) + private val provider = TodoMainStoreProvider(storeFactory = DefaultStoreFactory(), database = database) @BeforeTest fun before() { diff --git a/examples/todoapp/common/root/build.gradle.kts b/examples/todoapp/common/root/build.gradle.kts index 75e7a9a4a3..bf618dc4a0 100755 --- a/examples/todoapp/common/root/build.gradle.kts +++ b/examples/todoapp/common/root/build.gradle.kts @@ -11,6 +11,7 @@ kotlin { binaries { framework { baseName = "Todo" + transitiveExport = true linkerOpts.add("-lsqlite3") export(project(":common:database")) export(project(":common:main")) diff --git a/examples/todoapp/common/root/src/commonMain/kotlin/example/todo/common/root/integration/TodoRootComponent.kt b/examples/todoapp/common/root/src/commonMain/kotlin/example/todo/common/root/integration/TodoRootComponent.kt index c3d4c6dfb8..5f467cec3f 100644 --- a/examples/todoapp/common/root/src/commonMain/kotlin/example/todo/common/root/integration/TodoRootComponent.kt +++ b/examples/todoapp/common/root/src/commonMain/kotlin/example/todo/common/root/integration/TodoRootComponent.kt @@ -5,9 +5,9 @@ import com.arkivanov.decompose.RouterState import com.arkivanov.decompose.pop import com.arkivanov.decompose.push import com.arkivanov.decompose.router -import com.arkivanov.decompose.statekeeper.Parcelable -import com.arkivanov.decompose.statekeeper.Parcelize import com.arkivanov.decompose.value.Value +import com.arkivanov.essenty.parcelable.Parcelable +import com.arkivanov.essenty.parcelable.Parcelize import com.arkivanov.mvikotlin.core.store.StoreFactory import com.badoo.reaktive.base.Consumer import example.todo.common.database.TodoSharedDatabase diff --git a/examples/todoapp/common/root/src/commonTest/kotlin/example/todo/common/root/integration/TodoRootTest.kt b/examples/todoapp/common/root/src/commonTest/kotlin/example/todo/common/root/integration/TodoRootTest.kt index 1530efb764..c5ffd60e6e 100644 --- a/examples/todoapp/common/root/src/commonTest/kotlin/example/todo/common/root/integration/TodoRootTest.kt +++ b/examples/todoapp/common/root/src/commonTest/kotlin/example/todo/common/root/integration/TodoRootTest.kt @@ -1,8 +1,8 @@ package example.todo.common.root.integration import com.arkivanov.decompose.DefaultComponentContext -import com.arkivanov.decompose.lifecycle.LifecycleRegistry -import com.arkivanov.decompose.lifecycle.resume +import com.arkivanov.essenty.lifecycle.LifecycleRegistry +import com.arkivanov.essenty.lifecycle.resume import com.badoo.reaktive.base.invoke import example.todo.common.edit.TodoEdit import example.todo.common.main.TodoMain diff --git a/examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/InstanceKeeperExt.kt b/examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/InstanceKeeperExt.kt index cac2c68262..433fba0d72 100644 --- a/examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/InstanceKeeperExt.kt +++ b/examples/todoapp/common/utils/src/commonMain/kotlin/example/todo/common/utils/InstanceKeeperExt.kt @@ -1,7 +1,7 @@ package example.todo.common.utils -import com.arkivanov.decompose.instancekeeper.InstanceKeeper -import com.arkivanov.decompose.instancekeeper.getOrCreate +import com.arkivanov.essenty.instancekeeper.InstanceKeeper +import com.arkivanov.essenty.instancekeeper.getOrCreate import com.arkivanov.mvikotlin.core.store.Store fun > InstanceKeeper.getStore(key: Any, factory: () -> T): T = diff --git a/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt b/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt index 0853039a36..08a7de3b87 100644 --- a/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt +++ b/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt @@ -1,13 +1,18 @@ package example.todo.desktop import androidx.compose.desktop.DesktopTheme -import androidx.compose.desktop.Window 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.window.Window +import androidx.compose.ui.window.application +import androidx.compose.ui.window.rememberWindowState import com.arkivanov.decompose.ComponentContext +import com.arkivanov.decompose.DefaultComponentContext +import com.arkivanov.decompose.extensions.compose.jetbrains.lifecycle.LifecycleController import com.arkivanov.decompose.extensions.compose.jetbrains.rememberRootComponent +import com.arkivanov.essenty.lifecycle.LifecycleRegistry import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory import com.badoo.reaktive.coroutinesinterop.asScheduler import com.badoo.reaktive.scheduler.overrideSchedulers @@ -21,11 +26,23 @@ import kotlinx.coroutines.Dispatchers fun main() { overrideSchedulers(main = Dispatchers.Main::asScheduler) - Window("Todo") { - Surface(modifier = Modifier.fillMaxSize()) { - MaterialTheme { - DesktopTheme { - TodoRootContent(rememberRootComponent(factory = ::todoRoot)) + val lifecycle = LifecycleRegistry() + val root = todoRoot(DefaultComponentContext(lifecycle = lifecycle)) + + application { + val windowState = rememberWindowState() + LifecycleController(lifecycle, windowState) + + Window( + onCloseRequest = ::exitApplication, + state = windowState, + title = "Todo" + ) { + Surface(modifier = Modifier.fillMaxSize()) { + MaterialTheme { + DesktopTheme { + TodoRootContent(root) + } } } } @@ -35,6 +52,6 @@ fun main() { private fun todoRoot(componentContext: ComponentContext): TodoRoot = TodoRootComponent( componentContext = componentContext, - storeFactory = DefaultStoreFactory, + storeFactory = DefaultStoreFactory(), database = DefaultTodoSharedDatabase(TodoDatabaseDriver()) ) diff --git a/examples/todoapp/web/src/jsMain/kotlin/example/todo/web/App.kt b/examples/todoapp/web/src/jsMain/kotlin/example/todo/web/App.kt index e94d469e4b..61af087e5e 100644 --- a/examples/todoapp/web/src/jsMain/kotlin/example/todo/web/App.kt +++ b/examples/todoapp/web/src/jsMain/kotlin/example/todo/web/App.kt @@ -1,8 +1,8 @@ package example.todo.web import com.arkivanov.decompose.DefaultComponentContext -import com.arkivanov.decompose.lifecycle.LifecycleRegistry -import com.arkivanov.decompose.lifecycle.resume +import com.arkivanov.essenty.lifecycle.LifecycleRegistry +import com.arkivanov.essenty.lifecycle.resume import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory import example.todo.common.database.DefaultTodoSharedDatabase import example.todo.common.database.todoDatabaseDriver @@ -21,7 +21,7 @@ fun main() { val root = TodoRootComponent( componentContext = DefaultComponentContext(lifecycle = lifecycle), - storeFactory = DefaultStoreFactory, + storeFactory = DefaultStoreFactory(), database = DefaultTodoSharedDatabase(todoDatabaseDriver()) )