Skip to content

armgit / ente

Public Imported from GitHub
0

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

Throw when folder mapping is missing for skip toast

ashilknd2e31c6650ad
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
index 9e1abf5db8..2e8ea25cdf 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/file_selection_actions_widget.dart
@@ -1106,10 +1106,7 @@ class _FileSelectionActionsWidgetState
final l10n = AppLocalizations.of(context);
final existingLocalFolderNames = await Future.wait(
files.map(
- (file) => getExistingLocalFolderNameForDownloadSkipToast(
- file,
- fallbackFolderName: l10n.gallery,
- ),
+ (file) => getExistingLocalFolderNameForDownloadSkipToast(file),
),
);
diff --git a/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart
index 7689e4433e..9ea7f716d3 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/file_app_bar.dart
@@ -620,10 +620,7 @@ class FileAppBarState extends State<FileAppBar> {
Future<void> _download(EnteFile file) async {
final existingFolderName =
- await getExistingLocalFolderNameForDownloadSkipToast(
- file,
- fallbackFolderName: AppLocalizations.of(context).gallery,
- );
+ await getExistingLocalFolderNameForDownloadSkipToast(file);
if (existingFolderName != null) {
if (mounted) {
final l10n = AppLocalizations.of(context);
diff --git a/mobile/apps/photos/lib/utils/download_skip_toast_util.dart b/mobile/apps/photos/lib/utils/download_skip_toast_util.dart
index 60888f34c3..469cbc17ba 100644
--- a/mobile/apps/photos/lib/utils/download_skip_toast_util.dart
+++ b/mobile/apps/photos/lib/utils/download_skip_toast_util.dart
@@ -16,9 +16,8 @@ String getDownloadSkipToastFileName(
}
Future<String?> getExistingLocalFolderNameForDownloadSkipToast(
- EnteFile file, {
- required String fallbackFolderName,
-}) async {
+ EnteFile file,
+) async {
if (file.localID == null) {
return null;
}
@@ -31,5 +30,8 @@ Future<String?> getExistingLocalFolderNameForDownloadSkipToast(
if (folderNames.isNotEmpty) {
return folderNames.last;
}
- return fallbackFolderName;
+ throw StateError(
+ "Expected non-empty device collection name for localID=${file.localID}, "
+ "but found none.",
+ );
}