Phase 1 work

This commit is contained in:
2026-04-24 20:21:03 +02:00
parent b36058fa79
commit 68655eae1a
22 changed files with 126 additions and 65 deletions

View File

@@ -2,8 +2,8 @@ package dev.ulfrx.recipe
import android.os.Build
class AndroidPlatform : Platform {
public class AndroidPlatform : Platform {
override val name: String = "Android ${Build.VERSION.SDK_INT}"
}
actual fun getPlatform(): Platform = AndroidPlatform()
public actual fun getPlatform(): Platform = AndroidPlatform()

View File

@@ -1,3 +1,3 @@
package dev.ulfrx.recipe
const val SERVER_PORT = 8080
public const val SERVER_PORT: Int = 8080

View File

@@ -1,9 +1,7 @@
package dev.ulfrx.recipe
class Greeting {
public class Greeting {
private val platform = getPlatform()
fun greet(): String {
return "Hello, ${platform.name}!"
}
}
public fun greet(): String = "Hello, ${platform.name}!"
}

View File

@@ -1,7 +1,7 @@
package dev.ulfrx.recipe
interface Platform {
val name: String
public interface Platform {
public val name: String
}
expect fun getPlatform(): Platform
public expect fun getPlatform(): Platform

View File

@@ -4,9 +4,8 @@ import kotlin.test.Test
import kotlin.test.assertEquals
class SharedCommonTest {
@Test
fun example() {
assertEquals(3, 1 + 2)
}
}
}

View File

@@ -2,8 +2,8 @@ package dev.ulfrx.recipe
import platform.UIKit.UIDevice
class IOSPlatform : Platform {
public class IOSPlatform : Platform {
override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion
}
actual fun getPlatform(): Platform = IOSPlatform()
public actual fun getPlatform(): Platform = IOSPlatform()

View File

@@ -1,7 +1,7 @@
package dev.ulfrx.recipe
class JVMPlatform : Platform {
public class JVMPlatform : Platform {
override val name: String = "Java ${System.getProperty("java.version")}"
}
actual fun getPlatform(): Platform = JVMPlatform()
public actual fun getPlatform(): Platform = JVMPlatform()

View File

@@ -1,7 +1,7 @@
package dev.ulfrx.recipe
class WasmPlatform : Platform {
public class WasmPlatform : Platform {
override val name: String = "Web with Kotlin/Wasm"
}
actual fun getPlatform(): Platform = WasmPlatform()
public actual fun getPlatform(): Platform = WasmPlatform()