Files
Incido/core/settings/build.gradle.kts
T
Incido Developer 8db835640e feat(phase-1/m3.1): :core:settings — SettingsRepository shared, store injected
Milestone M3 task 1 (DESKTOP_PHASE_PLAN §5): move UserSettings +
SettingsRepository into a plain kotlin("jvm") module so the desktop
build reads/writes the SAME preferences keys and .preferences_pb format
the phone uses. Package name org.incido.compose.data.settings kept, so
the Android diff is file moves + one constructor change.

Seam: SettingsRepository now takes an injected DataStore<Preferences>.
Android supplies the preferencesDataStore(name = "incido_settings")
Context-extension store (new AndroidSettingsStore.kt, moved verbatim);
desktop builds it with PreferenceDataStoreFactory.create(
corruptionHandler = ReplaceFileCorruptionHandler, produceFile) — the
Phase-0 API delta (no Context extension on the multiplatform core
artifact). snapshot() keeps runBlocking for startup-only use.

DesktopContainer grows settingsRepository first, mirroring AppContainer
construction order ahead of M3's cipher install. dynamic_color /
use_biometric / block_screenshots keys ride along but have no desktop
UI — hidden, not faked (M3 exit rule).

Verified: ./gradlew assembleDebug (green; :app needed :core:settings on
its classpath — MainActivity reads userSettingsFlow, same pattern as
:core:domain) + ./gradlew :desktopApp:run --args="--data-dir
/tmp/incido-desktop-smoke --self-test --exit-after 6" (RENDER/SELFTEST
sequence intact) + ./gradlew :core:data-jvm:smoke (green).
2026-10-06 06:20:13 +13:00

34 lines
1.3 KiB
Kotlin

// core/settings — Phase 1 (M3 task 1): user settings, extracted from
// :composeApp so the desktop build reads and writes the SAME preferences
// file format the phone uses (`.preferences_pb`, identical keys).
//
// Shape follows :core:backup: plain kotlin("jvm"), package names kept at
// org.incido.compose.data.settings so the Android diff is file moves only.
// The one API change: SettingsRepository takes an injected
// DataStore<Preferences> instead of a Context — Android supplies the
// `preferencesDataStore(name = …)` Context-extension store, desktop builds
// one with PreferenceDataStoreFactory.create(produceFile = …) (the spike
// finding: the multiplatform core artifact has no Context extension).
plugins {
alias(libs.plugins.kotlinJvm)
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(17)
}
dependencies {
// Public API (constructor + flow types) exposes DataStore<Preferences> —
// api, not impl. On the Android classpath this resolves to the same
// android variant :composeApp's datastore-preferences already pulls, so
// there is no duplicate-class situation.
api(libs.androidx.datastore.preferences.core)
implementation(libs.kotlinx.coroutines.core)
}