Added backsupport for old saved themes

This commit is contained in:
M 2020-12-18 21:30:43 +02:00
parent 89c240091b
commit bd2bab997f
2 changed files with 10 additions and 3 deletions

View file

@ -10,6 +10,7 @@ class PreferencesKey {
static const allowBiometricalAuthenticationKey = static const allowBiometricalAuthenticationKey =
'allow_biometrical_authentication'; 'allow_biometrical_authentication';
static const currentTheme = 'current_theme'; static const currentTheme = 'current_theme';
static const isDarkThemeLegacy = 'dark_theme';
static const displayActionListModeKey = 'display_list_mode'; static const displayActionListModeKey = 'display_list_mode';
static const currentPinLength = 'current_pin_length'; static const currentPinLength = 'current_pin_length';
static const currentLanguageCode = 'language_code'; static const currentLanguageCode = 'language_code';

View file

@ -66,8 +66,8 @@ abstract class SettingsStoreBase with Store {
reaction( reaction(
(_) => currentTheme, (_) => currentTheme,
(ThemeBase theme) => sharedPreferences.setInt( (ThemeBase theme) =>
PreferencesKey.currentTheme, theme.raw)); sharedPreferences.setInt(PreferencesKey.currentTheme, theme.raw));
reaction( reaction(
(_) => allowBiometricalAuthentication, (_) => allowBiometricalAuthentication,
@ -152,8 +152,14 @@ abstract class SettingsStoreBase with Store {
final allowBiometricalAuthentication = sharedPreferences final allowBiometricalAuthentication = sharedPreferences
.getBool(PreferencesKey.allowBiometricalAuthenticationKey) ?? .getBool(PreferencesKey.allowBiometricalAuthenticationKey) ??
false; false;
final legacyTheme =
sharedPreferences.getBool(PreferencesKey.isDarkThemeLegacy)
? ThemeType.dark.index
: ThemeType.bright.index;
final savedTheme = ThemeList.deserialize( final savedTheme = ThemeList.deserialize(
raw: sharedPreferences.getInt(PreferencesKey.currentTheme) ?? 0); raw: sharedPreferences.getInt(PreferencesKey.currentTheme) ??
legacyTheme ??
0);
final actionListDisplayMode = ObservableList<ActionListDisplayMode>(); final actionListDisplayMode = ObservableList<ActionListDisplayMode>();
actionListDisplayMode.addAll(deserializeActionlistDisplayModes( actionListDisplayMode.addAll(deserializeActionlistDisplayModes(
sharedPreferences.getInt(PreferencesKey.displayActionListModeKey) ?? sharedPreferences.getInt(PreferencesKey.displayActionListModeKey) ??