From 888d29e4367909ac60c915a2eef5aa4ac1b3d3c8 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Tue, 5 Mar 2024 21:39:08 -0600 Subject: [PATCH] Re-arrange code structure --- .../kotlin/{ => net/agorise/kee}/Platform.android.kt | 4 +++- composeApp/src/androidMain/res/values/strings.xml | 2 +- composeApp/src/commonMain/kotlin/net/agorise/kee/App.kt | 2 +- .../src/commonMain/kotlin/net/agorise/kee/Greeting.kt | 6 ++++-- .../src/commonMain/kotlin/net/agorise/kee/Platform.kt | 4 +++- .../kotlin/{ => net/agorise/kee}/Platform.jvm.kt | 4 +++- .../src/desktopMain/kotlin/{ => net/agorise/kee}/main.kt | 1 + composeApp/src/iosMain/kotlin/MainViewController.kt | 3 ++- .../iosMain/kotlin/{ => net/agorise/kee}/Platform.ios.kt | 4 +++- 9 files changed, 21 insertions(+), 9 deletions(-) rename composeApp/src/androidMain/kotlin/{ => net/agorise/kee}/Platform.android.kt (61%) rename composeApp/src/desktopMain/kotlin/{ => net/agorise/kee}/Platform.jvm.kt (59%) rename composeApp/src/desktopMain/kotlin/{ => net/agorise/kee}/main.kt (96%) rename composeApp/src/iosMain/kotlin/{ => net/agorise/kee}/Platform.ios.kt (70%) diff --git a/composeApp/src/androidMain/kotlin/Platform.android.kt b/composeApp/src/androidMain/kotlin/net/agorise/kee/Platform.android.kt similarity index 61% rename from composeApp/src/androidMain/kotlin/Platform.android.kt rename to composeApp/src/androidMain/kotlin/net/agorise/kee/Platform.android.kt index 4f3ea05..ee5e38e 100644 --- a/composeApp/src/androidMain/kotlin/Platform.android.kt +++ b/composeApp/src/androidMain/kotlin/net/agorise/kee/Platform.android.kt @@ -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() \ No newline at end of file +actual fun getPlatform(): Platform = AndroidPlatform() diff --git a/composeApp/src/androidMain/res/values/strings.xml b/composeApp/src/androidMain/res/values/strings.xml index 554e9fa..d2a597a 100644 --- a/composeApp/src/androidMain/res/values/strings.xml +++ b/composeApp/src/androidMain/res/values/strings.xml @@ -1,3 +1,3 @@ Kee - \ No newline at end of file + diff --git a/composeApp/src/commonMain/kotlin/net/agorise/kee/App.kt b/composeApp/src/commonMain/kotlin/net/agorise/kee/App.kt index 3b5a36a..9434529 100644 --- a/composeApp/src/commonMain/kotlin/net/agorise/kee/App.kt +++ b/composeApp/src/commonMain/kotlin/net/agorise/kee/App.kt @@ -1,4 +1,4 @@ -//package net.agorise.kee +package net.agorise.kee import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth diff --git a/composeApp/src/commonMain/kotlin/net/agorise/kee/Greeting.kt b/composeApp/src/commonMain/kotlin/net/agorise/kee/Greeting.kt index 887d835..0eea8da 100644 --- a/composeApp/src/commonMain/kotlin/net/agorise/kee/Greeting.kt +++ b/composeApp/src/commonMain/kotlin/net/agorise/kee/Greeting.kt @@ -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}!" } -} \ No newline at end of file +} diff --git a/composeApp/src/commonMain/kotlin/net/agorise/kee/Platform.kt b/composeApp/src/commonMain/kotlin/net/agorise/kee/Platform.kt index 87ca3ff..bd053e1 100644 --- a/composeApp/src/commonMain/kotlin/net/agorise/kee/Platform.kt +++ b/composeApp/src/commonMain/kotlin/net/agorise/kee/Platform.kt @@ -1,5 +1,7 @@ +package net.agorise.kee + interface Platform { val name: String } -expect fun getPlatform(): Platform \ No newline at end of file +expect fun getPlatform(): Platform diff --git a/composeApp/src/desktopMain/kotlin/Platform.jvm.kt b/composeApp/src/desktopMain/kotlin/net/agorise/kee/Platform.jvm.kt similarity index 59% rename from composeApp/src/desktopMain/kotlin/Platform.jvm.kt rename to composeApp/src/desktopMain/kotlin/net/agorise/kee/Platform.jvm.kt index f5e7e49..90a123b 100644 --- a/composeApp/src/desktopMain/kotlin/Platform.jvm.kt +++ b/composeApp/src/desktopMain/kotlin/net/agorise/kee/Platform.jvm.kt @@ -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() \ No newline at end of file +actual fun getPlatform(): Platform = JVMPlatform() diff --git a/composeApp/src/desktopMain/kotlin/main.kt b/composeApp/src/desktopMain/kotlin/net/agorise/kee/main.kt similarity index 96% rename from composeApp/src/desktopMain/kotlin/main.kt rename to composeApp/src/desktopMain/kotlin/net/agorise/kee/main.kt index e48b389..afeeed8 100644 --- a/composeApp/src/desktopMain/kotlin/main.kt +++ b/composeApp/src/desktopMain/kotlin/net/agorise/kee/main.kt @@ -1,3 +1,4 @@ +package net.agorise.kee import androidx.compose.runtime.Composable import androidx.compose.ui.unit.DpSize diff --git a/composeApp/src/iosMain/kotlin/MainViewController.kt b/composeApp/src/iosMain/kotlin/MainViewController.kt index fa143d4..fcf5eba 100644 --- a/composeApp/src/iosMain/kotlin/MainViewController.kt +++ b/composeApp/src/iosMain/kotlin/MainViewController.kt @@ -1,3 +1,4 @@ import androidx.compose.ui.window.ComposeUIViewController +import net.agorise.kee.App -fun MainViewController() = ComposeUIViewController { App() } \ No newline at end of file +fun MainViewController() = ComposeUIViewController { App() } diff --git a/composeApp/src/iosMain/kotlin/Platform.ios.kt b/composeApp/src/iosMain/kotlin/net/agorise/kee/Platform.ios.kt similarity index 70% rename from composeApp/src/iosMain/kotlin/Platform.ios.kt rename to composeApp/src/iosMain/kotlin/net/agorise/kee/Platform.ios.kt index 5cef987..08f5021 100644 --- a/composeApp/src/iosMain/kotlin/Platform.ios.kt +++ b/composeApp/src/iosMain/kotlin/net/agorise/kee/Platform.ios.kt @@ -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() \ No newline at end of file +actual fun getPlatform(): Platform = IOSPlatform()