Skip to content

Commit

Permalink
No need to migrate if core palette is null
Browse files Browse the repository at this point in the history
  • Loading branch information
veloce committed Dec 19, 2024
1 parent 74d5575 commit 341755c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/src/init.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ Future<void> setupFirstLaunch() async {
}

Future<void> _migrateThemeSettings() async {
if (getCorePalette() == null) {
return;
}
final prefs = LichessBinding.instance.sharedPreferences;
try {
final stored = LichessBinding.instance.sharedPreferences.getString(
Expand All @@ -67,9 +70,7 @@ Future<void> _migrateThemeSettings() async {
final migrated = generalPrefs.copyWith(
appThemeSeed:
// ignore: deprecated_member_use_from_same_package
getCorePalette() != null && generalPrefs.systemColors == true
? AppThemeSeed.system
: AppThemeSeed.board,
generalPrefs.systemColors == true ? AppThemeSeed.system : AppThemeSeed.board,
);
await prefs.setString(PrefCategory.general.storageKey, jsonEncode(migrated.toJson()));
} catch (e) {
Expand Down

0 comments on commit 341755c

Please sign in to comment.