Replaced 'Empty trash' dialog with the new one
This commit is contained in:
parent
d42d024d30
commit
74fc160d24
1 changed files with 18 additions and 18 deletions
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue