Skip to content

armgit / ente

Public Imported from GitHub
0

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

Merge remote-tracking branch 'origin/main' into aman/mobile-flutter-347

AmanRajSinghMouryabd6f511a6a30
diff --cc mobile/apps/photos/lib/module/download/file.dart
index afa28bbc68,b5badaa1b2..85f379ff8f
--- a/mobile/apps/photos/lib/module/download/file.dart
+++ b/mobile/apps/photos/lib/module/download/file.dart
@@@ -178,37 -178,38 +178,33 @@@ Future<File?> getFileFromServer
_progressCallbacks[downloadID] = progressCallback;
}
- final download = _runOncePerKey(
- _fileDownloadsInProgress,
- downloadID,
- () {
- Future<File?> downloadFuture;
- if (file.fileType == FileType.livePhoto) {
- downloadFuture = _getLivePhotoFromServer(
- file,
- progressCallback: (count, total) {
- _progressCallbacks[downloadID]?.call(count, total);
- },
- needLiveVideo: liveVideo,
- forGalleryDownload: forGalleryDownload,
- );
- } else {
- downloadFuture = _downloadAndCache(
- file,
- cacheManager,
- progressCallback: (count, total) {
- _progressCallbacks[downloadID]?.call(count, total);
- },
- forGalleryDownload: forGalleryDownload,
- );
- }
- return downloadFuture;
- },
- onComplete: () => _progressCallbacks.remove(downloadID),
- );
+ final download = _runOncePerKey(_fileDownloadsInProgress, downloadID, () {
+ Future<File?> downloadFuture;
+ if (file.fileType == FileType.livePhoto) {
+ downloadFuture = _getLivePhotoFromServer(
+ file,
+ progressCallback: (count, total) {
+ _progressCallbacks[downloadID]?.call(count, total);
+ },
+ needLiveVideo: liveVideo,
+ forGalleryDownload: forGalleryDownload,
+ );
+ } else {
+ downloadFuture = _downloadAndCache(
+ file,
+ cacheManager,
+ progressCallback: (count, total) {
+ _progressCallbacks[downloadID]?.call(count, total);
+ },
+ forGalleryDownload: forGalleryDownload,
+ );
+ }
+ return downloadFuture;
+ }, onComplete: () => _progressCallbacks.remove(downloadID));
- try {
- return await download;
- } on DownloadDecryptionError {
- if (forGalleryDownload || throwOnDecryptionFailure) {
- rethrow;
- }
- return null;
- }
+ return handleDownloadDecryptionFailureForCaller(
+ download,
+ rethrowDecryptionFailure: forGalleryDownload || throwOnDecryptionFailure,
+ );
}
Future<bool> isFileCached(EnteFile file, {bool liveVideo = false}) async {