Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
AhsanSarwar45 committed Mar 27, 2024
1 parent b0f607e commit 621bdf5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/settings/logic/initialize_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Future<void> initializeStorage() async {

// Used to clear the preferences in case of a change in format of the data
// Comment this out after the preferences are cleared
// if (kDebugMode) await _clearSettings();
if (kDebugMode) await _clearSettings();

bool? firstLaunch = GetStorage().read('first_launch');
if (firstLaunch == null) {
Expand Down
27 changes: 13 additions & 14 deletions lib/settings/types/setting_group.dart
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class SettingGroup extends SettingItem {
@override
void loadValueFromJson(dynamic value) {
if (value == null) return;
// if (_version != null && value["version"] != _version) {
if (_version != null && value["version"] != _version) {
//TODO: Add migration code

//In case of name change:
Expand All @@ -196,22 +196,21 @@ class SettingGroup extends SettingItem {

//Incase of removal
//value.remove("Old Setting");
print("$name: $value");

// if (name == "AlarmSettings") {
if (name == "AlarmSettings") {
// if (value["version"] == 1) {
// final old1 = value["Snooze"]["Prevent Disabling while Snoozed"];
// final old2 = value["Snooze"]["Prevent Deleting while Snoozed"];
// if (old1) {
// value["Snooze"]["While Snoozed"]["Prevent Disabling"] = old1;
// }
// if (old2) value["Snooze"]["While Snoozed"]["Prevent Deletion"] = old2;
final old1 = value["Snooze"]["Prevent Disabling while Snoozed"];
final old2 = value["Snooze"]["Prevent Deleting while Snoozed"];
if (old1) {
value["Snooze"]["While Snoozed"]["Prevent Disabling"] = old1;
}
if (old2) value["Snooze"]["While Snoozed"]["Prevent Deletion"] = old2;
// }
// }
// }
// for (var setting in _settingItems) {
// if (value != null) setting.loadValueFromJson(value[setting.name]);
// }
}
}
for (var setting in _settingItems) {
if (value != null) setting.loadValueFromJson(value[setting.name]);
}
}

Future<void> save() {
Expand Down

0 comments on commit 621bdf5

Please sign in to comment.