diff --git a/android/build.gradle.kts b/android/build.gradle.kts index ecbed535..f1696e57 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -6,11 +6,11 @@ plugins { } android { - compileSdkVersion(31) + compileSdkVersion(Dependencies.compileSdk) defaultConfig { minSdkVersion(21) - targetSdkVersion(31) + targetSdkVersion(Dependencies.targetSdk) versionCode = 1 versionName = "1.0" @@ -28,10 +28,9 @@ android { } dependencies { - implementation(project(":common:common-root")) + implementation(project(":common:common-sample")) implementation(project(":odyssey:odyssey-compose")) implementation(project(":odyssey:odyssey-core")) - implementation(project(":common:common-compose")) implementation(compose.material) implementation(Dependencies.AndroidX.AppCompat.appCompat) diff --git a/android/src/main/java/ru/alexgladkov/odyssey_demo/MainActivity.kt b/android/src/main/java/ru/alexgladkov/odyssey_demo/MainActivity.kt index 6fef1676..6de3d62a 100644 --- a/android/src/main/java/ru/alexgladkov/odyssey_demo/MainActivity.kt +++ b/android/src/main/java/ru/alexgladkov/odyssey_demo/MainActivity.kt @@ -2,8 +2,10 @@ package ru.alexgladkov.odyssey_demo import android.os.Bundle import androidx.appcompat.app.AppCompatActivity +import ru.alexgladkov.common.compose.NavigationTree import ru.alexgladkov.common.compose.navigation.customNavScreen import ru.alexgladkov.common.compose.navigation.mainScreen +import ru.alexgladkov.common.compose.navigation.navigationGraph import ru.alexgladkov.common.compose.navigation.topNavScreen import ru.alexgladkov.common.compose.screens.ActionsScreen import ru.alexgladkov.common.compose.screens.PresentedActionsScreen @@ -16,24 +18,6 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setupThemedNavigation("actions") { - screen("actions") { - ActionsScreen(count = 0) - } - - screen("push") { - ActionsScreen(count = it as? Int) - } - - flow("present") { - screen("present_screen") { - PresentedActionsScreen(count = (it as? Int) ?: 0) - } - } - - mainScreen() - topNavScreen() - customNavScreen() - } + setupThemedNavigation(NavigationTree.Actions.name) { navigationGraph() } } } diff --git a/build.gradle.kts b/build.gradle.kts index d2c90d9a..b9b281ef 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,10 +4,6 @@ plugins { `kotlin-dsl` } -val compileSdkVersion by extra(31) -val targetSdkVersion by extra(30) -val minSdkVersion by extra(21) - allprojects { repositories { google() @@ -19,8 +15,13 @@ allprojects { } buildscript { - val kotlin_version by extra("1.5.31") + repositories { + mavenLocal() + mavenCentral() + google() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + } dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20") } } diff --git a/buildSrc/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/buildSrc/src/main/kotlin/Dependencies.kt index 8cc4e701..e655d43b 100644 --- a/buildSrc/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/buildSrc/src/main/kotlin/Dependencies.kt @@ -1,8 +1,11 @@ object Dependencies { - val odyssey = "1.0.0-beta15" + val odyssey = "1.0.0" val odysseyPackage = "io.github.alexgladkov" + val compileSdk = 33 + val targetSdk = 33 + object DI { const val kodein = "org.kodein.di:kodein-di:7.1.0" } @@ -14,7 +17,7 @@ object Dependencies { object JetBrains { object Kotlin { // __KOTLIN_COMPOSE_VERSION__ - private const val VERSION = "1.6.10" + private const val VERSION = "1.7.20" const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$VERSION" const val testCommon = "org.jetbrains.kotlin:kotlin-test-common:$VERSION" const val testJunit = "org.jetbrains.kotlin:kotlin-test-junit:$VERSION" @@ -23,10 +26,10 @@ object Dependencies { const val dateTime = "org.jetbrains.kotlinx:kotlinx-datetime:0.2.1" - const val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.1" + const val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.0" const val serializationPlugin = "org.jetbrains.kotlin:kotlin-serialization:1.5.31" - private const val coroutinesVersion = "1.6.0-native-mt" + private const val coroutinesVersion = "1.6.4" const val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion" const val coroutinesAndroid = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" const val coroutinesSwing = "org.jetbrains.kotlinx:kotlinx-coroutines-swing:$coroutinesVersion" @@ -36,21 +39,9 @@ object Dependencies { object Compose { // __LATEST_COMPOSE_RELEASE_VERSION__ - private const val VERSION = "1.1.1" + private const val VERSION = "1.2.0" const val gradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$VERSION" } - - object Ktor { - private const val ktorVersion = "1.6.2" - const val core = "io.ktor:ktor-client-core:${ktorVersion}" - const val json = "io.ktor:ktor-client-json:${ktorVersion}" - const val iOS = "io.ktor:ktor-client-ios:${ktorVersion}" - const val iOSCore = "io.ktor:ktor-client-core-native:$ktorVersion" - const val serialization = "io.ktor:ktor-client-serialization:${ktorVersion}" - const val logging = "io.ktor:ktor-client-logging:$ktorVersion" - const val android = "io.ktor:ktor-client-android:$ktorVersion" - const val okHttp = "io.ktor:ktor-client-okhttp:$ktorVersion" - } } object Android { diff --git a/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts b/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts index b7536e4b..be74b03a 100644 --- a/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts +++ b/buildSrc/src/main/kotlin/multiplatform-compose-setup.gradle.kts @@ -9,9 +9,35 @@ plugins { kotlin { jvm("desktop") android() + iosX64("uikitX64") { + binaries { + executable() { + entryPoint = "main" + freeCompilerArgs += listOf( + "-linker-option", "-framework", "-linker-option", "Metal", + "-linker-option", "-framework", "-linker-option", "CoreText", + "-linker-option", "-framework", "-linker-option", "CoreGraphics" + ) + } + } + } + iosArm64("uikitArm64") { + binaries { + executable() { + entryPoint = "main" + freeCompilerArgs += listOf( + "-linker-option", "-framework", "-linker-option", "Metal", + "-linker-option", "-framework", "-linker-option", "CoreText", + "-linker-option", "-framework", "-linker-option", "CoreGraphics" + ) + // TODO: the current compose binary surprises LLVM, so disable checks for now. + freeCompilerArgs += "-Xdisable-phases=VerifyBitcode" + } + } + } sourceSets { - named("commonMain") { + val commonMain by getting { dependencies { implementation(compose.runtime) implementation(compose.foundation) @@ -31,6 +57,16 @@ kotlin { implementation(compose.desktop.common) } } + + val uikitMain by creating { + dependsOn(commonMain) + } + val uikitX64Main by getting { + dependsOn(uikitMain) + } + val uikitArm64Main by getting { + dependsOn(uikitMain) + } } tasks.withType { diff --git a/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts b/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts index eb0243e6..ee6267ff 100644 --- a/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts +++ b/buildSrc/src/main/kotlin/multiplatform-setup.gradle.kts @@ -10,13 +10,6 @@ kotlin { jvm("desktop") android() -// val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget = when { -// System.getenv("SDK_NAME")?.startsWith("iphoneos") == true -> ::iosArm64 -// else -> ::iosX64 -// } -// -// iosTarget("ios") { } - ios() sourceSets { diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/NavigationTree.kt b/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/NavigationTree.kt deleted file mode 100644 index f65971f3..00000000 --- a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/NavigationTree.kt +++ /dev/null @@ -1,27 +0,0 @@ -package ru.alexgladkov.common.compose - -object NavigationTree { - enum class Root { - Splash, Auth, Main, Dialog - } - - enum class Auth { - Onboarding, Login, TwoFactor - } - - enum class Main { - Feed, Detail - } - - enum class Favorite { - Flow - } - - enum class Settings { - Profile - } - - enum class Tabs { - Main, Favorite, Settings - } -} \ No newline at end of file diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/navigation/NavigationGraph.kt b/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/navigation/NavigationGraph.kt deleted file mode 100644 index 9c826757..00000000 --- a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/navigation/NavigationGraph.kt +++ /dev/null @@ -1,68 +0,0 @@ -package ru.alexgladkov.common.compose.navigation - -import ru.alexgladkov.common.compose.screens.* -import ru.alexgladkov.common.compose.tabs.* -import ru.alexgladkov.odyssey.compose.extensions.* -import ru.alexgladkov.odyssey.compose.navigation.RootComposeBuilder - -fun RootComposeBuilder.mainScreen() { - bottomNavigation(name = "main", tabsNavModel = BottomConfiguration()) { - tab(FeedTab()) { - screen(name = "tab") { - TabScreen(it as? Int) - } - } - tab(SearchTab()) { - screen(name = "tab") { - TabScreen(it as? Int) - } - } - tab(CartTab()) { - screen(name = "tab") { - TabScreen(it as? Int) - } - } - } -} - -fun RootComposeBuilder.topNavScreen() { - topNavigation(name = "top", tabsNavModel = TopConfiguration()) { - tab(FeedTab()) { - screen(name = "tab") { - TabScreen(it as? Int) - } - } - tab(SearchTab()) { - screen(name = "tab") { - TabScreen(it as? Int) - } - } - tab(CartTab()) { - screen(name = "tab") { - TabScreen(it as? Int) - } - } - } -} - -fun RootComposeBuilder.customNavScreen() { - customNavigation(name = "drawer", tabsNavModel = CustomConfiguration( - content = { params -> DrawerScreen(params) } - )) { - tab(FeedTab()) { - screen(name = "tab") { - TabScreen(it as? Int) - } - } - tab(SearchTab()) { - screen(name = "tab") { - TabScreen(it as? Int) - } - } - tab(CartTab()) { - screen(name = "tab") { - TabScreen(it as? Int) - } - } - } -} diff --git a/common/common-root/build.gradle.kts b/common/common-root/build.gradle.kts deleted file mode 100644 index 7b9cdbcc..00000000 --- a/common/common-root/build.gradle.kts +++ /dev/null @@ -1,49 +0,0 @@ -import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget - -plugins { - id("multiplatform-setup") - id("kotlin-parcelize") - id("android-setup") - kotlin("plugin.serialization") -} - -kotlin { - ios { - binaries { - framework { - transitiveExport = true - baseName = "OdysseyShared" - } - } - } - - sourceSets { - named("commonMain") { - dependencies { - implementation(Dependencies.DI.kodein) - } - } - - val iosMain by getting - -// val iosX64Main by getting { dependsOn(iosMain) } -// val iosArm64Main by getting { dependsOn(iosMain) } - } -} - -fun getIosTarget(): String { - val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator" - return if (sdkName.startsWith("iphoneos")) "iosArm64" else "iosX64" -} - -val packForXcode by tasks.creating(Sync::class) { - group = "build" - val mode = System.getenv("CONFIGURATION") ?: "DEBUG" - val targetName = getIosTarget() - val framework = kotlin.targets.getByName(targetName).binaries.getFramework(mode) - inputs.property("mode", mode) - dependsOn(framework.linkTask) - val targetDir = File(buildDir, "xcode-frameworks") - from(framework.outputDirectory) - into(targetDir) -} \ No newline at end of file diff --git a/common/common-root/src/androidMain/AndroidManifest.xml b/common/common-root/src/androidMain/AndroidManifest.xml deleted file mode 100644 index 9f354042..00000000 --- a/common/common-root/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/common/common-root/src/commonMain/kotlin/ru/alexgladkov/common/root/Root.kt b/common/common-root/src/commonMain/kotlin/ru/alexgladkov/common/root/Root.kt deleted file mode 100644 index a19f79dc..00000000 --- a/common/common-root/src/commonMain/kotlin/ru/alexgladkov/common/root/Root.kt +++ /dev/null @@ -1,4 +0,0 @@ -package ru.alexgladkov.common.root - -class Root { -} \ No newline at end of file diff --git a/common/common-compose/build.gradle.kts b/common/common-sample/build.gradle.kts similarity index 100% rename from common/common-compose/build.gradle.kts rename to common/common-sample/build.gradle.kts diff --git a/common/common-compose/src/androidMain/AndroidManifest.xml b/common/common-sample/src/androidMain/AndroidManifest.xml similarity index 100% rename from common/common-compose/src/androidMain/AndroidManifest.xml rename to common/common-sample/src/androidMain/AndroidManifest.xml diff --git a/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/NavigationTree.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/NavigationTree.kt new file mode 100644 index 00000000..75bcba8c --- /dev/null +++ b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/NavigationTree.kt @@ -0,0 +1,5 @@ +package ru.alexgladkov.common.compose + +enum class NavigationTree { + Actions, Push, Present, PresentScreen, Main, Tab, Top, Drawer +} \ No newline at end of file diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/Temp.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/Temp.kt similarity index 100% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/Temp.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/Temp.kt diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/helpers/ModelsGenerator.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/helpers/ModelsGenerator.kt similarity index 100% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/helpers/ModelsGenerator.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/helpers/ModelsGenerator.kt diff --git a/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/navigation/NavigationGraph.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/navigation/NavigationGraph.kt new file mode 100644 index 00000000..105c7783 --- /dev/null +++ b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/navigation/NavigationGraph.kt @@ -0,0 +1,90 @@ +package ru.alexgladkov.common.compose.navigation + +import ru.alexgladkov.common.compose.NavigationTree +import ru.alexgladkov.common.compose.screens.* +import ru.alexgladkov.common.compose.tabs.* +import ru.alexgladkov.odyssey.compose.base.Navigator +import ru.alexgladkov.odyssey.compose.extensions.* +import ru.alexgladkov.odyssey.compose.navigation.RootComposeBuilder + +fun RootComposeBuilder.navigationGraph() { + screen(NavigationTree.Actions.name) { + ActionsScreen(count = 0) + } + + screen(NavigationTree.Push.name) { + ActionsScreen(count = it as? Int) + } + + flow(NavigationTree.Present.name) { + screen(NavigationTree.PresentScreen.name) { + PresentedActionsScreen(count = (it as? Int) ?: 0) + } + } + + mainScreen() + topNavScreen() + customNavScreen() +} + +fun RootComposeBuilder.mainScreen() { + bottomNavigation(name = NavigationTree.Main.name, tabsNavModel = BottomConfiguration()) { + tab(FeedTab()) { + screen(name = NavigationTree.Tab.name) { + TabScreen(it as? Int) + } + } + tab(SearchTab()) { + screen(name = NavigationTree.Tab.name) { + TabScreen(it as? Int) + } + } + tab(CartTab()) { + screen(name = NavigationTree.Tab.name) { + TabScreen(it as? Int) + } + } + } +} + +fun RootComposeBuilder.topNavScreen() { + topNavigation(name = NavigationTree.Top.name, tabsNavModel = TopConfiguration()) { + tab(FeedTab()) { + screen(name = NavigationTree.Tab.name) { + TabScreen(it as? Int) + } + } + tab(SearchTab()) { + screen(name = NavigationTree.Tab.name) { + TabScreen(it as? Int) + } + } + tab(CartTab()) { + screen(name = NavigationTree.Tab.name) { + TabScreen(it as? Int) + } + } + } +} + +fun RootComposeBuilder.customNavScreen() { + customNavigation(name = NavigationTree.Drawer.name, tabsNavModel = CustomConfiguration( + content = { params -> DrawerScreen(params) } + )) { + tab(FeedTab()) { + screen(name = NavigationTree.Tab.name) { + TabScreen(it as? Int) + } + } + tab(SearchTab()) { + screen(name = NavigationTree.Tab.name) { + TabScreen(it as? Int) + } + } + tab(CartTab()) { + screen(name = NavigationTree.Tab.name) { + TabScreen(it as? Int) + } + } + } +} diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/ActionsScreen.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/ActionsScreen.kt similarity index 90% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/ActionsScreen.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/ActionsScreen.kt index fe60268f..6769d2f6 100644 --- a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/ActionsScreen.kt +++ b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/ActionsScreen.kt @@ -13,6 +13,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import ru.alexgladkov.common.compose.NavigationTree import ru.alexgladkov.common.compose.theme.Odyssey import ru.alexgladkov.odyssey.compose.extensions.present import ru.alexgladkov.odyssey.compose.extensions.push @@ -35,13 +36,13 @@ fun ActionsScreen(count: Int?) { LazyColumn { item { ActionCell(text = "Push Screen", icon = Icons.Filled.ArrowForward) { - rootController.push("push", (count ?: 0) + 1) + rootController.push(NavigationTree.Push.name, (count ?: 0) + 1) } } item { ActionCell("Present Flow", icon = Icons.Filled.ArrowUpward) { - rootController.present("present") + rootController.present(NavigationTree.Present.name) } } @@ -72,7 +73,7 @@ fun ActionsScreen(count: Int?) { "Show Bottom Navigation", icon = Icons.Filled.Dashboard ) { - rootController.present("main") + rootController.present(NavigationTree.Main.name) } } @@ -81,7 +82,7 @@ fun ActionsScreen(count: Int?) { "Show Top Navigation", icon = Icons.Filled.SpaceDashboard ) { - rootController.present("top") + rootController.present(NavigationTree.Top.name) } } @@ -90,7 +91,7 @@ fun ActionsScreen(count: Int?) { "Show Drawer Navigation", icon = Icons.Filled.DashboardCustomize ) { - rootController.present("drawer", params = "Custom Title from params") + rootController.present(NavigationTree.Drawer.name, params = "Custom Title from params") } } @@ -99,7 +100,7 @@ fun ActionsScreen(count: Int?) { "Start New Chain", icon = Icons.Filled.OpenInNew ) { - rootController.present(screen = "present", launchFlag = LaunchFlag.SingleNewTask) + rootController.present(screen = NavigationTree.Present.name, launchFlag = LaunchFlag.SingleNewTask) } } diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/AlertDialogScreen.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/AlertDialogScreen.kt similarity index 100% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/AlertDialogScreen.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/AlertDialogScreen.kt diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/DrawerScreen.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/DrawerScreen.kt similarity index 100% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/DrawerScreen.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/DrawerScreen.kt diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/ModalSheetScreen.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/ModalSheetScreen.kt similarity index 100% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/ModalSheetScreen.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/ModalSheetScreen.kt diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/PresentedActionsScreen.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/PresentedActionsScreen.kt similarity index 92% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/PresentedActionsScreen.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/PresentedActionsScreen.kt index 5c9f1b69..2653cae5 100644 --- a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/PresentedActionsScreen.kt +++ b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/PresentedActionsScreen.kt @@ -9,6 +9,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import ru.alexgladkov.common.compose.NavigationTree import ru.alexgladkov.common.compose.theme.Odyssey import ru.alexgladkov.odyssey.compose.extensions.present import ru.alexgladkov.odyssey.compose.extensions.push @@ -31,13 +32,13 @@ fun PresentedActionsScreen(count: Int?) { LazyColumn { item { ActionCell(text = "Push Screen", icon = Icons.Filled.ArrowForward) { - rootController.push("present_screen", (count ?: 0) + 1) + rootController.push(NavigationTree.PresentScreen.name, (count ?: 0) + 1) } } item { ActionCell("Present Flow", icon = Icons.Filled.ArrowUpward) { - rootController.findRootController().present("present") + rootController.findRootController().present(NavigationTree.Present.name) } } @@ -68,7 +69,7 @@ fun PresentedActionsScreen(count: Int?) { "Show Bottom Navigation", icon = Icons.Filled.Dashboard ) { - rootController.findRootController().present("main") + rootController.findRootController().present(NavigationTree.Main.name) } } @@ -77,7 +78,7 @@ fun PresentedActionsScreen(count: Int?) { "Start New Chain", icon = Icons.Filled.OpenInNew ) { - rootController.findRootController().present(screen = "present", launchFlag = LaunchFlag.SingleNewTask) + rootController.findRootController().present(screen = NavigationTree.Present.name, launchFlag = LaunchFlag.SingleNewTask) } } diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/TabScreen.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/TabScreen.kt similarity index 89% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/TabScreen.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/TabScreen.kt index 2e85f289..34404856 100644 --- a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/TabScreen.kt +++ b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/screens/TabScreen.kt @@ -10,6 +10,7 @@ import androidx.compose.material.icons.filled.ArrowForward import androidx.compose.material.icons.filled.ArrowUpward import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import ru.alexgladkov.common.compose.NavigationTree import ru.alexgladkov.common.compose.theme.Odyssey import ru.alexgladkov.odyssey.compose.extensions.present import ru.alexgladkov.odyssey.compose.extensions.push @@ -28,13 +29,13 @@ fun TabScreen(count: Int?) { LazyColumn { item { ActionCell(text = "Push Screen", icon = Icons.Filled.ArrowForward) { - rootController.push("tab", (count ?: 0) + 1) + rootController.push(NavigationTree.Tab.name, (count ?: 0) + 1) } } item { ActionCell("Present Flow", icon = Icons.Filled.ArrowUpward) { - rootController.findRootController().present("present") + rootController.findRootController().present(NavigationTree.Present.name) } } } diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/BottomConfiguration.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/BottomConfiguration.kt similarity index 80% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/BottomConfiguration.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/BottomConfiguration.kt index a844bbaa..e39375bc 100644 --- a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/BottomConfiguration.kt +++ b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/BottomConfiguration.kt @@ -41,15 +41,3 @@ class CustomConfiguration(private val content: @Composable (params: Any?) -> Uni ) } } - -fun RootComposeBuilder.customNavigation( - name: String, - tabsNavModel: TabsNavModel, - builder: MultiStackBuilder.() -> Unit -) { - addMultiStack( - key = name, - tabsNavModel = tabsNavModel, - multiStackBuilderModel = MultiStackBuilder(name).apply(builder).build() - ) -} \ No newline at end of file diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/CartTab.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/CartTab.kt similarity index 100% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/CartTab.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/CartTab.kt diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/FeedTab.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/FeedTab.kt similarity index 100% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/FeedTab.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/FeedTab.kt diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/SearchTab.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/SearchTab.kt similarity index 100% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/SearchTab.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/tabs/SearchTab.kt diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/OdysseyTheme.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/OdysseyTheme.kt similarity index 100% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/OdysseyTheme.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/OdysseyTheme.kt diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/colors/OdysseyColors.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/colors/OdysseyColors.kt similarity index 100% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/colors/OdysseyColors.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/colors/OdysseyColors.kt diff --git a/common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/colors/Palettes.kt b/common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/colors/Palettes.kt similarity index 100% rename from common/common-compose/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/colors/Palettes.kt rename to common/common-sample/src/commonMain/kotlin/ru/alexgladkov/common/compose/theme/colors/Palettes.kt diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts index 49700f14..e7cf45fd 100644 --- a/desktop/build.gradle.kts +++ b/desktop/build.gradle.kts @@ -13,7 +13,7 @@ kotlin { sourceSets { named("commonMain") { dependencies { - implementation(project(":common:common-compose")) + implementation(project(":common:common-sample")) implementation(project(":odyssey:odyssey-core")) implementation(project(":odyssey:odyssey-compose")) } @@ -22,10 +22,6 @@ kotlin { named("jvmMain") { dependencies { implementation(compose.desktop.currentOs) - implementation(project(":common:common-root")) - implementation(project(":common:common-compose")) - - implementation(Dependencies.JetBrains.Ktor.okHttp) } } @@ -39,7 +35,7 @@ kotlin { compose.desktop { application { - mainClass = "ru.alexgladkov.odyssey-demo.MainKt" + mainClass = "ru.alexgladkov.odyssey-demo.Main_DesktopKt" nativeDistributions { targetFormats( diff --git a/desktop/src/jvmMain/kotlin/ru/alexgladkov/odyssey-demo/extensions/JFrame + Setup.kt b/desktop/src/jvmMain/kotlin/ru/alexgladkov/odyssey-demo/extensions/JFrame + Setup.kt index 33205f25..62448880 100644 --- a/desktop/src/jvmMain/kotlin/ru/alexgladkov/odyssey-demo/extensions/JFrame + Setup.kt +++ b/desktop/src/jvmMain/kotlin/ru/alexgladkov/odyssey-demo/extensions/JFrame + Setup.kt @@ -25,8 +25,8 @@ fun JFrame.setupThemedNavigation( // by adding CompositionLocalProviders or something else composePanel.setContent { OdysseyTheme { - val rootController = RootComposeBuilder(backgroundColor = Odyssey.color.primaryBackground) - .apply(navigationGraph).build() + val rootController = RootComposeBuilder().apply(navigationGraph).build() + rootController.backgroundColor = Odyssey.color.primaryBackground CompositionLocalProvider( *providers, diff --git a/desktop/src/jvmMain/kotlin/ru/alexgladkov/odyssey-demo/main.desktop.kt b/desktop/src/jvmMain/kotlin/ru/alexgladkov/odyssey-demo/main.desktop.kt new file mode 100644 index 00000000..7c831889 --- /dev/null +++ b/desktop/src/jvmMain/kotlin/ru/alexgladkov/odyssey-demo/main.desktop.kt @@ -0,0 +1,15 @@ +package ru.alexgladkov.`odyssey-demo` + +import ru.alexgladkov.`odyssey-demo`.extensions.setupThemedNavigation +import ru.alexgladkov.common.compose.NavigationTree +import ru.alexgladkov.common.compose.navigation.navigationGraph +import javax.swing.JFrame +import javax.swing.SwingUtilities + +fun main() = SwingUtilities.invokeLater { + val window = JFrame() + window.title = "Odyssey Demo" + window.setSize(800, 600) + + window.setupThemedNavigation(NavigationTree.Actions.name) { navigationGraph() } +} \ No newline at end of file diff --git a/desktop/src/jvmMain/kotlin/ru/alexgladkov/odyssey-demo/main.kt b/desktop/src/jvmMain/kotlin/ru/alexgladkov/odyssey-demo/main.kt deleted file mode 100644 index 9087c6f5..00000000 --- a/desktop/src/jvmMain/kotlin/ru/alexgladkov/odyssey-demo/main.kt +++ /dev/null @@ -1,38 +0,0 @@ -package ru.alexgladkov.`odyssey-demo` - -import ru.alexgladkov.`odyssey-demo`.extensions.setupThemedNavigation -import ru.alexgladkov.common.compose.navigation.customNavScreen -import ru.alexgladkov.common.compose.navigation.mainScreen -import ru.alexgladkov.common.compose.navigation.topNavScreen -import ru.alexgladkov.common.compose.screens.ActionsScreen -import ru.alexgladkov.common.compose.screens.PresentedActionsScreen -import ru.alexgladkov.odyssey.compose.extensions.flow -import ru.alexgladkov.odyssey.compose.extensions.screen -import javax.swing.JFrame -import javax.swing.SwingUtilities - -fun main() = SwingUtilities.invokeLater { - val window = JFrame() - window.title = "Odyssey Demo" - window.setSize(800, 600) - - window.setupThemedNavigation("actions") { - screen("actions") { - ActionsScreen(count = 0) - } - - screen("push") { - ActionsScreen(count = it as? Int) - } - - flow("present") { - screen("present_screen") { - PresentedActionsScreen(count = (it as? Int) ?: 0) - } - } - - mainScreen() - topNavScreen() - customNavScreen() - } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 2f8f9fbf..2d37e36d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,4 +22,6 @@ kotlin.code.style=official org.gradle.parallel=false org.gradle.caching=true kotlin.mpp.enableGranularSourceSetsMetadata = true -kotlin.native.disableCompilerDaemon=true \ No newline at end of file +kotlin.native.disableCompilerDaemon=true +org.jetbrains.compose.experimental.macos.enabled=true +org.jetbrains.compose.experimental.uikit.enabled=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c053..7454180f 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0f80bbf5..ffed3a25 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index fbd7c515..1b6c7873 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 5093609d..ac1b06f9 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,104 +1,89 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/RootController.kt b/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/RootController.kt index 71fe6b0c..aeb774cd 100644 --- a/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/RootController.kt +++ b/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/RootController.kt @@ -48,8 +48,8 @@ open class RootController( ) { private val _allowedDestinations: MutableList = mutableListOf() private val _backstack = mutableListOf() - private val _currentScreen: MutableStateFlow = - MutableStateFlow(Screen().wrap()) + private val _currentScreen: MutableStateFlow = + MutableStateFlow(null) private var _childrenRootController: MutableList = mutableListOf() private val _screenMap = mutableMapOf>() private var _onBackPressedDispatcher: OnBackPressedDispatcher? = null @@ -62,7 +62,7 @@ open class RootController( var onScreenRemove: (ScreenBundle) -> Unit = { parentRootController?.onScreenRemove?.invoke(it) } - var currentScreen: StateFlow = _currentScreen.asStateFlow() + var currentScreen: StateFlow = _currentScreen.asStateFlow() /** * Debug name need to debug :) if you like console debugging @@ -113,7 +113,6 @@ open class RootController( _onBackPressedDispatcher = onBackPressedDispatcher _onBackPressedDispatcher?.backPressedCallback = object : BackPressedCallback() { override fun onBackPressed() { - println("DEBUG: On Back Pressed") popBackStack() } } @@ -338,7 +337,6 @@ open class RootController( } private fun removeTopScreen(rootController: RootController?) { - println("RC ${rootController?.debugName}") rootController?.let { val isLastScreen = it._backstack.size <= 1 if (isLastScreen) { @@ -378,6 +376,7 @@ open class RootController( when (launchFlag) { LaunchFlag.SingleNewTask -> _backstack.clear() + null -> {} } _backstack.add(screen) @@ -396,6 +395,7 @@ open class RootController( when (launchFlag) { LaunchFlag.SingleNewTask -> _backstack.clear() + null -> {} } val rootController = RootController(RootControllerType.Flow) @@ -446,6 +446,7 @@ open class RootController( when (launchFlag) { LaunchFlag.SingleNewTask -> _backstack.clear() + null -> {} } val parentRootController = this diff --git a/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/base/BottomBarNavigator.kt b/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/base/BottomBarNavigator.kt index fd960a12..a06c3e62 100644 --- a/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/base/BottomBarNavigator.kt +++ b/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/base/BottomBarNavigator.kt @@ -26,7 +26,7 @@ fun TabNavigator( CompositionLocalProvider( LocalRootController provides currentTab.rootController ) { - configuration.value.let { navConfig -> + configuration.value?.let { navConfig -> AnimatedHost( currentScreen = navConfig.screen.toScreenBundle(), animationType = navConfig.screen.animationType, diff --git a/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/base/Navigator.kt b/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/base/Navigator.kt index 2ad31f46..7feadd6f 100644 --- a/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/base/Navigator.kt +++ b/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/base/Navigator.kt @@ -21,7 +21,7 @@ fun Navigator( val backgroundColor = rootController.backgroundColor val navConfiguration = rootController.currentScreen.collectAsState() - navConfiguration.value.let { config -> + navConfiguration.value?.let { config -> NavigatorAnimated(config.screen, config, rootController, backgroundColor) } diff --git a/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/extensions/RootComposeBuilder + DSL.kt b/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/extensions/RootComposeBuilder + DSL.kt index 84b8f677..0d5f62e2 100644 --- a/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/extensions/RootComposeBuilder + DSL.kt +++ b/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/extensions/RootComposeBuilder + DSL.kt @@ -81,6 +81,24 @@ fun RootComposeBuilder.topNavigation( ) } +/** + * Adds custom bar navigation to navigation graph + * @param name - name in graph + * @param tabsNavModel - UI configuration for custom navigation + * @param builder - dsl for custom nav bar building + */ +fun RootComposeBuilder.customNavigation( + name: String, + tabsNavModel: TabsNavModel, + builder: MultiStackBuilder.() -> Unit +) { + addMultiStack( + key = name, + tabsNavModel = tabsNavModel, + multiStackBuilderModel = MultiStackBuilder(name).apply(builder).build() + ) +} + /** * Adds tab to bottom nav bar building * @param tabItem - tab UI configuration diff --git a/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/navigation/modal_navigation/views/BottomSheetModalView.kt b/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/navigation/modal_navigation/views/BottomSheetModalView.kt index 000d68ff..085b9718 100644 --- a/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/navigation/modal_navigation/views/BottomSheetModalView.kt +++ b/odyssey/odyssey-compose/src/commonMain/kotlin/ru/alexgladkov/odyssey/compose/navigation/modal_navigation/views/BottomSheetModalView.kt @@ -55,6 +55,7 @@ internal fun BoxScope.BottomModalSheet( when (bundle.dialogState) { ModalDialogState.Idle -> modalController.setTopDialogState(ModalDialogState.Open, bundle.key) is ModalDialogState.Close -> modalController.finishCloseAction(bundle.key) + ModalDialogState.Open -> {} } } ) diff --git a/odyssey/odyssey-compose/src/desktopMain/kotlin/ru/alexgladkov/odyssey/compose/DesktopScreenHost.kt b/odyssey/odyssey-compose/src/desktopMain/kotlin/ru/alexgladkov/odyssey/compose/DesktopScreenHost.kt deleted file mode 100644 index 4955d1b8..00000000 --- a/odyssey/odyssey-compose/src/desktopMain/kotlin/ru/alexgladkov/odyssey/compose/DesktopScreenHost.kt +++ /dev/null @@ -1,35 +0,0 @@ -package ru.alexgladkov.odyssey.compose - -import androidx.compose.ui.awt.ComposePanel -import ru.alexgladkov.odyssey.compose.extensions.observeAsState -import ru.alexgladkov.odyssey.core.extensions.wrap -import java.awt.BorderLayout -import javax.swing.JFrame -import javax.swing.WindowConstants - -/** - * Class provider to set canvas to draw navigation - * @param window - root window of main function in Swing Application - */ -//class DesktopScreenHost constructor( -// private val window: JFrame, -//) : ComposableScreenHost() { -// -// override fun prepareFowDrawing() { -// val composePanel = ComposePanel() -// -// // Below function setup drawing, you can extend it -// // by adding CompositionLocalProviders or something else -// composePanel.setContent { -// val destinationState = destinationObserver.wrap().observeAsState() -// destinationState.value?.let { -// launchScreen(it) -// } -// } -// -// window.defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE -// window.contentPane.add(composePanel, BorderLayout.CENTER) -// window.setLocationRelativeTo(null) -// window.isVisible = true -// } -//} \ No newline at end of file diff --git a/odyssey/odyssey-compose/src/uikitMain/kotlin/ru/alexgladkov/odyssey/compose/extensions/RandomKey.kt b/odyssey/odyssey-compose/src/uikitMain/kotlin/ru/alexgladkov/odyssey/compose/extensions/RandomKey.kt new file mode 100644 index 00000000..0d764a7b --- /dev/null +++ b/odyssey/odyssey-compose/src/uikitMain/kotlin/ru/alexgladkov/odyssey/compose/extensions/RandomKey.kt @@ -0,0 +1,5 @@ +package ru.alexgladkov.odyssey.compose.extensions + +import platform.Foundation.NSUUID + +actual fun createUniqueKey(key: String): String = "$key${NSUUID.UUID().UUIDString}" \ No newline at end of file diff --git a/odyssey/odyssey-compose/src/uikitMain/kotlin/ru/alexgladkov/odyssey/compose/helpers/WindowSize.kt b/odyssey/odyssey-compose/src/uikitMain/kotlin/ru/alexgladkov/odyssey/compose/helpers/WindowSize.kt new file mode 100644 index 00000000..e6d6325e --- /dev/null +++ b/odyssey/odyssey-compose/src/uikitMain/kotlin/ru/alexgladkov/odyssey/compose/helpers/WindowSize.kt @@ -0,0 +1,11 @@ +package ru.alexgladkov.odyssey.compose.helpers + +import androidx.compose.runtime.Composable +import androidx.compose.ui.platform.LocalDensity +import platform.UIKit.UIScreen + +@Composable +actual fun extractWindowHeight(): Int { + val density = LocalDensity.current + return with(density) { UIScreen.mainScreen.bounds.size } +} \ No newline at end of file diff --git a/odyssey/odyssey-core/build.gradle.kts b/odyssey/odyssey-core/build.gradle.kts index 44b3526e..5845f182 100644 --- a/odyssey/odyssey-core/build.gradle.kts +++ b/odyssey/odyssey-core/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.compose.compose plugins { - id("multiplatform-setup") + id("multiplatform-compose-setup") id("android-setup") id("maven-publish") id("convention.publication") diff --git a/run-uikit.sh b/run-uikit.sh new file mode 100755 index 00000000..c1ee1afa --- /dev/null +++ b/run-uikit.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cd "$(dirname "$0")" +#./gradlew uikit:linkDebugExecutableUikitX64 -i +./gradlew uikit:iosDeployIPhone13Debug -i \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 8795bf6b..b9a02b8b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,13 +1,12 @@ include( - ":common:common-root", - - ":common:common-compose", + ":common:common-sample", ":odyssey:odyssey-core", ":odyssey:odyssey-compose", ":android", - ":desktop" + ":desktop", + ":uikit" ) //includeBuild("convention-plugins") diff --git a/uikit/build.gradle.kts b/uikit/build.gradle.kts new file mode 100644 index 00000000..32330c10 --- /dev/null +++ b/uikit/build.gradle.kts @@ -0,0 +1,92 @@ +import org.gradle.internal.impldep.org.codehaus.plexus.util.Os +import org.jetbrains.compose.compose +import org.jetbrains.compose.desktop.application.dsl.TargetFormat +import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension +import org.jetbrains.compose.experimental.dsl.IOSDevices + + +plugins { + kotlin("multiplatform")// version "1.6.21" + id("org.jetbrains.compose")// version "1.2.0-alpha01-dev686" +} + +kotlin { + iosX64("uikitX64") { + binaries { + executable() { + entryPoint = "main" + freeCompilerArgs += listOf( + "-linker-option", "-framework", "-linker-option", "Metal", + "-linker-option", "-framework", "-linker-option", "CoreText", + "-linker-option", "-framework", "-linker-option", "CoreGraphics" + ) + } + } + } + iosArm64("uikitArm64") { + binaries { + executable() { + entryPoint = "main" + freeCompilerArgs += listOf( + "-linker-option", "-framework", "-linker-option", "Metal", + "-linker-option", "-framework", "-linker-option", "CoreText", + "-linker-option", "-framework", "-linker-option", "CoreGraphics" + ) + // TODO: the current compose binary surprises LLVM, so disable checks for now. + freeCompilerArgs += "-Xdisable-phases=VerifyBitcode" + } + } + } + + sourceSets { + val commonMain by getting { + dependencies { + implementation(project(":common:common-sample")) + implementation(project(":odyssey:odyssey-compose")) + implementation(project(":odyssey:odyssey-core")) + implementation(compose.ui) + implementation(compose.foundation) + implementation(compose.material) + implementation(compose.runtime) + } + } + + val uikitMain by creating { + dependsOn(commonMain) + } + val uikitX64Main by getting { + dependsOn(uikitMain) + } + val uikitArm64Main by getting { + dependsOn(uikitMain) + } + } +} + +compose.experimental { + uikit.application { + bundleIdPrefix = "ru.alexgladkov" + projectName = "OdysseyiOS" + deployConfigurations { + // Usage ./gradlew uikit:iosDeployIPhone13Debug + simulator("IPhone13") { + device = IOSDevices.IPHONE_13_PRO + } + } + } +} + +tasks.withType { + kotlinOptions.jvmTarget = "11" +} + +kotlin { + targets.withType { + binaries.all { + // TODO: the current compose binary surprises LLVM, so disable checks for now. + freeCompilerArgs += "-Xdisable-phases=VerifyBitcode" + } + } +} \ No newline at end of file diff --git a/uikit/src/commonMain/kotlin/UikitApplication.kt b/uikit/src/commonMain/kotlin/UikitApplication.kt new file mode 100644 index 00000000..42604cfa --- /dev/null +++ b/uikit/src/commonMain/kotlin/UikitApplication.kt @@ -0,0 +1,10 @@ +import androidx.compose.material.Text +import androidx.compose.runtime.Composable + +class UikitApplication { + + @Composable + fun hello() { + Text("Hello") + } +} \ No newline at end of file diff --git a/uikit/src/uikitMain/kotlin/main.uikit.kt b/uikit/src/uikitMain/kotlin/main.uikit.kt new file mode 100644 index 00000000..780f1fc0 --- /dev/null +++ b/uikit/src/uikitMain/kotlin/main.uikit.kt @@ -0,0 +1,73 @@ +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.height +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import androidx.compose.ui.window.Application +import kotlinx.cinterop.* +import platform.Foundation.NSStringFromClass +import platform.UIKit.* +import ru.alexgladkov.common.compose.NavigationTree +import ru.alexgladkov.common.compose.navigation.navigationGraph +import ru.alexgladkov.common.compose.theme.Odyssey +import ru.alexgladkov.common.compose.theme.OdysseyTheme +import ru.alexgladkov.odyssey.compose.base.Navigator +import ru.alexgladkov.odyssey.compose.local.LocalRootController +import ru.alexgladkov.odyssey.compose.navigation.RootComposeBuilder +import ru.alexgladkov.odyssey.compose.navigation.modal_navigation.ModalNavigator + +fun main() { + val args = emptyArray() + memScoped { + val argc = args.size + 1 + val argv = (arrayOf("skikoApp") + args).map { it.cstr.ptr }.toCValues() + autoreleasepool { + UIApplicationMain(argc, argv, null, NSStringFromClass(SkikoAppDelegate)) + } + } +} + +class SkikoAppDelegate : UIResponder, UIApplicationDelegateProtocol { + companion object : UIResponderMeta(), UIApplicationDelegateProtocolMeta + + @ObjCObjectBase.OverrideInit + constructor() : super() + + private var _window: UIWindow? = null + override fun window() = _window + override fun setWindow(window: UIWindow?) { + _window = window + } + + override fun application( + application: UIApplication, + didFinishLaunchingWithOptions: Map? + ): Boolean { + window = UIWindow(frame = UIScreen.mainScreen.bounds) + window!!.rootViewController = Application("Odyssey Demo") { + OdysseyTheme { + Column(modifier = Modifier.background(Odyssey.color.primaryBackground)) { + // To skip upper part of screen. + Box( + modifier = Modifier.height(56.dp) + ) + + val rootController = RootComposeBuilder().apply { navigationGraph() }.build() + rootController.backgroundColor = Odyssey.color.primaryBackground + + CompositionLocalProvider( + LocalRootController provides rootController + ) { + ModalNavigator { + Navigator(NavigationTree.Actions.name) + } + } + } + } + } + window!!.makeKeyAndVisible() + return true + } +}