new: persist preferences across sessions
This commit is contained in:
@@ -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