Migrate local persistence from Room to SQLDelight with multiplatform support (Android+iOS); replace NoteEntity/DAO/Repository with generated SQLDelight schema, add DatabaseFactory for drivers, integrate Flow support for Compose UI updates
This commit is contained in:
@@ -22,6 +22,7 @@ plugins {
|
||||
id("com.codingfeline.buildkonfig") version "0.17.1"
|
||||
|
||||
kotlin("native.cocoapods")
|
||||
id("app.cash.sqldelight") version "2.1.0"
|
||||
}
|
||||
|
||||
kotlin {
|
||||
@@ -128,6 +129,13 @@ kotlin {
|
||||
// Use Ktor-based multiplatform networking backend for Coil
|
||||
implementation("io.coil-kt.coil3:coil-network-ktor3:3.3.0")
|
||||
|
||||
// SQLDelight Coroutines Extensions:
|
||||
// Gör att queries (t.ex. notesQueries.all()) kan exponeras som Flow.
|
||||
// Flow används ihop med Compose för att automatiskt uppdatera UI när DB-data ändras.
|
||||
implementation("app.cash.sqldelight:coroutines-extensions:2.1.0")
|
||||
|
||||
// Kotlinx coroutines-core (krävs för Flow + SQLDelight coroutines-extensions)
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
|
||||
|
||||
|
||||
// för Compose i :shared (Android-del)
|
||||
@@ -165,6 +173,10 @@ kotlin {
|
||||
implementation("androidx.activity:activity-compose:1.11.0")
|
||||
// PickVisualMediaRequest + ActivityResultContracts.*
|
||||
implementation("androidx.activity:activity:1.11.0")
|
||||
// SQLDelight Android-driver
|
||||
implementation("app.cash.sqldelight:android-driver:2.1.0")
|
||||
// SQLDelight coroutine-extensions (JVM/Android)
|
||||
implementation("app.cash.sqldelight:coroutines-extensions:2.1.0")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,4 +240,12 @@ buildkonfig {
|
||||
buildConfigField(BOOLEAN, "KLLOG_DEBUG", propOr("KLLOG_DEBUG", "false"))
|
||||
buildConfigField(BOOLEAN, "KLLOG_HTTP_DEBUG", propOr("KLLOG_HTTP_DEBUG", "false"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sqldelight {
|
||||
databases {
|
||||
create("KlottrDatabase") {
|
||||
packageName.set("app.klottr.db")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user