Skip to content

armgit / ente

Public Imported from GitHub
0

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

Revert "Hide local download location when unknown"

ashilkn66ddaff18b7d
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index c4b77c8ee1..43845c0261 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -1004,7 +1004,6 @@
}
}
},
- "alreadyAvailableOnDeviceBodyUnknown": "This file is already on your device. Download it again?",
"downloadAnyway": "Download anyway",
"pressAndHoldToPlayVideo": "Press and hold to play video",
"pressAndHoldToPlayVideoDetailed": "Press and hold on the image to play video",
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 1c457e8042..f90d9aeeb0 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
@@ -621,21 +621,18 @@ class FileAppBarState extends State<FileAppBar> {
Future<void> _download(EnteFile file) async {
final l10n = context.l10n;
final String? localFileLocationName =
- await _getExistingLocalFileLocation(file);
+ await _getExistingLocalFileLocation(file, l10n);
if (localFileLocationName != null && mounted) {
- final hasKnownLocation = localFileLocationName.trim().isNotEmpty;
final actionResult = await showChoiceActionSheet(
context,
title: l10n.alreadyAvailableOnDeviceTitle,
- body: hasKnownLocation
- ? (Platform.isAndroid
- ? l10n.alreadyAvailableOnDeviceBodyAndroid(
- folderName: localFileLocationName,
- )
- : l10n.alreadyAvailableOnDeviceBodyIOS(
- albumName: localFileLocationName,
- ))
- : l10n.alreadyAvailableOnDeviceBodyUnknown,
+ body: Platform.isAndroid
+ ? l10n.alreadyAvailableOnDeviceBodyAndroid(
+ folderName: localFileLocationName,
+ )
+ : l10n.alreadyAvailableOnDeviceBodyIOS(
+ albumName: localFileLocationName,
+ ),
firstButtonLabel: l10n.downloadAnyway,
secondButtonLabel: l10n.cancel,
);
@@ -666,6 +663,7 @@ class FileAppBarState extends State<FileAppBar> {
Future<String?> _getExistingLocalFileLocation(
EnteFile file,
+ AppLocalizations l10n,
) async {
if (file.localID == null || file.localID!.isEmpty) {
return null;
@@ -681,22 +679,23 @@ class FileAppBarState extends State<FileAppBar> {
final String deviceFolder = (file.deviceFolder ?? "").trim();
if (Platform.isAndroid) {
+ final String folderName;
if (relativePath.isNotEmpty) {
- return _getLastPathSegment(relativePath);
- }
- if (deviceFolder.isNotEmpty) {
- return _getLastPathSegment(deviceFolder);
+ folderName = _getLastPathSegment(relativePath);
+ } else if (deviceFolder.isNotEmpty) {
+ folderName = _getLastPathSegment(deviceFolder);
+ } else {
+ folderName = l10n.recent;
}
- return "";
+ return folderName;
}
- if (deviceFolder.isNotEmpty) {
- return _getLastPathSegment(deviceFolder);
- }
- if (relativePath.isNotEmpty) {
- return _getLastPathSegment(relativePath);
- }
- return "";
+ final String albumSource = deviceFolder.isNotEmpty
+ ? _getLastPathSegment(deviceFolder)
+ : relativePath.isNotEmpty
+ ? _getLastPathSegment(relativePath)
+ : l10n.recent;
+ return albumSource;
}
String _getLastPathSegment(String path) {