π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
More tsc errors
Manav Rathi1dc83b272a28
diff --git a/web/apps/photos/src/services/watch.ts b/web/apps/photos/src/services/watch.tsindex 38fcf838d1..536805347b 100644--- a/web/apps/photos/src/services/watch.ts+++ b/web/apps/photos/src/services/watch.ts@@ -61,14 +61,16 @@ class FolderWatcher {** This is passed as a param to {@link init}.*/- private upload: (collectionName: string, filePaths: string[]) => void;+ private upload:+ | ((collectionName: string, filePaths: string[]) => void)+ | undefined;/*** A function to call when we want to trigger a full remote pull. It will* initiate the pull but will not await its completion.** This is passed as a param to {@link init}.*/- private onTriggerRemotePull: () => void;+ private onTriggerRemotePull: (() => void) | undefined;/** A helper function that debounces invocations of {@link runNextEvent}. */private debouncedRunNextEvent: () => void;@@ -225,16 +227,17 @@ class FolderWatcher {if (this.eventQueue.length == 0 || this.activeWatch || this.isPaused)return;- const skip = (reason: string) => {- log.info(`Ignoring event since ${reason}`);- this.debouncedRunNextEvent();- };-const event = this.dequeueClubbedEvent();+ if (!event) return;log.info(`Processing ${event.action} event for folder watch ${event.folderPath} (collectionName ${event.collectionName}, ${event.filePaths.length} files)`,);+ const skip = (reason: string) => {+ log.info(`Ignoring event since ${reason}`);+ this.debouncedRunNextEvent();+ };+const watch = (await this.getWatches()).find((watch) => watch.folderPath == event.folderPath,);@@ -262,7 +265,7 @@ class FolderWatcher {`Folder watch requested upload of ${paths.length} files to collection ${collectionName}`,);- this.upload(collectionName, paths);+ this.upload!(collectionName, paths);} else {if (this.pruneFileEventsFromDeletedFolderPaths()) {skip("event was from a deleted folder path");@@ -277,7 +280,7 @@ class FolderWatcher {).push(syncedFile);return [removed, rest];},- [[], []],+ [new Array<FolderWatchSyncedFile>(), []],);this.activeWatch = watch;@@ -307,7 +310,7 @@ class FolderWatcher {const filePaths = [event.filePath];while (this.eventQueue.length > 0 &&- event.action === this.eventQueue[0].action &&+ event.action === this.eventQueue[0]?.action &&event.folderPath === this.eventQueue[0].folderPath &&event.collectionName === this.eventQueue[0].collectionName) {@@ -334,11 +337,11 @@ class FolderWatcher {// Done.if (item.isLivePhoto) {this.uploadedFileForPath.set(- ensureString(item.livePhotoAssets.image),+ ensureString(item.livePhotoAssets?.image),uploadResult.file,);this.uploadedFileForPath.set(- ensureString(item.livePhotoAssets.video),+ ensureString(item.livePhotoAssets?.video),uploadResult.file,);} else {@@ -355,10 +358,10 @@ class FolderWatcher {// Non-retriable error.if (item.isLivePhoto) {this.unUploadableFilePaths.add(- ensureString(item.livePhotoAssets.image),+ ensureString(item.livePhotoAssets?.image),);this.unUploadableFilePaths.add(- ensureString(item.livePhotoAssets.video),+ ensureString(item.livePhotoAssets?.video),);} else {this.unUploadableFilePaths.add(@@ -376,7 +379,7 @@ class FolderWatcher {*/async allFileUploadsDone(uploadedItems: UploadAsset[]) {const electron = ensureElectron();- const watch = this.activeWatch;+ const watch = this.activeWatch!;log.debug(() => ["watch/allFileUploadsDone",@@ -428,8 +431,8 @@ class FolderWatcher {// possibility for a UploadItem is for it to be a string (the// absolute path to a file on disk).if (item.isLivePhoto) {- const imagePath = ensureString(item.livePhotoAssets.image);- const videoPath = ensureString(item.livePhotoAssets.video);+ const imagePath = ensureString(item.livePhotoAssets?.image);+ const videoPath = ensureString(item.livePhotoAssets?.video);const imageFile = this.uploadedFileForPath.get(imagePath);const videoFile = this.uploadedFileForPath.get(videoPath);@@ -491,7 +494,7 @@ class FolderWatcher {await removeFromOwnCollection(id, files);}- this.onTriggerRemotePull();+ this.onTriggerRemotePull!();}}