π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix: add upload progress tracking to file uploader
Prateek Sunalf5f649eac2ff
diff --git a/mobile/apps/photos/analysis_options.yaml b/mobile/apps/photos/analysis_options.yamlindex 96a785e526..b99fbce8f1 100644--- a/mobile/apps/photos/analysis_options.yaml+++ b/mobile/apps/photos/analysis_options.yaml@@ -3,6 +3,8 @@# use "flutter analyze ." or "dart analyze ." for running lint checksinclude: package:flutter_lints/flutter.yaml+formatter:+ trailing_commas: preservelinter:rules:# Ref https://github.com/flutter/packages/blob/master/packages/flutter_lints/lib/flutter.yamldiff --git a/mobile/apps/photos/lib/utils/file_uploader.dart b/mobile/apps/photos/lib/utils/file_uploader.dartindex 52b627b1df..e8bc6de704 100644--- a/mobile/apps/photos/lib/utils/file_uploader.dart+++ b/mobile/apps/photos/lib/utils/file_uploader.dart@@ -1351,6 +1351,7 @@ class FileUploader {}) async {final startTime = DateTime.now().millisecondsSinceEpoch;final fileName = basename(file.path);+ int bytesSent = 0;try {await _dio.put(uploadURL.url,@@ -1360,6 +1361,9 @@ class FileUploader {Headers.contentLengthHeader: fileSize,},),+ onSendProgress: (sent, total) {+ bytesSent = sent;+ },);_logger.info("Uploaded object $fileName of size: ${formatBytes(fileSize)} at speed: ${(fileSize / (DateTime.now().millisecondsSinceEpoch - startTime)).toStringAsFixed(2)} KB/s",@@ -1370,7 +1374,9 @@ class FileUploader {if (e.message?.startsWith("HttpException: Content size") ?? false) {rethrow;} else if (attempt < kMaximumUploadAttempts) {- _logger.info("Upload failed for $fileName, retrying");+ _logger.info(+ "Upload failed for $fileName after sending ${formatBytes(bytesSent)} of ${formatBytes(fileSize)}, retrying attempt ${attempt + 1}",+ );final newUploadURL = await _getUploadURL();return _putFile(newUploadURL,