Första stegen mot multiplattform gjorda. Skapat shared.
This commit is contained in:
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
@@ -11,6 +11,7 @@
|
|||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
|
<option value="$PROJECT_DIR$/shared" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -46,8 +46,8 @@ android {
|
|||||||
applicationId = "app.klottr"
|
applicationId = "app.klottr"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 13
|
versionCode = 14
|
||||||
versionName = "0.2.6"
|
versionName = "0.3.0"
|
||||||
|
|
||||||
// Byggtid i UTC (ISO 8601) genereras vid build-konfiguration
|
// Byggtid i UTC (ISO 8601) genereras vid build-konfiguration
|
||||||
val buildTimeUtc = Instant.now().toString()
|
val buildTimeUtc = Instant.now().toString()
|
||||||
@@ -88,6 +88,7 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
// Compose
|
// Compose
|
||||||
val composeBom = platform("androidx.compose:compose-bom:2025.01.00")
|
val composeBom = platform("androidx.compose:compose-bom:2025.01.00")
|
||||||
|
implementation(project(":shared"))
|
||||||
implementation(composeBom)
|
implementation(composeBom)
|
||||||
androidTestImplementation(composeBom)
|
androidTestImplementation(composeBom)
|
||||||
implementation("androidx.activity:activity-compose:1.9.3")
|
implementation("androidx.activity:activity-compose:1.9.3")
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import androidx.compose.material3.Surface
|
|||||||
import androidx.compose.material3.Switch
|
import androidx.compose.material3.Switch
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@@ -106,6 +107,7 @@ import app.klottr.net.createNoteDoc
|
|||||||
import app.klottr.net.deleteNote
|
import app.klottr.net.deleteNote
|
||||||
import app.klottr.net.fetchNoteDetail
|
import app.klottr.net.fetchNoteDetail
|
||||||
import app.klottr.net.uploadImageFromUri
|
import app.klottr.net.uploadImageFromUri
|
||||||
|
import app.klottr.shared.SharedPing
|
||||||
import app.klottr.theme.KlottrTheme
|
import app.klottr.theme.KlottrTheme
|
||||||
import app.klottr.util.Auth
|
import app.klottr.util.Auth
|
||||||
import app.klottr.util.Config
|
import app.klottr.util.Config
|
||||||
@@ -205,6 +207,10 @@ class MainActivity : ComponentActivity() {
|
|||||||
|
|
||||||
setContent {
|
setContent {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
// För att testa att :shared fungerar
|
||||||
|
val sharedPing = remember { SharedPing().ping() }
|
||||||
|
|
||||||
var night by remember { mutableStateOf(SettingsStore.getNightMode(context)) }
|
var night by remember { mutableStateOf(SettingsStore.getNightMode(context)) }
|
||||||
DisposableEffect(Unit) {
|
DisposableEffect(Unit) {
|
||||||
val listener = SettingsStore.observe(context) { key ->
|
val listener = SettingsStore.observe(context) { key ->
|
||||||
@@ -215,6 +221,11 @@ class MainActivity : ComponentActivity() {
|
|||||||
onDispose { SettingsStore.unobserve(context, listener) }
|
onDispose { SettingsStore.unobserve(context, listener) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ⬇️ NYTILLÄGG: logga en gång när värdet finns
|
||||||
|
LaunchedEffect(sharedPing) {
|
||||||
|
Log.d("Klottr", "Shared ping = $sharedPing")
|
||||||
|
}
|
||||||
|
|
||||||
KlottrTheme(darkTheme = night) {
|
KlottrTheme(darkTheme = night) {
|
||||||
KlottrApp(
|
KlottrApp(
|
||||||
onRequestPerms = { this@MainActivity.requestAllRuntimePerms() },
|
onRequestPerms = { this@MainActivity.requestAllRuntimePerms() },
|
||||||
|
|||||||
@@ -3,4 +3,7 @@ plugins {
|
|||||||
alias(libs.plugins.android.application) apply false
|
alias(libs.plugins.android.application) apply false
|
||||||
alias(libs.plugins.kotlin.android) apply false
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
alias(libs.plugins.kotlin.compose) apply false
|
alias(libs.plugins.kotlin.compose) apply false
|
||||||
|
alias(libs.plugins.kotlin.multiplatform) apply false
|
||||||
|
alias(libs.plugins.android.kotlin.multiplatform.library) apply false
|
||||||
|
alias(libs.plugins.android.lint) apply false
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "8.12.1"
|
agp = "8.12.2"
|
||||||
kotlin = "2.0.21"
|
kotlin = "2.0.21"
|
||||||
coreKtx = "1.16.0"
|
coreKtx = "1.16.0"
|
||||||
junit = "4.13.2"
|
junit = "4.13.2"
|
||||||
@@ -8,6 +8,10 @@ espressoCore = "3.7.0"
|
|||||||
lifecycleRuntimeKtx = "2.9.2"
|
lifecycleRuntimeKtx = "2.9.2"
|
||||||
activityCompose = "1.10.1"
|
activityCompose = "1.10.1"
|
||||||
composeBom = "2024.09.00"
|
composeBom = "2024.09.00"
|
||||||
|
kotlinStdlib = "2.0.21"
|
||||||
|
kotlinTest = "2.0.21"
|
||||||
|
runner = "1.5.2"
|
||||||
|
core = "1.5.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
@@ -24,9 +28,16 @@ androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-toolin
|
|||||||
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
||||||
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
||||||
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
|
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||||
|
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlinStdlib" }
|
||||||
|
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlinTest" }
|
||||||
|
androidx-runner = { group = "androidx.test", name = "runner", version.ref = "runner" }
|
||||||
|
androidx-core = { group = "androidx.test", name = "core", version.ref = "core" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
android-application = { id = "com.android.application", version.ref = "agp" }
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||||
|
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
||||||
|
android-kotlin-multiplatform-library = { id = "com.android.kotlin.multiplatform.library", version.ref = "agp" }
|
||||||
|
android-lint = { id = "com.android.lint", version.ref = "agp" }
|
||||||
|
|
||||||
|
|||||||
@@ -21,4 +21,4 @@ dependencyResolutionManagement {
|
|||||||
|
|
||||||
rootProject.name = "Klottr"
|
rootProject.name = "Klottr"
|
||||||
include(":app")
|
include(":app")
|
||||||
|
include(":shared")
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ kotlin {
|
|||||||
// See: https://kotlinlang.org/docs/multiplatform-discover-project.html#targets
|
// See: https://kotlinlang.org/docs/multiplatform-discover-project.html#targets
|
||||||
androidLibrary {
|
androidLibrary {
|
||||||
namespace = "app.klottr.shared"
|
namespace = "app.klottr.shared"
|
||||||
compileSdk = 36
|
compileSdk = 35
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
|
|
||||||
withHostTestBuilder {
|
withHostTestBuilder {
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
|
package app.klottr.shared
|
||||||
|
|
||||||
class SharedPing {
|
class SharedPing {
|
||||||
|
fun ping(): String = "shared-ok"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user