Skip to content

General: Improve settings storage reliability#422

Merged
d4rken merged 3 commits intomainfrom
refactor/migrate-preferences-to-datastore
Mar 4, 2026
Merged

General: Improve settings storage reliability#422
d4rken merged 3 commits intomainfrom
refactor/migrate-preferences-to-datastore

Conversation

@d4rken
Copy link
Copy Markdown
Member

@d4rken d4rken commented Mar 2, 2026

What changed

No user-facing behavior change. Migrated all preference storage from SharedPreferences to AndroidX DataStore. Existing user settings are preserved automatically during the migration.

Technical Context

  • Replaced FlowPreference<T> (SharedPreferences wrapper) with DataStoreValue<T> (AndroidX DataStore) across all 5 Settings classes and 2 cache classes
  • Switched serialization from Moshi to kotlinx-serialization; existing user data is preserved via SharedPreferencesMigration
  • Added custom serializers for byte arrays (Base64) and instants (epoch millis)
  • Deleted dead code: FlowPreference, PreferenceStoreMapper, Settings base class, and related test utilities
  • Added 37 unit tests covering DataStore value operations, serialization round-trips, and migration format compatibility

@d4rken d4rken added the enhancement Add a new feature of improve an existing feature label Mar 2, 2026
@d4rken d4rken marked this pull request as draft March 2, 2026 07:01
@d4rken d4rken added the changelog-ignore Exclude from auto-generated release notes label Mar 3, 2026
@d4rken d4rken changed the title refactor(settings): Migrate preferences to AndroidX DataStore General: Improve settings storage reliability Mar 3, 2026
@d4rken d4rken removed the changelog-ignore Exclude from auto-generated release notes label Mar 3, 2026
…aStore

Replace FlowPreference<T> wrapping SharedPreferences with DataStoreValue<T> wrapping AndroidX DataStore. Includes SharedPreferencesMigration for preserving existing user data, kotlinx-serialization for complex types (replacing Moshi for preferences), and comprehensive unit tests for the new infrastructure.
@d4rken d4rken force-pushed the refactor/migrate-preferences-to-datastore branch from 53cb95c to a0d23cb Compare March 4, 2026 10:41
@d4rken d4rken marked this pull request as ready for review March 4, 2026 12:53
d4rken added 2 commits March 4, 2026 15:41
…pat tests

Cover round-trip tests for ThemeStyle, ThemeColor, MonitorMode, ScannerMode, AutoConnectCondition, FossUpgrade, and InstantEpochMillisSerializer. Add Moshi decode tests for ThemeStyle, ThemeColor, AutoConnectCondition, FossUpgrade, and FossUpgrade.Reason annotation parity.
…mpat

FossUpgrade is foss-flavor-only, so tests referencing it must live in testFoss/ to avoid compilation failures in testGplayDebugUnitTest.
@d4rken d4rken merged commit 1a19668 into main Mar 4, 2026
9 checks passed
@d4rken d4rken deleted the refactor/migrate-preferences-to-datastore branch March 4, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Add a new feature of improve an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant