Skip to content

Commit

Permalink
Enabled backup and restore feature for Android #90 #250
Browse files Browse the repository at this point in the history
  • Loading branch information
anandnet committed Aug 22, 2024
1 parent b649da0 commit 9665de4
Show file tree
Hide file tree
Showing 6 changed files with 344 additions and 158 deletions.
50 changes: 24 additions & 26 deletions lib/ui/screens/Settings/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -449,34 +449,32 @@ class SettingsScreen extends StatelessWidget {
onChanged:
settingsController.toggleStopPlyabackOnSwipeAway),
)),
if (GetPlatform.isWindows)
ListTile(
contentPadding: const EdgeInsets.only(left: 5, right: 10),
title: Text("backupSettingsAndPlaylists".tr),
subtitle: Text(
"backupSettingsAndPlaylistsDes".tr,
style: Theme.of(context).textTheme.bodyMedium,
),
isThreeLine: true,
onTap: () => showDialog(
context: context,
builder: (context) => const BackupDialog(),
).whenComplete(() => Get.delete<BackupDialogController>()),
ListTile(
contentPadding: const EdgeInsets.only(left: 5, right: 10),
title: Text("backupSettingsAndPlaylists".tr),
subtitle: Text(
"backupSettingsAndPlaylistsDes".tr,
style: Theme.of(context).textTheme.bodyMedium,
),
if (GetPlatform.isWindows)
ListTile(
contentPadding: const EdgeInsets.only(left: 5, right: 10),
title: Text("restoreSettingsAndPlaylists".tr),
subtitle: Text(
"restoreSettingsAndPlaylistsDes".tr,
style: Theme.of(context).textTheme.bodyMedium,
),
isThreeLine: true,
onTap: () => showDialog(
context: context,
builder: (context) => const RestoreDialog(),
).whenComplete(() => Get.delete<RestoreDialogController>()),
isThreeLine: true,
onTap: () => showDialog(
context: context,
builder: (context) => const BackupDialog(),
).whenComplete(() => Get.delete<BackupDialogController>()),
),
ListTile(
contentPadding: const EdgeInsets.only(left: 5, right: 10),
title: Text("restoreSettingsAndPlaylists".tr),
subtitle: Text(
"restoreSettingsAndPlaylistsDes".tr,
style: Theme.of(context).textTheme.bodyMedium,
),
isThreeLine: true,
onTap: () => showDialog(
context: context,
builder: (context) => const RestoreDialog(),
).whenComplete(() => Get.delete<RestoreDialogController>()),
),
GetPlatform.isAndroid
? Obx(
() => ListTile(
Expand Down
9 changes: 9 additions & 0 deletions lib/ui/screens/Settings/settings_screen_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,13 @@ class SettingsScreenController extends GetxController {
Future<void> closeAllDatabases() async {
await Hive.close();
}

Future<String> get dbDir async {
if (GetPlatform.isDesktop) {
return "$supportDirPath/db";
} else {
return (await getApplicationDocumentsDirectory()).path;
}
}

}
Loading

0 comments on commit 9665de4

Please sign in to comment.