fix: match collection id to "Camera"
This commit is contained in:
@@ -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 exist
|
||||
await 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",
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -46,6 +46,6 @@ void showToast(
|
||||
}
|
||||
}
|
||||
|
||||
void showShortToast(context, String message) {
|
||||
void showShortToast(BuildContext context, String message) {
|
||||
showToast(context, message, toastLength: Toast.LENGTH_SHORT);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user