new: persist preferences across sessions
This commit is contained in:
1 parent
beb1973978
commit
d2283ae347
12 files changed
+212
-24
No files matched your search
@@ -3,7 +3,27 @@ plugins {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
// Adding custom `dependsOn` edges below disables the automatic default hierarchy, so re-apply it
|
||||
// explicitly to keep the standard commonMain/appleMain/iosMain/webMain wiring.
|
||||
applyDefaultHierarchyTemplate()
|
||||
|
||||
androidLibrary {
|
||||
namespace = "fr.ajaury.gwenedeg.preferences"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
// Persistence via DataStore for every target that has an artifact for it (Android, iOS,
|
||||
// Desktop). Web (JS/Wasm) has no DataStore artifact, so it keeps commonMain's in-memory
|
||||
// implementation.
|
||||
val dataStoreMain by creating {
|
||||
dependsOn(commonMain.get())
|
||||
dependencies {
|
||||
implementation(libs.androidx.datastore.preferences.core)
|
||||
implementation(libs.okio)
|
||||
}
|
||||
}
|
||||
androidMain.get().dependsOn(dataStoreMain)
|
||||
jvmMain.get().dependsOn(dataStoreMain)
|
||||
iosMain.get().dependsOn(dataStoreMain)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user