Wire project infrastructure
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
package dev.ulfrx.recipe
|
||||
|
||||
const val SERVER_PORT = 8080
|
||||
public const val SERVER_PORT: Int = 8080
|
||||
|
||||
@@ -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}!"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,9 +4,8 @@ import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class SharedCommonTest {
|
||||
|
||||
@Test
|
||||
fun example() {
|
||||
assertEquals(3, 1 + 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package dev.ulfrx.recipe
|
||||
|
||||
class JsPlatform : Platform {
|
||||
override val name: String = "Web with Kotlin/JS"
|
||||
}
|
||||
|
||||
actual fun getPlatform(): Platform = JsPlatform()
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user