diff --git a/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/Platform.android.kt b/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/Platform.android.kt index f695089..9f16c1c 100644 --- a/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/Platform.android.kt +++ b/composeApp/src/androidMain/kotlin/net/codinux/banking/ui/Platform.android.kt @@ -4,6 +4,8 @@ import android.os.Build class AndroidPlatform : Platform { override val name: String = "Android ${Build.VERSION.SDK_INT}" + + override val type: PlatformType = PlatformType.Android } actual fun getPlatform(): Platform = AndroidPlatform() \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/Platform.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/Platform.kt index 08ee27b..e58badf 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/Platform.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/Platform.kt @@ -1,7 +1,16 @@ package net.codinux.banking.ui + +expect fun getPlatform(): Platform + interface Platform { val name: String + val type: PlatformType } -expect fun getPlatform(): Platform \ No newline at end of file +enum class PlatformType { + JVM, + Android, + iOS, + Web +} \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/service/DI.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/service/DI.kt index 39a4c81..a626afe 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/service/DI.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/service/DI.kt @@ -1,7 +1,12 @@ package net.codinux.banking.ui.service +import net.codinux.banking.ui.Platform +import net.codinux.banking.ui.getPlatform + object DI { + val platform: Platform = getPlatform() + val bankFinder = BankFinder() val bankingService = BankingService(bankFinder) diff --git a/composeApp/src/desktopMain/kotlin/net/codinux/banking/ui/Platform.jvm.kt b/composeApp/src/desktopMain/kotlin/net/codinux/banking/ui/Platform.jvm.kt index 5114acf..bd69891 100644 --- a/composeApp/src/desktopMain/kotlin/net/codinux/banking/ui/Platform.jvm.kt +++ b/composeApp/src/desktopMain/kotlin/net/codinux/banking/ui/Platform.jvm.kt @@ -2,6 +2,8 @@ package net.codinux.banking.ui class JVMPlatform: Platform { override val name: String = "Java ${System.getProperty("java.version")}" + + override val type: PlatformType = PlatformType.JVM } actual fun getPlatform(): Platform = JVMPlatform() \ No newline at end of file diff --git a/composeApp/src/iosMain/kotlin/net/codinux/banking/ui/Platform.ios.kt b/composeApp/src/iosMain/kotlin/net/codinux/banking/ui/Platform.ios.kt index 47c9ad2..8c7bb91 100644 --- a/composeApp/src/iosMain/kotlin/net/codinux/banking/ui/Platform.ios.kt +++ b/composeApp/src/iosMain/kotlin/net/codinux/banking/ui/Platform.ios.kt @@ -4,6 +4,8 @@ import platform.UIKit.UIDevice class IOSPlatform: Platform { override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion + + override val type: PlatformType = PlatformType.iOS } actual fun getPlatform(): Platform = IOSPlatform() \ No newline at end of file diff --git a/composeApp/src/wasmJsMain/kotlin/net/codinux/banking/ui/Platform.wasmJs.kt b/composeApp/src/wasmJsMain/kotlin/net/codinux/banking/ui/Platform.wasmJs.kt index d3490da..c3f8e76 100644 --- a/composeApp/src/wasmJsMain/kotlin/net/codinux/banking/ui/Platform.wasmJs.kt +++ b/composeApp/src/wasmJsMain/kotlin/net/codinux/banking/ui/Platform.wasmJs.kt @@ -2,6 +2,9 @@ package net.codinux.banking.ui class WasmPlatform: Platform { override val name: String = "Web with Kotlin/Wasm" + + override val type: PlatformType = PlatformType.Web + } actual fun getPlatform(): Platform = WasmPlatform() \ No newline at end of file