Add options to settings backup.

This commit is contained in:
stonega 2021-01-24 22:49:58 +08:00
parent 65769a2ec7
commit 566ae0914f
2 changed files with 18 additions and 4 deletions

View File

@ -558,6 +558,8 @@ class SettingState extends ChangeNotifier {
.getBool(defaultValue: false);
final deleteAfterPlayed = await KeyValueStorage(deleteAfterPlayedKey)
.getBool(defaultValue: false);
final openPlaylistDefault = await _openPlaylistDefaultStorage.getBool(defaultValue: false);
final openAllPodcastDefault = await _openAllPodcastDefaultStorage.getBool(defaultValue: false);
return SettingsBackup(
theme: theme,
@ -591,7 +593,9 @@ class SettingState extends ChangeNotifier {
speedList: speedList,
hidePodcastDiscovery: hidePodcastDiscovery,
markListenedAfterSkip: markListenedAfterSKip,
deleteAfterPlayed: deleteAfterPlayed);
deleteAfterPlayed: deleteAfterPlayed,
openPlaylistDefault: openPlaylistDefault,
openAllPodcastDefault: openAllPodcastDefault);
}
Future<void> restore(SettingsBackup backup) async {
@ -631,6 +635,8 @@ class SettingState extends ChangeNotifier {
.saveBool(backup.markListenedAfterSkip);
await KeyValueStorage(deleteAfterPlayedKey)
.saveBool(backup.deleteAfterPlayed);
await _openPlaylistDefaultStorage.saveBool(backup.openPlaylistDefault);
await _openAllPodcastDefaultStorage.saveBool(backup.openAllPodcastDefault);
if (backup.locale == '') {
await _localeStorage.saveStringList([]);

View File

@ -31,6 +31,8 @@ class SettingsBackup {
final bool hidePodcastDiscovery;
final bool markListenedAfterSkip;
final bool deleteAfterPlayed;
final bool openPlaylistDefault;
final bool openAllPodcastDefault;
SettingsBackup(
{this.theme,
@ -64,7 +66,9 @@ class SettingsBackup {
this.speedList,
this.hidePodcastDiscovery,
this.markListenedAfterSkip,
this.deleteAfterPlayed});
this.deleteAfterPlayed,
this.openPlaylistDefault,
this.openAllPodcastDefault});
Map<String, Object> toJson() {
return {
@ -98,7 +102,9 @@ class SettingsBackup {
'speedList': speedList,
'hidePodcastDiscovery': hidePodcastDiscovery,
'markListenedAfterSkip': markListenedAfterSkip,
'deleteAfterPlayed': deleteAfterPlayed
'deleteAfterPlayed': deleteAfterPlayed,
'openPlaylistDefault': openPlaylistDefault,
'openAllPodcastDefault': openAllPodcastDefault
};
}
@ -136,6 +142,8 @@ class SettingsBackup {
speedList: speedList,
hidePodcastDiscovery: json['hidePodcastDiscovery'] as bool,
markListenedAfterSkip: json['markListenedAfterSkip'] as bool,
deleteAfterPlayed: json['deleteAfterPlayed'] as bool);
deleteAfterPlayed: json['deleteAfterPlayed'] as bool,
openPlaylistDefault: json['openPlaylistDefaullt'] as bool,
openAllPodcastDefault: json['openAllPodcastDefault'] as bool);
}
}