refactor: add prefix to distinguish int value

This commit is contained in:
Rongjian Zhang
2021-02-14 10:27:34 +08:00
parent 717b7cd336
commit 6fe2a6541c
5 changed files with 10 additions and 9 deletions

View File

@@ -631,12 +631,13 @@ class AuthModel with ChangeNotifier {
_accounts = (json.decode(str ?? '[]') as List)
.map((item) => Account.fromJson(item))
.toList();
activeAccountIndex = prefs.getInt(StorageKeys.defaultAccount);
activeAccountIndex = prefs.getInt(StorageKeys.iDefaultAccount);
if (activeAccount != null)
if (activeAccount != null) {
_activeTab = prefs.getInt(
StorageKeys.getDefaultStartTabKey(activeAccount.platform)) ??
0;
}
} catch (err) {
Fimber.e('prefs getAccount failed', ex: err);
_accounts = [];
@@ -653,7 +654,7 @@ class AuthModel with ChangeNotifier {
Future<void> setDefaultAccount(int v) async {
final prefs = await SharedPreferences.getInstance();
await prefs.setInt(StorageKeys.defaultAccount, v);
await prefs.setInt(StorageKeys.iDefaultAccount, v);
Fimber.d('write default account: $v');
notifyListeners();
}

View File

@@ -175,7 +175,7 @@ class ThemeModel with ChangeNotifier {
Future<void> setMarkdown(int v) async {
_markdown = v;
final prefs = await SharedPreferences.getInstance();
await prefs.setInt(StorageKeys.markdown, v);
await prefs.setInt(StorageKeys.iMarkdown, v);
Fimber.d('write markdown engine: $v');
notifyListeners();
}
@@ -245,7 +245,7 @@ class ThemeModel with ChangeNotifier {
if (AppBrightnessType.values.contains(b)) {
_brightnessValue = b;
}
final m = prefs.getInt(StorageKeys.markdown);
final m = prefs.getInt(StorageKeys.iMarkdown);
if (AppMarkdownType.values.contains(m)) {
_markdown = m;
}