From d56272062867060c776ae49614da71d1ef667a34 Mon Sep 17 00:00:00 2001 From: Dr Watson <> Date: Wed, 14 May 2025 14:42:13 +0300 Subject: [PATCH 01/10] demo app for settings opener example --- .../src/androidMain/kotlin/PlatformDI.kt | 3 + composeApp/src/commonMain/kotlin/DI.kt | 2 + .../kotlin/coordinator/AppCoordinator.kt | 1 + composeApp/src/commonMain/kotlin/ui/Route.kt | 1 + .../src/commonMain/kotlin/ui/app/App.kt | 2 + .../commonMain/kotlin/ui/home/HomeScreen.kt | 4 ++ .../kotlin/ui/home/HomeViewInteractor.kt | 4 ++ .../SettingsOpenerExampleScreen.kt | 58 +++++++++++++++++++ .../SettingsOpenerExampleViewInteractor.kt | 49 ++++++++++++++++ .../src/desktopMain/kotlin/PlatformDI.kt | 3 + composeApp/src/iosMain/kotlin/PlatformDI.kt | 4 +- .../src/wasmJsMain/kotlin/PlatformDI.kt | 3 + 12 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt create mode 100644 composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt diff --git a/composeApp/src/androidMain/kotlin/PlatformDI.kt b/composeApp/src/androidMain/kotlin/PlatformDI.kt index 8c4913d..6216c0d 100644 --- a/composeApp/src/androidMain/kotlin/PlatformDI.kt +++ b/composeApp/src/androidMain/kotlin/PlatformDI.kt @@ -1,6 +1,9 @@ import com.outsidesource.oskitkmp.storage.KmpKvStore +import com.outsidesource.oskitkmp.systemui.KmpSettingsScreen +import org.koin.dsl.bind import org.koin.dsl.module actual fun platformModule() = module { single { KmpKvStore(appContext = get()) } + single { KmpSettingsScreen(context = get()) } bind KmpSettingsScreen::class } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/DI.kt b/composeApp/src/commonMain/kotlin/DI.kt index 9e91dbc..d95c6c3 100644 --- a/composeApp/src/commonMain/kotlin/DI.kt +++ b/composeApp/src/commonMain/kotlin/DI.kt @@ -14,6 +14,7 @@ import ui.home.HomeViewInteractor import ui.iosServices.IOSServicesScreenViewInteractor import ui.popups.PopupsScreenViewInteractor import ui.viewStateExample.ViewStateExampleViewInteractor +import ui.settingsOpenerExample.SettingsOpenerExampleViewInteractor val composeAppModule = module { single { AppCoordinator() } @@ -34,4 +35,5 @@ val composeAppModule = module { factory { PopupsScreenViewInteractor() } factory { IOSServicesScreenViewInteractor(get(), get()) } factory { CapabilityScreenViewInteractor(get()) } + factory { SettingsOpenerExampleViewInteractor(get(), get()) } } + platformModule() \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/coordinator/AppCoordinator.kt b/composeApp/src/commonMain/kotlin/coordinator/AppCoordinator.kt index 25a48b4..e1fcff1 100644 --- a/composeApp/src/commonMain/kotlin/coordinator/AppCoordinator.kt +++ b/composeApp/src/commonMain/kotlin/coordinator/AppCoordinator.kt @@ -38,4 +38,5 @@ class AppCoordinator(): Coordinator( fun iosServicesClicked() = push(Route.IOSServices) fun widgetsClicked() = push(Route.Widgets) fun capabilityClicked() = push(Route.Capability) + fun settingsOpenerExampleClicked() = push(Route.SettingsOpenerExample) } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ui/Route.kt b/composeApp/src/commonMain/kotlin/ui/Route.kt index 20eea44..3ca1f65 100644 --- a/composeApp/src/commonMain/kotlin/ui/Route.kt +++ b/composeApp/src/commonMain/kotlin/ui/Route.kt @@ -19,6 +19,7 @@ sealed class Route( data object IOSServices: Route(webRoutePath = "/ios-services") data object Widgets: Route(webRoutePath = "/widgets") data object Capability : Route(webRoutePath = "/capability") + data object SettingsOpenerExample: Route(webRoutePath = "/settingsopener") companion object { val deepLinks = Router.buildDeepLinks { diff --git a/composeApp/src/commonMain/kotlin/ui/app/App.kt b/composeApp/src/commonMain/kotlin/ui/app/App.kt index e4e571f..df341fb 100644 --- a/composeApp/src/commonMain/kotlin/ui/app/App.kt +++ b/composeApp/src/commonMain/kotlin/ui/app/App.kt @@ -22,6 +22,7 @@ import ui.markdown.MarkdownScreen import ui.popups.PopupsScreen import ui.viewStateExample.ViewStateExampleScreen import ui.widgets.WidgetsScreen +import ui.settingsOpenerExample.SettingsOpenerExampleScreen @Composable fun App( @@ -50,6 +51,7 @@ fun App( is Route.IOSServices -> IOSServicesScreen() is Route.Widgets -> WidgetsScreen() is Route.Capability -> CapabilityScreen() + is Route.SettingsOpenerExample -> SettingsOpenerExampleScreen() } } } diff --git a/composeApp/src/commonMain/kotlin/ui/home/HomeScreen.kt b/composeApp/src/commonMain/kotlin/ui/home/HomeScreen.kt index 7b97027..345c38e 100644 --- a/composeApp/src/commonMain/kotlin/ui/home/HomeScreen.kt +++ b/composeApp/src/commonMain/kotlin/ui/home/HomeScreen.kt @@ -81,6 +81,10 @@ fun HomeScreen( content = { Text("Capability") }, onClick = interactor::capabilityButtonClicked, ) + Button( + content = { Text("App & System Settings Opener") }, + onClick = interactor::settingsOpenerExampleButtonClicked, + ) } } } diff --git a/composeApp/src/commonMain/kotlin/ui/home/HomeViewInteractor.kt b/composeApp/src/commonMain/kotlin/ui/home/HomeViewInteractor.kt index 7bab771..8f1ef89 100644 --- a/composeApp/src/commonMain/kotlin/ui/home/HomeViewInteractor.kt +++ b/composeApp/src/commonMain/kotlin/ui/home/HomeViewInteractor.kt @@ -42,4 +42,8 @@ class HomeViewInteractor( fun capabilityButtonClicked() { coordinator.capabilityClicked() } + + fun settingsOpenerExampleButtonClicked() { + coordinator.settingsOpenerExampleClicked() + } } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt new file mode 100644 index 0000000..aaa38dd --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt @@ -0,0 +1,58 @@ +package ui.settingsOpenerExample + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Button +import androidx.compose.material.Text +import androidx.compose.material.TextField +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import ui.common.Screen +import com.outsidesource.oskitcompose.interactor.collectAsState +import com.outsidesource.oskitcompose.lib.rememberInjectForRoute +import ui.viewStateExample.ViewStateExampleViewInteractor + +@Composable +fun SettingsOpenerExampleScreen( + interactor: SettingsOpenerExampleViewInteractor = rememberInjectForRoute() +) { + val state = interactor.collectAsState() + + Screen("Settings Opener Example") { + Column( + modifier = Modifier.fillMaxSize(), + verticalArrangement = Arrangement.spacedBy(8.dp, Alignment.CenterVertically), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + + Button( + content = { Text("Open App Settings") }, + onClick = interactor::appSettingsClicked + ) + + Button( + content = { Text("Open System Settings") }, + onClick = interactor::systemSettingsClicked + ) + + Button( + content = { Text("Open Bluetooth Settings") }, + onClick = interactor::bluetoothSettingsClicked + ) + + Button( + content = { Text("Open Location Settings") }, + onClick = interactor::locationSettingsClicked + ) + + Button( + content = { Text("Pop To Home") }, + onClick = interactor::popToHome + ) + } + } +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt new file mode 100644 index 0000000..5ccc4b6 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt @@ -0,0 +1,49 @@ +package ui.settingsOpenerExample + +import coordinator.AppCoordinator +import com.outsidesource.oskitkmp.interactor.Interactor +import com.outsidesource.oskitkmp.systemui.KmpSettingsScreen +import com.outsidesource.oskitkmp.systemui.SettingsScreenType +import kotlinx.coroutines.launch + +data class SettingsOpenerExampleViewState( + val text: Boolean = true +) + +class SettingsOpenerExampleViewInteractor( + private val coordinator: AppCoordinator, + private val screenOpener: KmpSettingsScreen +): Interactor( + initialState = SettingsOpenerExampleViewState() +) { + + override fun computed(state: SettingsOpenerExampleViewState): SettingsOpenerExampleViewState { + return state + } + + fun popToHome() = coordinator.popToHome() + + fun appSettingsClicked() { + interactorScope.launch { + screenOpener.open(SettingsScreenType.App) + } + } + + fun systemSettingsClicked() { + interactorScope.launch { + screenOpener.open(SettingsScreenType.SystemSettings) + } + } + + fun bluetoothSettingsClicked() { + interactorScope.launch { + screenOpener.open(SettingsScreenType.Bluetooth) + } + } + + fun locationSettingsClicked() { + interactorScope.launch { + screenOpener.open(SettingsScreenType.Location) + } + } +} \ No newline at end of file diff --git a/composeApp/src/desktopMain/kotlin/PlatformDI.kt b/composeApp/src/desktopMain/kotlin/PlatformDI.kt index fb4994e..57320d3 100644 --- a/composeApp/src/desktopMain/kotlin/PlatformDI.kt +++ b/composeApp/src/desktopMain/kotlin/PlatformDI.kt @@ -1,7 +1,10 @@ import com.outsidesource.oskitkmp.storage.KmpKvStore +import com.outsidesource.oskitkmp.systemui.KmpSettingsScreen +import org.koin.dsl.bind import org.koin.dsl.module actual fun platformModule() = module { single { KmpKvStore(appName = "OSKit-Example-App") } + single { KmpSettingsScreen() } bind KmpSettingsScreen::class } \ No newline at end of file diff --git a/composeApp/src/iosMain/kotlin/PlatformDI.kt b/composeApp/src/iosMain/kotlin/PlatformDI.kt index 07dee66..d43c4f6 100644 --- a/composeApp/src/iosMain/kotlin/PlatformDI.kt +++ b/composeApp/src/iosMain/kotlin/PlatformDI.kt @@ -3,8 +3,9 @@ import com.outsidesource.oskitExample.common.initKoin import com.outsidesource.oskitExample.common.service.IOSS3Service import com.outsidesource.oskitExample.common.service.s3.IS3Service import com.outsidesource.oskitExample.common.service.swift.ISwiftExampleService -import com.outsidesource.oskitkmp.storage.KmpKvStore import org.koin.dsl.bind +import com.outsidesource.oskitkmp.storage.KmpKvStore +import com.outsidesource.oskitkmp.systemui.KmpSettingsScreen import org.koin.dsl.module private val koin = initKoin( @@ -15,6 +16,7 @@ private val koin = initKoin( actual fun platformModule() = module { single { IOSS3Service() } bind IS3Service::class single { KmpKvStore() } + single { KmpSettingsScreen() } bind KmpSettingsScreen::class } fun loadKoinSwiftModules(swiftExampleService: ISwiftExampleService) { diff --git a/composeApp/src/wasmJsMain/kotlin/PlatformDI.kt b/composeApp/src/wasmJsMain/kotlin/PlatformDI.kt index bf9497b..0110a7b 100644 --- a/composeApp/src/wasmJsMain/kotlin/PlatformDI.kt +++ b/composeApp/src/wasmJsMain/kotlin/PlatformDI.kt @@ -1,7 +1,10 @@ import com.outsidesource.oskitkmp.storage.KmpKvStore import com.outsidesource.oskitkmp.storage.WasmKmpKvStoreType +import com.outsidesource.oskitkmp.systemui.KmpSettingsScreen +import org.koin.dsl.bind import org.koin.dsl.module actual fun platformModule() = module { single { KmpKvStore(type = WasmKmpKvStoreType.LocalStorage) } + single { KmpSettingsScreen() } bind KmpSettingsScreen::class } \ No newline at end of file From 0e83992bc6c250829223d618fb09d6f423eb19e2 Mon Sep 17 00:00:00 2001 From: Dr Watson <> Date: Fri, 16 May 2025 15:09:09 +0300 Subject: [PATCH 02/10] ios tweaks --- iosApp/Podfile.lock | 12 ++++++------ iosApp/iosApp.xcodeproj/project.pbxproj | 8 ++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/iosApp/Podfile.lock b/iosApp/Podfile.lock index 24283ed..57aa9ad 100644 --- a/iosApp/Podfile.lock +++ b/iosApp/Podfile.lock @@ -1,7 +1,7 @@ PODS: - - AWSCore (2.39.0) - - AWSS3 (2.39.0): - - AWSCore (= 2.39.0) + - AWSCore (2.40.2) + - AWSS3 (2.40.2): + - AWSCore (= 2.40.2) DEPENDENCIES: - AWSCore @@ -13,9 +13,9 @@ SPEC REPOS: - AWSS3 SPEC CHECKSUMS: - AWSCore: b57f3e105f5e4c910e9e26e644c49bd62817e63e - AWSS3: cb8b74600f24482a60d8b529408cc2600b6fe281 + AWSCore: 3d4b9508d6bc57d83d4efd44044e726dfd6c0cd1 + AWSS3: 20c6f122e962cdf6ddaf60f52422bb94da584026 PODFILE CHECKSUM: 6bcadfdeabacb05b1247554422b15ae01ebeb8db -COCOAPODS: 1.15.2 +COCOAPODS: 1.16.2 diff --git a/iosApp/iosApp.xcodeproj/project.pbxproj b/iosApp/iosApp.xcodeproj/project.pbxproj index 3fb2a33..52dff9f 100644 --- a/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/iosApp/iosApp.xcodeproj/project.pbxproj @@ -210,10 +210,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-frameworks.sh\"\n"; @@ -385,7 +389,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; - DEVELOPMENT_TEAM = T4J57K2C6K; + DEVELOPMENT_TEAM = KU3SQYFD2A; ENABLE_PREVIEWS = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -419,7 +423,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\""; - DEVELOPMENT_TEAM = T4J57K2C6K; + DEVELOPMENT_TEAM = KU3SQYFD2A; ENABLE_PREVIEWS = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", From 1eac60faf16986b7c7f85862a8d844f2b35d7196 Mon Sep 17 00:00:00 2001 From: Dr Watson <> Date: Fri, 16 May 2025 15:28:32 +0300 Subject: [PATCH 03/10] merge conflict fix --- composeApp/src/commonMain/kotlin/DI.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/DI.kt b/composeApp/src/commonMain/kotlin/DI.kt index 99c70be..ace3bb8 100644 --- a/composeApp/src/commonMain/kotlin/DI.kt +++ b/composeApp/src/commonMain/kotlin/DI.kt @@ -23,8 +23,8 @@ import ui.file.FileSystemViewInteractor import ui.home.HomeViewInteractor import ui.iosServices.IOSServicesScreenViewInteractor import ui.popups.PopupsScreenViewInteractor -import ui.viewStateExample.ViewStateExampleViewInteractor import ui.settingsOpenerExample.SettingsOpenerExampleViewInteractor +import ui.viewStateExample.ViewStateExampleViewInteractor fun initKoin( appDeclaration: KoinAppDeclaration = {}, @@ -60,6 +60,5 @@ fun commonModule() = module { factory { IOSServicesScreenViewInteractor(get()) } factory { CapabilityScreenViewInteractor(get()) } factory { ColorPickerViewInteractor() } -} factory { SettingsOpenerExampleViewInteractor(get(), get()) } -} + platformModule() \ No newline at end of file +} \ No newline at end of file From eb21f99b3288796476f0d8528476c61697308d86 Mon Sep 17 00:00:00 2001 From: Ryan Mitchener Date: Mon, 19 May 2025 14:01:20 -0400 Subject: [PATCH 04/10] Updated imported oskit-version --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fa1f268..3c014da 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,7 @@ kotlinxCoroutinesCore = "1.10.2" kotlinxDatetime = "0.6.1" okio = "3.9.1" oskitCompose = "4.1.0" -oskitKmp = "5.0.0" +oskitKmp = "5.1.0" skie = "0.10.1" ui = "1.8.1" material-icons = "1.7.3" From b7b3a909bb48037855bd905401dfd48a665f6103 Mon Sep 17 00:00:00 2001 From: Dr Watson <> Date: Thu, 29 May 2025 13:51:51 +0300 Subject: [PATCH 05/10] PR feedback --- .../SettingsOpenerExampleScreen.kt | 17 ++++++--- .../SettingsOpenerExampleViewInteractor.kt | 37 +++++++++++++++---- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt index aaa38dd..45a2b18 100644 --- a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt +++ b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt @@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding import androidx.compose.material.Button import androidx.compose.material.Text import androidx.compose.material.TextField @@ -33,26 +34,32 @@ fun SettingsOpenerExampleScreen( content = { Text("Open App Settings") }, onClick = interactor::appSettingsClicked ) + ResultLabel(state.appSettingsOutcome) Button( content = { Text("Open System Settings") }, onClick = interactor::systemSettingsClicked ) + ResultLabel(state.systemSettingsOutcome) Button( content = { Text("Open Bluetooth Settings") }, onClick = interactor::bluetoothSettingsClicked ) + ResultLabel(state.btSettingsOutcome) Button( content = { Text("Open Location Settings") }, onClick = interactor::locationSettingsClicked ) - - Button( - content = { Text("Pop To Home") }, - onClick = interactor::popToHome - ) + ResultLabel(state.locationSettingsOutcome) } } +} + +@Composable +private fun ResultLabel(message: String?) { + if (!message.isNullOrBlank()) { + Text("Result is $message", modifier = Modifier.padding(top = 4.dp, bottom = 16.dp)) + } } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt index 5ccc4b6..b836a73 100644 --- a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt +++ b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt @@ -1,19 +1,22 @@ package ui.settingsOpenerExample -import coordinator.AppCoordinator import com.outsidesource.oskitkmp.interactor.Interactor import com.outsidesource.oskitkmp.systemui.KmpSettingsScreen import com.outsidesource.oskitkmp.systemui.SettingsScreenType +import coordinator.AppCoordinator import kotlinx.coroutines.launch data class SettingsOpenerExampleViewState( - val text: Boolean = true + val appSettingsOutcome: String? = null, + val systemSettingsOutcome: String? = null, + val btSettingsOutcome: String? = null, + val locationSettingsOutcome: String? = null, ) class SettingsOpenerExampleViewInteractor( private val coordinator: AppCoordinator, private val screenOpener: KmpSettingsScreen -): Interactor( +) : Interactor( initialState = SettingsOpenerExampleViewState() ) { @@ -25,25 +28,45 @@ class SettingsOpenerExampleViewInteractor( fun appSettingsClicked() { interactorScope.launch { - screenOpener.open(SettingsScreenType.App) + val res = screenOpener.open(SettingsScreenType.App) + update { state -> + state.copy( + appSettingsOutcome = res.toString() + ) + } } } fun systemSettingsClicked() { interactorScope.launch { - screenOpener.open(SettingsScreenType.SystemSettings) + val res = screenOpener.open(SettingsScreenType.SystemSettings) + update { state -> + state.copy( + systemSettingsOutcome = res.toString() + ) + } } } fun bluetoothSettingsClicked() { interactorScope.launch { - screenOpener.open(SettingsScreenType.Bluetooth) + val res = screenOpener.open(SettingsScreenType.Bluetooth) + update { state -> + state.copy( + btSettingsOutcome = res.toString() + ) + } } } fun locationSettingsClicked() { interactorScope.launch { - screenOpener.open(SettingsScreenType.Location) + val res = screenOpener.open(SettingsScreenType.Location) + update { state -> + state.copy( + locationSettingsOutcome = res.toString() + ) + } } } } \ No newline at end of file From cf7cdebbcd118638da7ed297453c83ee56741bbc Mon Sep 17 00:00:00 2001 From: Dr Watson <> Date: Thu, 29 May 2025 14:58:17 +0300 Subject: [PATCH 06/10] demo app for settings opener update --- .../SettingsOpenerExampleViewInteractor.kt | 6 ++---- composeApp/src/desktopMain/kotlin/PlatformDI.kt | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt index b836a73..b66d756 100644 --- a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt +++ b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt @@ -1,7 +1,7 @@ package ui.settingsOpenerExample import com.outsidesource.oskitkmp.interactor.Interactor -import com.outsidesource.oskitkmp.systemui.KmpSettingsScreen +import com.outsidesource.oskitkmp.systemui.KmpSettingsScreenOpener import com.outsidesource.oskitkmp.systemui.SettingsScreenType import coordinator.AppCoordinator import kotlinx.coroutines.launch @@ -15,7 +15,7 @@ data class SettingsOpenerExampleViewState( class SettingsOpenerExampleViewInteractor( private val coordinator: AppCoordinator, - private val screenOpener: KmpSettingsScreen + private val screenOpener: KmpSettingsScreenOpener ) : Interactor( initialState = SettingsOpenerExampleViewState() ) { @@ -24,8 +24,6 @@ class SettingsOpenerExampleViewInteractor( return state } - fun popToHome() = coordinator.popToHome() - fun appSettingsClicked() { interactorScope.launch { val res = screenOpener.open(SettingsScreenType.App) diff --git a/composeApp/src/desktopMain/kotlin/PlatformDI.kt b/composeApp/src/desktopMain/kotlin/PlatformDI.kt index 17d5117..35237f6 100644 --- a/composeApp/src/desktopMain/kotlin/PlatformDI.kt +++ b/composeApp/src/desktopMain/kotlin/PlatformDI.kt @@ -1,7 +1,7 @@ import com.outsidesource.oskitkmp.storage.KmpKvStore import org.koin.dsl.bind -import com.outsidesource.oskitkmp.systemui.KmpSettingsScreen +import com.outsidesource.oskitkmp.systemui.KmpSettingsScreenOpener import org.koin.dsl.bind import org.koin.dsl.module import service.swift.ISwiftExampleService @@ -12,5 +12,5 @@ actual class PlatformContext actual fun platformModule(platformContext: PlatformContext) = module { single { NoOpSwiftExampleService() } bind ISwiftExampleService::class single { KmpKvStore(appName = "OSKit-Example-App") } - single { KmpSettingsScreen() } bind KmpSettingsScreen::class + single { KmpSettingsScreenOpener() } bind KmpSettingsScreenOpener::class } \ No newline at end of file From 0ec03d06b340e14251bb476714201e617b51b658 Mon Sep 17 00:00:00 2001 From: Ryan Mitchener Date: Tue, 17 Jun 2025 16:35:04 -0400 Subject: [PATCH 07/10] Fixes for different targets --- composeApp/src/androidMain/kotlin/PlatformDI.kt | 5 +++-- .../ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt | 2 +- composeApp/src/iosMain/kotlin/PlatformDI.kt | 5 +++-- composeApp/src/wasmJsMain/kotlin/PlatformDI.kt | 6 +++--- iosApp/iosApp/SwiftExampleService.swift | 2 -- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/composeApp/src/androidMain/kotlin/PlatformDI.kt b/composeApp/src/androidMain/kotlin/PlatformDI.kt index 970e52c..0d89b04 100644 --- a/composeApp/src/androidMain/kotlin/PlatformDI.kt +++ b/composeApp/src/androidMain/kotlin/PlatformDI.kt @@ -1,6 +1,7 @@ import android.content.Context import com.outsidesource.oskitkmp.storage.KmpKvStore -import com.outsidesource.oskitkmp.systemui.KmpSettingsScreen +import com.outsidesource.oskitkmp.systemui.IKmpSettingsScreenOpener +import com.outsidesource.oskitkmp.systemui.KmpSettingsScreenOpener import org.koin.dsl.bind import org.koin.dsl.module import service.swift.ISwiftExampleService @@ -12,5 +13,5 @@ actual fun platformModule(platformContext: PlatformContext) = module { single { platformContext.context } single { NoOpSwiftExampleService() } bind ISwiftExampleService::class single { KmpKvStore(appContext = get()) } - single { KmpSettingsScreen(context = get()) } bind KmpSettingsScreen::class + single { KmpSettingsScreenOpener(context = get()) } bind IKmpSettingsScreenOpener::class } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt index 45a2b18..93de7f3 100644 --- a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt +++ b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleScreen.kt @@ -23,7 +23,7 @@ fun SettingsOpenerExampleScreen( ) { val state = interactor.collectAsState() - Screen("Settings Opener Example") { + Screen("Settings Opener") { Column( modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.spacedBy(8.dp, Alignment.CenterVertically), diff --git a/composeApp/src/iosMain/kotlin/PlatformDI.kt b/composeApp/src/iosMain/kotlin/PlatformDI.kt index 7d38471..e8118cb 100644 --- a/composeApp/src/iosMain/kotlin/PlatformDI.kt +++ b/composeApp/src/iosMain/kotlin/PlatformDI.kt @@ -1,5 +1,6 @@ import com.outsidesource.oskitkmp.storage.KmpKvStore -import com.outsidesource.oskitkmp.systemui.KmpSettingsScreen +import com.outsidesource.oskitkmp.systemui.IKmpSettingsScreenOpener +import com.outsidesource.oskitkmp.systemui.KmpSettingsScreenOpener import org.koin.dsl.bind import org.koin.dsl.module import service.swift.ISwiftExampleService @@ -12,7 +13,7 @@ private val koin = initKoin( actual fun platformModule(platformContext: PlatformContext) = module { single { KmpKvStore() } - single { KmpSettingsScreen() } + single { KmpSettingsScreenOpener() } bind IKmpSettingsScreenOpener::class } fun loadKoinSwiftModules( diff --git a/composeApp/src/wasmJsMain/kotlin/PlatformDI.kt b/composeApp/src/wasmJsMain/kotlin/PlatformDI.kt index 22fb1a1..8e662bf 100644 --- a/composeApp/src/wasmJsMain/kotlin/PlatformDI.kt +++ b/composeApp/src/wasmJsMain/kotlin/PlatformDI.kt @@ -1,7 +1,7 @@ import com.outsidesource.oskitkmp.storage.KmpKvStore import com.outsidesource.oskitkmp.storage.WasmKmpKvStoreType -import org.koin.dsl.bind -import com.outsidesource.oskitkmp.systemui.KmpSettingsScreen +import com.outsidesource.oskitkmp.systemui.IKmpSettingsScreenOpener +import com.outsidesource.oskitkmp.systemui.KmpSettingsScreenOpener import org.koin.dsl.bind import org.koin.dsl.module import service.swift.ISwiftExampleService @@ -12,5 +12,5 @@ actual object PlatformContext actual fun platformModule(platformContext: PlatformContext) = module { single { NoOpSwiftExampleService() } bind ISwiftExampleService::class single { KmpKvStore(type = WasmKmpKvStoreType.LocalStorage) } - single { KmpSettingsScreen() } bind KmpSettingsScreen::class + single { KmpSettingsScreenOpener() } bind IKmpSettingsScreenOpener::class } \ No newline at end of file diff --git a/iosApp/iosApp/SwiftExampleService.swift b/iosApp/iosApp/SwiftExampleService.swift index 58aaa37..ccec7ce 100644 --- a/iosApp/iosApp/SwiftExampleService.swift +++ b/iosApp/iosApp/SwiftExampleService.swift @@ -1,8 +1,6 @@ import Foundation import ComposeApp -typealias Outcome = Oskit_kmpOutcome - class SwiftExampleService : ISwiftExampleService { func createFlowInSwift() -> SkieSwiftFlow { From ef549d2433f63841f9c0e73c4e897590e052d3f7 Mon Sep 17 00:00:00 2001 From: Ryan Mitchener Date: Tue, 17 Jun 2025 16:37:34 -0400 Subject: [PATCH 08/10] More fixes --- .../SettingsOpenerExampleViewInteractor.kt | 4 ++-- composeApp/src/desktopMain/kotlin/PlatformDI.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt index b66d756..1042172 100644 --- a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt +++ b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt @@ -1,7 +1,7 @@ package ui.settingsOpenerExample import com.outsidesource.oskitkmp.interactor.Interactor -import com.outsidesource.oskitkmp.systemui.KmpSettingsScreenOpener +import com.outsidesource.oskitkmp.systemui.IKmpSettingsScreenOpener import com.outsidesource.oskitkmp.systemui.SettingsScreenType import coordinator.AppCoordinator import kotlinx.coroutines.launch @@ -15,7 +15,7 @@ data class SettingsOpenerExampleViewState( class SettingsOpenerExampleViewInteractor( private val coordinator: AppCoordinator, - private val screenOpener: KmpSettingsScreenOpener + private val screenOpener: IKmpSettingsScreenOpener ) : Interactor( initialState = SettingsOpenerExampleViewState() ) { diff --git a/composeApp/src/desktopMain/kotlin/PlatformDI.kt b/composeApp/src/desktopMain/kotlin/PlatformDI.kt index 35237f6..0417e0f 100644 --- a/composeApp/src/desktopMain/kotlin/PlatformDI.kt +++ b/composeApp/src/desktopMain/kotlin/PlatformDI.kt @@ -1,6 +1,6 @@ import com.outsidesource.oskitkmp.storage.KmpKvStore -import org.koin.dsl.bind +import com.outsidesource.oskitkmp.systemui.IKmpSettingsScreenOpener import com.outsidesource.oskitkmp.systemui.KmpSettingsScreenOpener import org.koin.dsl.bind import org.koin.dsl.module @@ -12,5 +12,5 @@ actual class PlatformContext actual fun platformModule(platformContext: PlatformContext) = module { single { NoOpSwiftExampleService() } bind ISwiftExampleService::class single { KmpKvStore(appName = "OSKit-Example-App") } - single { KmpSettingsScreenOpener() } bind KmpSettingsScreenOpener::class + single { KmpSettingsScreenOpener() } bind IKmpSettingsScreenOpener::class } \ No newline at end of file From 015aafe153a0edc686381f25988c40e3d84e6f74 Mon Sep 17 00:00:00 2001 From: Ryan Mitchener Date: Tue, 17 Jun 2025 16:38:15 -0400 Subject: [PATCH 09/10] Minor rename --- .../SettingsOpenerExampleViewInteractor.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt index 1042172..8dc5aea 100644 --- a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt +++ b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt @@ -15,7 +15,7 @@ data class SettingsOpenerExampleViewState( class SettingsOpenerExampleViewInteractor( private val coordinator: AppCoordinator, - private val screenOpener: IKmpSettingsScreenOpener + private val settingsScreenOpener: IKmpSettingsScreenOpener ) : Interactor( initialState = SettingsOpenerExampleViewState() ) { @@ -26,7 +26,7 @@ class SettingsOpenerExampleViewInteractor( fun appSettingsClicked() { interactorScope.launch { - val res = screenOpener.open(SettingsScreenType.App) + val res = settingsScreenOpener.open(SettingsScreenType.App) update { state -> state.copy( appSettingsOutcome = res.toString() @@ -37,7 +37,7 @@ class SettingsOpenerExampleViewInteractor( fun systemSettingsClicked() { interactorScope.launch { - val res = screenOpener.open(SettingsScreenType.SystemSettings) + val res = settingsScreenOpener.open(SettingsScreenType.SystemSettings) update { state -> state.copy( systemSettingsOutcome = res.toString() @@ -48,7 +48,7 @@ class SettingsOpenerExampleViewInteractor( fun bluetoothSettingsClicked() { interactorScope.launch { - val res = screenOpener.open(SettingsScreenType.Bluetooth) + val res = settingsScreenOpener.open(SettingsScreenType.Bluetooth) update { state -> state.copy( btSettingsOutcome = res.toString() @@ -59,7 +59,7 @@ class SettingsOpenerExampleViewInteractor( fun locationSettingsClicked() { interactorScope.launch { - val res = screenOpener.open(SettingsScreenType.Location) + val res = settingsScreenOpener.open(SettingsScreenType.Location) update { state -> state.copy( locationSettingsOutcome = res.toString() From 44810ef812a8f5261e815035e127cc5d909bd01b Mon Sep 17 00:00:00 2001 From: Ryan Mitchener Date: Tue, 17 Jun 2025 16:38:45 -0400 Subject: [PATCH 10/10] Minor update --- .../SettingsOpenerExampleViewInteractor.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt index 8dc5aea..608021c 100644 --- a/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt +++ b/composeApp/src/commonMain/kotlin/ui/settingsOpenerExample/SettingsOpenerExampleViewInteractor.kt @@ -20,10 +20,6 @@ class SettingsOpenerExampleViewInteractor( initialState = SettingsOpenerExampleViewState() ) { - override fun computed(state: SettingsOpenerExampleViewState): SettingsOpenerExampleViewState { - return state - } - fun appSettingsClicked() { interactorScope.launch { val res = settingsScreenOpener.open(SettingsScreenType.App)