π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
PerfFix: Perform zip ops on different isolate
Neeraj Guptad4cd160eeb93
diff --git a/lib/utils/file_uploader_util.dart b/lib/utils/file_uploader_util.dartindex d445d808df..9c063469d6 100644--- a/lib/utils/file_uploader_util.dart+++ b/lib/utils/file_uploader_util.dart@@ -5,6 +5,7 @@ import 'dart:typed_data';import 'dart:ui' as ui;import "package:archive/archive_io.dart";+import "package:computer/computer.dart";import 'package:logging/logging.dart';import "package:motion_photos/motion_photos.dart";import 'package:motionphoto/motionphoto.dart';@@ -124,14 +125,15 @@ Future<MediaUploadData> _getMediaUploadDataFromAssetFile(EnteFile file) async {// imgHash:vidHashfileHash = '$fileHash$kLivePhotoHashSeparator$livePhotoVideoHash';final tempPath = Configuration.instance.getTempDirectory();+// .elp -> ente live photofinal livePhotoPath = tempPath + file.generatedID.toString() + ".elp";- _logger.fine("Uploading zipped live photo from " + livePhotoPath);- final encoder = ZipFileEncoder();- encoder.create(livePhotoPath);- await encoder.addFile(videoUrl, "video" + extension(videoUrl.path));- await encoder.addFile(sourceFile, "image" + extension(sourceFile.path));- encoder.close();+ _logger.fine("Creating zip for live photo from " + livePhotoPath);+ await zip(+ zipPath: livePhotoPath,+ imagePath: sourceFile.path,+ videoPath: videoUrl.path,+ );// delete the temporary video and image copy (only in IOS)if (Platform.isIOS) {await sourceFile.delete();@@ -168,6 +170,33 @@ Future<MediaUploadData> _getMediaUploadDataFromAssetFile(EnteFile file) async {);}+Future<void> _computeZip(Map<String, dynamic> args) async {+ final String zipPath = args['zipPath'];+ final String imagePath = args['imagePath'];+ final String videoPath = args['videoPath'];+ final encoder = ZipFileEncoder();+ encoder.create(zipPath);+ await encoder.addFile(File(imagePath), "image" + extension(imagePath));+ await encoder.addFile(File(videoPath), "video" + extension(videoPath));+ encoder.close();+}++Future<void> zip({+ required String zipPath,+ required String imagePath,+ required String videoPath,+}) {+ return Computer.shared().compute(+ _computeZip,+ param: {+ 'zipPath': zipPath,+ 'imagePath': imagePath,+ 'videoPath': videoPath,+ },+ taskName: 'zip',+ );+}+Future<Uint8List?> _getThumbnailForUpload(AssetEntity asset,EnteFile file,