Skip to content

Commit

Permalink
wip migration
Browse files Browse the repository at this point in the history
  • Loading branch information
meikpiep committed Feb 25, 2025
1 parent f6b4574 commit da2e6d0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ class ApplicationPreferencesImpl(
preferences.edit { clear() }
}

override fun migrateDifficultySettingIfNecessary() {
if (!preferences.getStringSet("difficulties", null).isNullOrEmpty()) {
return
}

val oldDifficultyValue = preferences.getString("difficulty", null)
/*
* Possible values:
* LIGHT
* DARK
* SYSTEM_DEFAULT
* DYNAMIC_COLORS
*/

// difficultiesSetting = migrateDifficultySetting(oldDifficultyValue)
}

override fun migrateThemeToNightModeIfNecessary() {
if (!preferences.getString("nightMode", null).isNullOrEmpty()) {
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,10 @@ class ApplicationPreferencesImplTest :
OldThemeMigrationTestData("DYNAMIC_COLORS", Theme.DYNAMIC_COLORS, NightMode.LIGHT),
OldThemeMigrationTestData("SYSTEM_DEFAULT", Theme.GAUGUIN, NightMode.SYSTEM_DEFAULT),
) { testData ->
val sharedPreferences =
mockk<SharedPreferences>()

val preferences =
ApplicationPreferencesImpl(
mockk(),
sharedPreferences,
mockk(),
)

val (theme, nightMode) = preferences.migrateToNewThemeNightModesValues(testData.sharedPreferenceValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ interface ApplicationPreferences {
var mergingCageAlgorithm: Boolean

fun migrateThemeToNightModeIfNecessary()

fun migrateDifficultySettingIfNecessary()
}

0 comments on commit da2e6d0

Please sign in to comment.