π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Await futures handled by local error paths
AmanRajSinghMouryaa67bbc7c450f
diff --git a/mobile/apps/auth/lib/services/local_backup_service.dart b/mobile/apps/auth/lib/services/local_backup_service.dartindex 3df0f7ddef..6fd47aab61 100644--- a/mobile/apps/auth/lib/services/local_backup_service.dart+++ b/mobile/apps/auth/lib/services/local_backup_service.dart@@ -286,7 +286,7 @@ class LocalBackupService {Future<String?> _readPassword() async {try {- return Configuration.instance.getBackupPassword();+ return await Configuration.instance.getBackupPassword();} catch (e, s) {_logger.severe('Unable to read backup password', e, s);return null;diff --git a/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart b/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dartindex fb7c03764d..8ca7554b20 100644--- a/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart+++ b/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart@@ -385,7 +385,7 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {Future<String?> _readStoredPassword() async {try {- return Configuration.instance.getBackupPassword();+ return await Configuration.instance.getBackupPassword();} catch (e) {_logger.severe('Failed to read backup password: $e');return null;diff --git a/mobile/apps/auth/lib/utils/share_utils.dart b/mobile/apps/auth/lib/utils/share_utils.dartindex 7362898dbb..ef949d211e 100644--- a/mobile/apps/auth/lib/utils/share_utils.dart+++ b/mobile/apps/auth/lib/utils/share_utils.dart@@ -89,7 +89,7 @@ Future<ShareResult> shareText(}) async {try {final sharePosOrigin = _sharePosOrigin(context, key);- return SharePlus.instance.share(+ return await SharePlus.instance.share(ShareParams(text: text, sharePositionOrigin: sharePosOrigin),);} catch (e, s) {diff --git a/mobile/apps/photos/lib/models/social/social_data_provider.dart b/mobile/apps/photos/lib/models/social/social_data_provider.dartindex 9e323283f2..9bc4d99a21 100644--- a/mobile/apps/photos/lib/models/social/social_data_provider.dart+++ b/mobile/apps/photos/lib/models/social/social_data_provider.dart@@ -158,7 +158,7 @@ class SocialDataProvider {try {await _api.deleteComment(id);- return _db.deleteComment(id);+ return await _db.deleteComment(id);} catch (e) {_logger.severe('Failed to delete comment $id', e);rethrow;diff --git a/mobile/apps/photos/lib/module/download/file.dart b/mobile/apps/photos/lib/module/download/file.dartindex bcd1638df3..afa28bbc68 100644--- a/mobile/apps/photos/lib/module/download/file.dart+++ b/mobile/apps/photos/lib/module/download/file.dart@@ -38,7 +38,7 @@ Future<File?> getFile(}) async {try {if (file.isRemoteOnlyFile) {- return getFileFromServer(+ return await getFileFromServer(file,liveVideo: liveVideo,forGalleryDownload: forGalleryDownload,@@ -178,34 +178,29 @@ 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 {diff --git a/mobile/apps/photos/lib/module/upload/upload_data.dart b/mobile/apps/photos/lib/module/upload/upload_data.dartindex 2f31dc055d..9bf243e078 100644--- a/mobile/apps/photos/lib/module/upload/upload_data.dart+++ b/mobile/apps/photos/lib/module/upload/upload_data.dart@@ -59,7 +59,7 @@ Future<String> getFileContentIdentity(EnteFile file) async {await CryptoUtil.getHash(sourceFile),);if (file.fileType == FileType.livePhoto && Platform.isIOS) {- return getLivePhotoFileHash(file, sourceHash);+ return await getLivePhotoFileHash(file, sourceHash);}return sourceHash;} finally {@@ -226,7 +226,7 @@ Future<Uint8List?> _getThumbnailForUpload(InvalidReason.thumbnailMissing,);}- return compressThumbnailToSizeLimit(thumbnailData);+ return await compressThumbnailToSizeLimit(thumbnailData);} catch (e) {if (isDeviceStorageFullError(e)) {rethrow;diff --git a/mobile/apps/photos/lib/services/entity_service.dart b/mobile/apps/photos/lib/services/entity_service.dartindex 82ff20fdb6..fd2abc4b92 100644--- a/mobile/apps/photos/lib/services/entity_service.dart+++ b/mobile/apps/photos/lib/services/entity_service.dart@@ -124,7 +124,7 @@ class EntityService {Future<int> syncEntity(EntityType type) async {try {- return _remoteToLocalSync(type);+ return await _remoteToLocalSync(type);} catch (e) {_logger.severe("Failed to sync entities", e);return -1;diff --git a/mobile/apps/photos/lib/services/files_service.dart b/mobile/apps/photos/lib/services/files_service.dartindex 6344421121..427351c3d1 100644--- a/mobile/apps/photos/lib/services/files_service.dart+++ b/mobile/apps/photos/lib/services/files_service.dart@@ -50,10 +50,10 @@ class FilesService {final List<int> uploadIDsWithMissingSize = await _filesDB.getUploadIDsWithMissingSize(_config.getUserID()!);if (uploadIDsWithMissingSize.isEmpty) {- return Future.value(true);+ return true;}await backFillSizes(uploadIDsWithMissingSize);- return Future.value(true);+ return true;} catch (e, s) {_logger.severe("error during has migrated sizes", e, s);return Future.value(false);diff --git a/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart b/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dartindex ccd312762c..cd143fe6a5 100644--- a/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart+++ b/mobile/apps/photos/lib/services/machine_learning/face_ml/feedback/cluster_feedback.dart@@ -409,7 +409,7 @@ class ClusterFeedbackService<T> {_logger.info("Cluster centroid vector DB unavailable for all-people suggestions, falling back to legacy mean suggestions",);- return _getAllLargePersonSuggestionsLegacy(+ return await _getAllLargePersonSuggestionsLegacy(personsMap,allClusterIdsToCountMap,personToClusterIDs,@@ -510,7 +510,7 @@ class ClusterFeedbackService<T> {e,s,);- return _getAllLargePersonSuggestionsLegacy(+ return await _getAllLargePersonSuggestionsLegacy(personsMap,allClusterIdsToCountMap,personToClusterIDs,diff --git a/mobile/apps/photos/lib/services/memory_share_service.dart b/mobile/apps/photos/lib/services/memory_share_service.dartindex f7567a80d3..38f5c1c239 100644--- a/mobile/apps/photos/lib/services/memory_share_service.dart+++ b/mobile/apps/photos/lib/services/memory_share_service.dart@@ -613,7 +613,7 @@ class MemoryShareService {Uri.parse(existingShare.url).fragment.isNotEmpty) {return (existingShare.url, existingShare.id);}- return _createMemoryLink(+ return await _createMemoryLink(files: filesForShare,title: title,memoryHash: memoryHash,diff --git a/mobile/apps/photos/lib/services/search_service.dart b/mobile/apps/photos/lib/services/search_service.dartindex 0fc89f2c1e..2865117423 100644--- a/mobile/apps/photos/lib/services/search_service.dart+++ b/mobile/apps/photos/lib/services/search_service.dart@@ -1600,7 +1600,7 @@ class SearchService {if (facesResult.isEmpty) {if (fallbackMinClusterSize != null &&fallbackMinClusterSize < minClusterSize) {- return getAllFace(+ return await getAllFace(limit,minClusterSize: fallbackMinClusterSize,showIgnoredOnly: showIgnoredOnly,diff --git a/mobile/apps/photos/lib/services/smart_memories_service.dart b/mobile/apps/photos/lib/services/smart_memories_service.dartindex 5479ecd8b3..04dc11c821 100644--- a/mobile/apps/photos/lib/services/smart_memories_service.dart+++ b/mobile/apps/photos/lib/services/smart_memories_service.dart@@ -177,7 +177,7 @@ class SmartMemoriesService {_logger.info('${memoriesResult.memories.length} memories computed in computer $t',);- return _finalizeMemoriesResult(memoriesResult, s, languageCode, t);+ return await _finalizeMemoriesResult(memoriesResult, s, languageCode, t);} catch (e, s) {_logger.severe("Error calculating smart memories", e, s);return _fallbackAfterCalculationError();@@ -791,7 +791,7 @@ class SmartMemoriesService {final computationContext = MemoriesComputationContext.fromIsolateArgs(args,);- return _calculateMemories(+ return await _calculateMemories(computationContext,_prepareMemoriesData(computationContext),);diff --git a/mobile/apps/photos/lib/services/video_preview_service.dart b/mobile/apps/photos/lib/services/video_preview_service.dartindex 8e17c50a17..c044151d43 100644--- a/mobile/apps/photos/lib/services/video_preview_service.dart+++ b/mobile/apps/photos/lib/services/video_preview_service.dart@@ -345,7 +345,7 @@ class VideoPreviewService {onlyFilesWithLocalId: false,);- return calcStatus(files, fileDataService.previewIds);+ return await calcStatus(files, fileDataService.previewIds);} catch (e, s) {_logger.severe('Error getting Streaming status', e, s);rethrow;diff --git a/mobile/apps/photos/lib/utils/share_util.dart b/mobile/apps/photos/lib/utils/share_util.dartindex 6d70743b6b..7636267f87 100644--- a/mobile/apps/photos/lib/utils/share_util.dart+++ b/mobile/apps/photos/lib/utils/share_util.dart@@ -123,7 +123,7 @@ Future<ShareResult> shareText(}) async {try {final sharePosOrigin = _sharePosOrigin(context, key);- return SharePlus.instance.share(+ return await SharePlus.instance.share(ShareParams(text: text, sharePositionOrigin: sharePosOrigin),);} catch (e, s) {diff --git a/mobile/packages/scoped_dir_access/lib/scoped_dir_access.dart b/mobile/packages/scoped_dir_access/lib/scoped_dir_access.dartindex ec41825e88..4a17288382 100644--- a/mobile/packages/scoped_dir_access/lib/scoped_dir_access.dart+++ b/mobile/packages/scoped_dir_access/lib/scoped_dir_access.dart@@ -372,7 +372,7 @@ class DirUtils {if (!await dir.exists()) return [];final entries = await dir.list().toList();- return Future.wait(+ return await Future.wait(entries.map((e) async {final stat = await e.stat();return FileInfo(diff --git a/mobile/packages/ui/lib/components/progress_dialog.dart b/mobile/packages/ui/lib/components/progress_dialog.dartindex 92aee3eb55..13643a3d11 100644--- a/mobile/packages/ui/lib/components/progress_dialog.dart+++ b/mobile/packages/ui/lib/components/progress_dialog.dart@@ -130,10 +130,10 @@ class ProgressDialog {Navigator.of(_dismissingContext!).pop();}if (_showLogs) debugPrint('ProgressDialog dismissed');- return Future.value(true);+ return true;} else {if (_showLogs) debugPrint('ProgressDialog already dismissed');- return Future.value(false);+ return false;}} catch (err) {debugPrint('Seems there is an issue hiding dialog');diff --git a/mobile/packages/utils/lib/share_utils.dart b/mobile/packages/utils/lib/share_utils.dartindex 93849e639a..6beedfdce8 100644--- a/mobile/packages/utils/lib/share_utils.dart+++ b/mobile/packages/utils/lib/share_utils.dart@@ -145,7 +145,7 @@ Future<ShareResult> shareText(}) async {try {final sharePosOrigin = _sharePosOrigin(context, key);- return SharePlus.instance.share(+ return await SharePlus.instance.share(ShareParams(text: text, sharePositionOrigin: sharePosOrigin),);} catch (e, s) {@@ -162,7 +162,7 @@ Future<ShareResult> shareFiles(}) async {try {final sharePosOrigin = _sharePosOrigin(context, key);- return SharePlus.instance.share(+ return await SharePlus.instance.share(ShareParams(files: files,text: text,