From 2977d3c9224d7270e99ae69fb460fd60ed0ca323 Mon Sep 17 00:00:00 2001 From: Fabian Norlin Date: Wed, 3 Sep 2025 18:16:07 +0200 Subject: [PATCH] Initial commit. --- .idea/artifacts/shared.xml | 8 ++ docs/plan.txt | 26 +++++ shared/.gitignore | 1 + shared/build.gradle.kts | 100 ++++++++++++++++++ .../klottr/shared/ExampleInstrumentedTest.kt | 24 +++++ .../app/klottr/shared/ExampleUnitTest.kt | 16 +++ shared/src/androidMain/AndroidManifest.xml | 4 + .../app/klottr/shared/Platform.android.kt | 3 + shared/src/commonMain/kotlin/SharedPing.kt | 2 + .../kotlin/app/klottr/shared/Platform.kt | 3 + .../kotlin/app/klottr/shared/Platform.ios.kt | 3 + 11 files changed, 190 insertions(+) create mode 100644 .idea/artifacts/shared.xml create mode 100644 docs/plan.txt create mode 100644 shared/.gitignore create mode 100644 shared/build.gradle.kts create mode 100644 shared/src/androidDeviceTest/kotlin/app/klottr/shared/ExampleInstrumentedTest.kt create mode 100644 shared/src/androidHostTest/kotlin/app/klottr/shared/ExampleUnitTest.kt create mode 100644 shared/src/androidMain/AndroidManifest.xml create mode 100644 shared/src/androidMain/kotlin/app/klottr/shared/Platform.android.kt create mode 100644 shared/src/commonMain/kotlin/SharedPing.kt create mode 100644 shared/src/commonMain/kotlin/app/klottr/shared/Platform.kt create mode 100644 shared/src/iosMain/kotlin/app/klottr/shared/Platform.ios.kt diff --git a/.idea/artifacts/shared.xml b/.idea/artifacts/shared.xml new file mode 100644 index 0000000..f127cc2 --- /dev/null +++ b/.idea/artifacts/shared.xml @@ -0,0 +1,8 @@ + + + $PROJECT_DIR$/shared/build/libs + + + + + \ No newline at end of file diff --git a/docs/plan.txt b/docs/plan.txt new file mode 100644 index 0000000..03e6495 --- /dev/null +++ b/docs/plan.txt @@ -0,0 +1,26 @@ + +0.2.6 Nuvarande version. +0.3.0 Ska ha samma funktioner som senaste 0.2.x men multiplattform. +0.4.0 Utbytt utseende i appen (tänkte ha några knappikoner längst ned och sedan något grejs längst upp kanske hamburgermeny, men vi får skissa och testa lite.) +0.5.0 Dynamiska lager (har en ganska klar bild över hur det skall fungera, bör gå ganska lätt att implementera, det kluriga är hur man gör det enkelt för användaren så det inte ser ut som manöverbordet på de gamla rymdfärjorna). +0.6.0 Klottr Chat (kräver dynamiska lager, men behöver enskild serverkod). +0.7.0 ? +0.8.0 ? +0.9.x Sista betorna innan publikt släpp. +1.0.0 Första publika versionen. +1.0.x Buggfixar1.1.0 Förbättringar baserad på erfarenheter av den publika användningen. +2.0.0 Klottr Voice Chat + +Någonstans skall också premiumabonnemang, företagsabonnemang och liknande in. + +Någonstans skall också modereringsfunktioner in. Definitivt innan version 1.0. + +Senare: Klotter Video Chat?  + +Skapa ett git-dokument gällande modereringssystemet. + +Möjlighet att blocka personer kan krävas för åldersgräns 12 år. + +Byte av användarnamn möjligt, men måste vara begränsat. Kanske kosta? Kanske en gång i halvåret? Man fortsätter med samma ID ändå. + + diff --git a/shared/.gitignore b/shared/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/shared/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts new file mode 100644 index 0000000..92ffd24 --- /dev/null +++ b/shared/build.gradle.kts @@ -0,0 +1,100 @@ +plugins { + alias(libs.plugins.kotlin.multiplatform) + alias(libs.plugins.android.kotlin.multiplatform.library) + alias(libs.plugins.android.lint) +} + +kotlin { + + // Target declarations - add or remove as needed below. These define + // which platforms this KMP module supports. + // See: https://kotlinlang.org/docs/multiplatform-discover-project.html#targets + androidLibrary { + namespace = "app.klottr.shared" + compileSdk = 36 + minSdk = 26 + + withHostTestBuilder { + } + + withDeviceTestBuilder { + sourceSetTreeName = "test" + }.configure { + instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + } + + // For iOS targets, this is also where you should + // configure native binary output. For more information, see: + // https://kotlinlang.org/docs/multiplatform-build-native-binaries.html#build-xcframeworks + + // A step-by-step guide on how to include this library in an XCode + // project can be found here: + // https://developer.android.com/kotlin/multiplatform/migrate + val xcfName = "sharedKit" + + iosX64 { + binaries.framework { + baseName = xcfName + } + } + + iosArm64 { + binaries.framework { + baseName = xcfName + } + } + + iosSimulatorArm64 { + binaries.framework { + baseName = xcfName + } + } + + // Source set declarations. + // Declaring a target automatically creates a source set with the same name. By default, the + // Kotlin Gradle Plugin creates additional source sets that depend on each other, since it is + // common to share sources between related targets. + // See: https://kotlinlang.org/docs/multiplatform-hierarchy.html + sourceSets { + commonMain { + dependencies { + implementation(libs.kotlin.stdlib) + // Add KMP dependencies here + } + } + + commonTest { + dependencies { + implementation(libs.kotlin.test) + } + } + + androidMain { + dependencies { + // Add Android-specific dependencies here. Note that this source set depends on + // commonMain by default and will correctly pull the Android artifacts of any KMP + // dependencies declared in commonMain. + } + } + + getByName("androidDeviceTest") { + dependencies { + implementation(libs.androidx.runner) + implementation(libs.androidx.core) + implementation(libs.androidx.junit) + } + } + + iosMain { + dependencies { + // Add iOS-specific dependencies here. This a source set created by Kotlin Gradle + // Plugin (KGP) that each specific iOS target (e.g., iosX64) depends on as + // part of KMP’s default source set hierarchy. Note that this source set depends + // on common by default and will correctly pull the iOS artifacts of any + // KMP dependencies declared in commonMain. + } + } + } + +} \ No newline at end of file diff --git a/shared/src/androidDeviceTest/kotlin/app/klottr/shared/ExampleInstrumentedTest.kt b/shared/src/androidDeviceTest/kotlin/app/klottr/shared/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..e5de691 --- /dev/null +++ b/shared/src/androidDeviceTest/kotlin/app/klottr/shared/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package app.klottr.shared + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("app.klottr.shared.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/shared/src/androidHostTest/kotlin/app/klottr/shared/ExampleUnitTest.kt b/shared/src/androidHostTest/kotlin/app/klottr/shared/ExampleUnitTest.kt new file mode 100644 index 0000000..149b430 --- /dev/null +++ b/shared/src/androidHostTest/kotlin/app/klottr/shared/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package app.klottr.shared + +import kotlin.test.Test +import kotlin.test.assertEquals + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/shared/src/androidMain/AndroidManifest.xml b/shared/src/androidMain/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/shared/src/androidMain/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/shared/src/androidMain/kotlin/app/klottr/shared/Platform.android.kt b/shared/src/androidMain/kotlin/app/klottr/shared/Platform.android.kt new file mode 100644 index 0000000..437062e --- /dev/null +++ b/shared/src/androidMain/kotlin/app/klottr/shared/Platform.android.kt @@ -0,0 +1,3 @@ +package app.klottr.shared + +actual fun platform() = "Android" \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/SharedPing.kt b/shared/src/commonMain/kotlin/SharedPing.kt new file mode 100644 index 0000000..76cc233 --- /dev/null +++ b/shared/src/commonMain/kotlin/SharedPing.kt @@ -0,0 +1,2 @@ +class SharedPing { +} \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/app/klottr/shared/Platform.kt b/shared/src/commonMain/kotlin/app/klottr/shared/Platform.kt new file mode 100644 index 0000000..1f4a549 --- /dev/null +++ b/shared/src/commonMain/kotlin/app/klottr/shared/Platform.kt @@ -0,0 +1,3 @@ +package app.klottr.shared + +expect fun platform(): String \ No newline at end of file diff --git a/shared/src/iosMain/kotlin/app/klottr/shared/Platform.ios.kt b/shared/src/iosMain/kotlin/app/klottr/shared/Platform.ios.kt new file mode 100644 index 0000000..186f3e4 --- /dev/null +++ b/shared/src/iosMain/kotlin/app/klottr/shared/Platform.ios.kt @@ -0,0 +1,3 @@ +package app.klottr.shared + +actual fun platform() = "iOS" \ No newline at end of file