Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] keep cleanup feedback visible

r4khul9ca5e476edcf
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index 00a8668952..b52333e695 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -26,6 +26,7 @@ import "package:photos/models/metadata/common_keys.dart";
import 'package:photos/models/selected_files.dart';
import 'package:photos/module/download/gallery.dart';
import 'package:photos/service_locator.dart';
+import 'package:photos/services/app_navigation_service.dart';
import 'package:photos/services/collections_service.dart';
import "package:photos/services/files_service.dart";
import "package:photos/services/review_service.dart";
@@ -1086,37 +1087,38 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
Future<void> onCleanUncategorizedClick(BuildContext buildContext) async {
var cleanupResult = (uncategorizedFilesCount: 0, removedFilesCount: 0);
+ final strings = context.strings;
final actionResult = await showChoiceActionSheet(
context,
isCritical: true,
- title: context.strings.cleanUncategorized,
- firstButtonLabel: context.strings.confirm,
- body: context.strings.cleanUncategorizedDescription,
+ title: strings.cleanUncategorized,
+ firstButtonLabel: strings.confirm,
+ body: strings.cleanUncategorizedDescription,
firstButtonOnTap: () async {
cleanupResult = await collectionActions
.removeFromUncatIfPresentInOtherAlbum(widget.collection!, context);
},
);
- if (actionResult?.action != null && mounted) {
- if (actionResult!.action == ButtonAction.first) {
- if (!buildContext.mounted) return;
- showShortToast(
- buildContext,
- cleanupResult.removedFilesCount > 0
- ? buildContext.strings.cleanedUncategorizedItems(
- count: cleanupResult.removedFilesCount,
- )
- : cleanupResult.uncategorizedFilesCount == 0
- ? buildContext.strings.uncategorizedIsClean
- : buildContext.strings.nothingToCleanUpInUncategorized,
- );
- } else if (actionResult.action == ButtonAction.error) {
- if (!buildContext.mounted) return;
- await showGenericErrorDialog(
- context: buildContext,
- error: actionResult.exception,
- );
- }
+ if (actionResult?.action == ButtonAction.first) {
+ final toastContext =
+ AppNavigationService.instance.navigatorKey.currentContext;
+ if (toastContext == null || !toastContext.mounted) return;
+ showShortToast(
+ toastContext,
+ cleanupResult.removedFilesCount > 0
+ ? strings.cleanedUncategorizedItems(
+ count: cleanupResult.removedFilesCount,
+ )
+ : cleanupResult.uncategorizedFilesCount == 0
+ ? strings.uncategorizedIsClean
+ : strings.nothingToCleanUpInUncategorized,
+ );
+ } else if (actionResult?.action == ButtonAction.error) {
+ if (!buildContext.mounted) return;
+ await showGenericErrorDialog(
+ context: buildContext,
+ error: actionResult?.exception,
+ );
}
}
diff --git a/mobile/packages/strings/lib/l10n/arb/strings_en.arb b/mobile/packages/strings/lib/l10n/arb/strings_en.arb
index 59e4617566..9207de08e1 100644
--- a/mobile/packages/strings/lib/l10n/arb/strings_en.arb
+++ b/mobile/packages/strings/lib/l10n/arb/strings_en.arb
@@ -654,7 +654,7 @@
},
"cleanUncategorized": "Clean Uncategorized",
"cleanUncategorizedDescription": "Remove all files from Uncategorized that are present in other albums",
- "cleanedUncategorizedItems": "{count, plural, one{Cleaned {count} item.} other{Cleaned {count} items.}}",
+ "cleanedUncategorizedItems": "{count, plural, one{Removed {count} item} other{Removed {count} items}}",
"@cleanedUncategorizedItems": {
"placeholders": {
"count": {
@@ -2906,7 +2906,7 @@
}
},
"nothingToSeeHere": "Nothing to see here",
- "nothingToCleanUpInUncategorized": "Nothing to clean up. These files are not in your other albums.",
+ "nothingToCleanUpInUncategorized": "Nothing to clean up because no items are in your other albums",
"nothingToTidyUpHere": "Nothing to tidy up here",
"notifications": "Notifications",
"notifyMe": "Notify me",