Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Fix single file delete route pop ordering

ashilknbbd063c5be7c
diff --git a/mobile/apps/photos/lib/ui/actions/file/file_actions.dart b/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
index a5e6c7de26..4cbf8f0c5b 100644
--- a/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
+++ b/mobile/apps/photos/lib/ui/actions/file/file_actions.dart
@@ -119,10 +119,8 @@ Future<void> showSingleFileDeleteSheet(
onTap: () => _runSingleFileDeleteAction(
sheetContext,
ButtonAction.third,
- () async {
- await deleteFilesFromEverywhere(context, [file]);
- onFileRemoved?.call(file);
- },
+ () => deleteFilesFromEverywhere(context, [file]),
+ afterPop: () => onFileRemoved?.call(file),
),
),
],
@@ -140,12 +138,14 @@ Future<void> showSingleFileDeleteSheet(
Future<void> _runSingleFileDeleteAction(
BuildContext context,
ButtonAction action,
- Future<void> Function() onDelete,
-) async {
+ Future<void> Function() onDelete, {
+ FutureOr<void> Function()? afterPop,
+}) async {
try {
await onDelete();
if (context.mounted) {
Navigator.of(context).pop(ButtonResult(action));
+ await afterPop?.call();
}
} catch (error) {
if (context.mounted) {