Replaced 'Empty trash' dialog with the new one

This commit is contained in:
ashilkn 2023-01-09 17:47:16 +05:30
parent d42d024d30
commit 74fc160d24

View file

@ -296,29 +296,29 @@ Future<bool> deleteFromTrash(BuildContext context, List<File> files) async {
}
Future<bool> emptyTrash(BuildContext context) async {
final result = await showChoiceDialog(
final result = await showNewChoiceDialog(
context,
"Empty trash?",
"These files will be permanently removed from your ente account",
firstAction: "Empty",
actionType: ActionType.critical,
title: "Empty trash",
firstButtonLabel: "Empty",
isCritical: true,
firstButtonOnTap: () async {
try {
await TrashSyncService.instance.emptyTrash();
} catch (e, s) {
_logger.info("failed empty trash", e, s);
rethrow;
}
},
);
if (result != DialogUserChoice.firstChoice) {
return false;
}
final dialog = createProgressDialog(context, "Please wait...");
await dialog.show();
try {
await TrashSyncService.instance.emptyTrash();
showShortToast(context, "Trash emptied");
await dialog.hide();
return true;
} catch (e, s) {
_logger.info("failed empty trash", e, s);
await dialog.hide();
if (result == ButtonAction.error) {
await showGenericErrorDialog(context: context);
return false;
}
if (result == null || result == ButtonAction.cancel) {
return false;
} else {
return true;
}
}
Future<bool> deleteLocalFiles(