Re-arrange code structure

This commit is contained in:
Severiano Jaramillo 2024-03-05 21:39:08 -06:00
parent 2dba2b6b53
commit 888d29e436
9 changed files with 21 additions and 9 deletions

View file

@ -1,7 +1,9 @@
package net.agorise.kee
import android.os.Build
class AndroidPlatform : Platform {
override val name: String = "Android ${Build.VERSION.SDK_INT}"
}
actual fun getPlatform(): Platform = AndroidPlatform()
actual fun getPlatform(): Platform = AndroidPlatform()

View file

@ -1,3 +1,3 @@
<resources>
<string name="app_name">Kee</string>
</resources>
</resources>

View file

@ -1,4 +1,4 @@
//package net.agorise.kee
package net.agorise.kee
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth

View file

@ -1,7 +1,9 @@
package net.agorise.kee
class Greeting {
private val platform = getPlatform()
fun greet(): String {
return "Hello, ${platform.name}!"
return "Kee on ${platform.name}!"
}
}
}

View file

@ -1,5 +1,7 @@
package net.agorise.kee
interface Platform {
val name: String
}
expect fun getPlatform(): Platform
expect fun getPlatform(): Platform

View file

@ -1,5 +1,7 @@
package net.agorise.kee
class JVMPlatform: Platform {
override val name: String = "Java ${System.getProperty("java.version")}"
}
actual fun getPlatform(): Platform = JVMPlatform()
actual fun getPlatform(): Platform = JVMPlatform()

View file

@ -1,3 +1,4 @@
package net.agorise.kee
import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.DpSize

View file

@ -1,3 +1,4 @@
import androidx.compose.ui.window.ComposeUIViewController
import net.agorise.kee.App
fun MainViewController() = ComposeUIViewController { App() }
fun MainViewController() = ComposeUIViewController { App() }

View file

@ -1,7 +1,9 @@
package net.agorise.kee
import platform.UIKit.UIDevice
class IOSPlatform: Platform {
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
}
actual fun getPlatform(): Platform = IOSPlatform()
actual fun getPlatform(): Platform = IOSPlatform()