π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix: match collection id to "Camera"
Prateek Sunalca118c397b18
diff --git a/mobile/lib/services/preview_video_store.dart b/mobile/lib/services/preview_video_store.dartindex 69fe6ca398..3699cc37da 100644--- a/mobile/lib/services/preview_video_store.dart+++ b/mobile/lib/services/preview_video_store.dart@@ -47,7 +47,7 @@ class PreviewVideoStore {List<VideoQuality> get qualities => VideoQuality.values;- Future<void> chunkAndUploadVideo(BuildContext ctx, EnteFile enteFile) async {+ Future<void> chunkAndUploadVideo(BuildContext? ctx, EnteFile enteFile) async {if (!enteFile.isUploaded) return;final file = await getFile(enteFile, isOrigin: true);if (file == null) return;@@ -55,7 +55,7 @@ class PreviewVideoStore {// check if playlist already existawait getPlaylist(enteFile);final resultUrl = await getPreviewUrl(enteFile);- if (ctx.mounted) {+ if (ctx != null && ctx.mounted) {showShortToast(ctx, 'Video preview already exists');}debugPrint("previewUrl $resultUrl");@@ -68,7 +68,7 @@ class PreviewVideoStore {rethrow;}}- if (VideoCompress.isCompressing) {+ if (VideoCompress.isCompressing && ctx != null) {showShortToast(ctx,"Another is being compressed ($_progress %), please wait",diff --git a/mobile/lib/utils/file_uploader.dart b/mobile/lib/utils/file_uploader.dartindex 84c33446d1..dc334fdc17 100644--- a/mobile/lib/utils/file_uploader.dart+++ b/mobile/lib/utils/file_uploader.dart@@ -35,6 +35,7 @@ import "package:photos/service_locator.dart";import 'package:photos/services/collections_service.dart';import "package:photos/services/file_magic_service.dart";import 'package:photos/services/local_sync_service.dart';+import "package:photos/services/preview_video_store.dart";import 'package:photos/services/sync_service.dart';import "package:photos/services/user_service.dart";import 'package:photos/utils/crypto_util.dart';@@ -97,6 +98,8 @@ class FileUploader {static FileUploader instance = FileUploader._privateConstructor();+ static final _previewVideoStore = PreviewVideoStore.instance;+Future<void> init(SharedPreferences preferences, bool isBackground) async {_prefs = preferences;_isBackground = isBackground;@@ -463,6 +466,16 @@ class FileUploader {}}+ void _uploadPreview(EnteFile file) {+ final collection =+ CollectionsService.instance.getCollectionByID(file.collectionID!);+ if (collection?.displayName == "Camera") {+ unawaited(+ _previewVideoStore.chunkAndUploadVideo(null, file),+ );+ }+ }+Future<EnteFile> _tryToUpload(EnteFile file,int collectionID,@@ -718,6 +731,8 @@ class FileUploader {if (SyncService.instance.shouldStopSync()) {throw SyncStopRequestedError();}++ _uploadPreview(file);EnteFile remoteFile;if (isUpdatedFile) {remoteFile = await _updateFile(diff --git a/mobile/lib/utils/toast_util.dart b/mobile/lib/utils/toast_util.dartindex 96658ec29d..2e876222a7 100644--- a/mobile/lib/utils/toast_util.dart+++ b/mobile/lib/utils/toast_util.dart@@ -46,6 +46,6 @@ void showToast(}}-void showShortToast(context, String message) {+void showShortToast(BuildContext context, String message) {showToast(context, message, toastLength: Toast.LENGTH_SHORT);}