Added PlatformType (even though it's not used somewhere)
This commit is contained in:
parent
b0f7f23f98
commit
9116dd945f
|
@ -4,6 +4,8 @@ import android.os.Build
|
||||||
|
|
||||||
class AndroidPlatform : Platform {
|
class AndroidPlatform : Platform {
|
||||||
override val name: String = "Android ${Build.VERSION.SDK_INT}"
|
override val name: String = "Android ${Build.VERSION.SDK_INT}"
|
||||||
|
|
||||||
|
override val type: PlatformType = PlatformType.Android
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun getPlatform(): Platform = AndroidPlatform()
|
actual fun getPlatform(): Platform = AndroidPlatform()
|
|
@ -1,7 +1,16 @@
|
||||||
package net.codinux.banking.ui
|
package net.codinux.banking.ui
|
||||||
|
|
||||||
|
|
||||||
|
expect fun getPlatform(): Platform
|
||||||
|
|
||||||
interface Platform {
|
interface Platform {
|
||||||
val name: String
|
val name: String
|
||||||
|
val type: PlatformType
|
||||||
}
|
}
|
||||||
|
|
||||||
expect fun getPlatform(): Platform
|
enum class PlatformType {
|
||||||
|
JVM,
|
||||||
|
Android,
|
||||||
|
iOS,
|
||||||
|
Web
|
||||||
|
}
|
|
@ -1,7 +1,12 @@
|
||||||
package net.codinux.banking.ui.service
|
package net.codinux.banking.ui.service
|
||||||
|
|
||||||
|
import net.codinux.banking.ui.Platform
|
||||||
|
import net.codinux.banking.ui.getPlatform
|
||||||
|
|
||||||
object DI {
|
object DI {
|
||||||
|
|
||||||
|
val platform: Platform = getPlatform()
|
||||||
|
|
||||||
val bankFinder = BankFinder()
|
val bankFinder = BankFinder()
|
||||||
|
|
||||||
val bankingService = BankingService(bankFinder)
|
val bankingService = BankingService(bankFinder)
|
||||||
|
|
|
@ -2,6 +2,8 @@ package net.codinux.banking.ui
|
||||||
|
|
||||||
class JVMPlatform: Platform {
|
class JVMPlatform: Platform {
|
||||||
override val name: String = "Java ${System.getProperty("java.version")}"
|
override val name: String = "Java ${System.getProperty("java.version")}"
|
||||||
|
|
||||||
|
override val type: PlatformType = PlatformType.JVM
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun getPlatform(): Platform = JVMPlatform()
|
actual fun getPlatform(): Platform = JVMPlatform()
|
|
@ -4,6 +4,8 @@ import platform.UIKit.UIDevice
|
||||||
|
|
||||||
class IOSPlatform: Platform {
|
class IOSPlatform: Platform {
|
||||||
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
|
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
|
||||||
|
|
||||||
|
override val type: PlatformType = PlatformType.iOS
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun getPlatform(): Platform = IOSPlatform()
|
actual fun getPlatform(): Platform = IOSPlatform()
|
|
@ -2,6 +2,9 @@ package net.codinux.banking.ui
|
||||||
|
|
||||||
class WasmPlatform: Platform {
|
class WasmPlatform: Platform {
|
||||||
override val name: String = "Web with Kotlin/Wasm"
|
override val name: String = "Web with Kotlin/Wasm"
|
||||||
|
|
||||||
|
override val type: PlatformType = PlatformType.Web
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actual fun getPlatform(): Platform = WasmPlatform()
|
actual fun getPlatform(): Platform = WasmPlatform()
|
Loading…
Reference in New Issue