π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Use server source for download-to-gallery
ashilkn5c483db96910
diff --git a/mobile/apps/photos/lib/utils/file_download_util.dart b/mobile/apps/photos/lib/utils/file_download_util.dartindex 32ab24b0a8..122065a067 100644--- a/mobile/apps/photos/lib/utils/file_download_util.dart+++ b/mobile/apps/photos/lib/utils/file_download_util.dart@@ -224,7 +224,10 @@ Future<void> downloadToGallery(EnteFile file) async {final bool shouldUpdateLocalIDReference =file.isRemoteFile || file.isSharedMediaToAppSandbox;AssetEntity? savedAsset;- final File? fileToSave = await getFile(file);+ final File? downloadedFile = await getFileFromServer(file);+ if (downloadedFile == null) {+ throw Exception("Failed to download file");+ }// We use a lock to prevent synchronisation to occur while it is downloading// as this introduces wrong entry in FilesDB due to race condition// This is a fix for https://github.com/ente-io/ente/issues/4296@@ -234,10 +237,12 @@ Future<void> downloadToGallery(EnteFile file) async {await PhotoManager.stopChangeNotify();if (type == FileType.image) {savedAsset = await PhotoManager.editor- .saveImageWithPath(fileToSave!.path, title: file.title!);+ .saveImageWithPath(downloadedFile.path, title: file.title!);} else if (type == FileType.video) {- savedAsset = await PhotoManager.editor- .saveVideo(fileToSave!, title: file.title!);+ savedAsset = await PhotoManager.editor.saveVideo(+ downloadedFile,+ title: file.title!,+ );} else if (type == FileType.livePhoto) {final File? liveVideoFile =await getFileFromServer(file, liveVideo: true);@@ -245,10 +250,10 @@ Future<void> downloadToGallery(EnteFile file) async {throw AssertionError("Live video can not be null");}if (downloadLivePhotoOnDroid) {- await _saveLivePhotoOnDroid(fileToSave!, liveVideoFile, file);+ await _saveLivePhotoOnDroid(downloadedFile, liveVideoFile, file);} else {savedAsset = await PhotoManager.editor.darwin.saveLivePhoto(- imageFile: fileToSave!,+ imageFile: downloadedFile,videoFile: liveVideoFile,title: file.title!,);