π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Skip localID update for already-local downloads
ashilknaa06056fa2c1
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.dartindex 1c457e8042..4439c95e98 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@@ -670,6 +670,9 @@ class FileAppBarState extends State<FileAppBar> {if (file.localID == null || file.localID!.isEmpty) {return null;}+ if (file.isSharedMediaToAppSandbox) {+ return null;+ }final asset = await file.getAsset;if (asset == null || !(await asset.exists)) {diff --git a/mobile/apps/photos/lib/utils/file_download_util.dart b/mobile/apps/photos/lib/utils/file_download_util.dartindex 41dbac9587..c25ebff1fb 100644--- a/mobile/apps/photos/lib/utils/file_download_util.dart+++ b/mobile/apps/photos/lib/utils/file_download_util.dart@@ -221,6 +221,8 @@ Future<void> downloadToGallery(EnteFile file) async {final FileType type = file.fileType;final bool downloadLivePhotoOnDroid =type == FileType.livePhoto && Platform.isAndroid;+ final bool shouldUpdateLocalIDReference =+ file.isRemoteFile || file.isSharedMediaToAppSandbox;AssetEntity? savedAsset;final File? fileToSave = await getFile(file);// We use a lock to prevent synchronisation to occur while it is downloading@@ -254,14 +256,20 @@ Future<void> downloadToGallery(EnteFile file) async {}if (savedAsset != null) {- file.localID = savedAsset!.id;- await FilesDB.instance.insert(file);- Bus.instance.fire(- LocalPhotosUpdatedEvent(- [file],- source: "download",- ),- );+ if (shouldUpdateLocalIDReference) {+ file.localID = savedAsset!.id;+ await FilesDB.instance.insert(file);+ Bus.instance.fire(+ LocalPhotosUpdatedEvent(+ [file],+ source: "download",+ ),+ );+ } else {+ _logger.info(+ 'Skipping localID update after download; existing localID is already a gallery asset',+ );+ }} else if (!downloadLivePhotoOnDroid && savedAsset == null) {_logger.severe('Failed to save assert of type $type');}