π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Tweak
Manav Rathi3780d417656c
diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.tsindex fb5ea47d3f..244f7fe4e2 100644--- a/web/packages/new/photos/components/gallery/reducer.ts+++ b/web/packages/new/photos/components/gallery/reducer.ts@@ -17,9 +17,9 @@ import {import type { MagicMetadata } from "ente-media/magic-metadata";import {createCollectionNameByID,+ getLatestVersionFiles,isHiddenCollection,} from "ente-new/photos/services/collection";-import { getLatestVersionFiles } from "ente-new/photos/services/collection";import { sortTrashItems, type TrashItem } from "ente-new/photos/services/trash";import { splitByPredicate } from "ente-utils/array";import { includes } from "ente-utils/type-guards";diff --git a/web/packages/new/photos/services/collection.ts b/web/packages/new/photos/services/collection.tsindex c426306b09..57e51887e9 100644--- a/web/packages/new/photos/services/collection.ts+++ b/web/packages/new/photos/services/collection.ts@@ -339,34 +339,36 @@ export const pullCollectionFiles = async (onAugmentCollectionFiles: ((files: EnteFile[]) => void) | undefined,) => {const localFiles = await savedCollectionFiles();- let files = removeDeletedCollectionFiles(collections, localFiles);++ // Prune collections files corresponding to which we no longer have a+ // collection.+ const collectionIDs = new Set(collections.map((c) => c.id));+ let files = localFiles.filter((f) => collectionIDs.has(f.collectionID));let didUpdateFiles = false;- if (files.length !== localFiles.length) {+ if (files.length != localFiles.length) {await saveCollectionFiles(files);onSetCollectionFiles?.(files);didUpdateFiles = true;}+for (const collection of collections) {- if (!getToken()) {- continue;- }- const lastSyncTime =- (await savedCollectionLastSyncTime(collection)) ?? 0;- if (collection.updationTime === lastSyncTime) {+ const sinceTime = (await savedCollectionLastSyncTime(collection)) ?? 0;+ if (collection.updationTime == sinceTime) {continue;}const newFiles = await getFiles(collection,- lastSyncTime,+ sinceTime,onAugmentCollectionFiles,);await clearCachedThumbnailsIfChanged(localFiles, newFiles);files = getLatestVersionFiles([...files, ...newFiles]);await saveCollectionFiles(files);- didUpdateFiles = true;await saveCollectionLastSyncTime(collection, collection.updationTime);+ didUpdateFiles = true;}+return didUpdateFiles;};@@ -383,7 +385,11 @@ export const pullCollectionFiles = async (* a way to fetch a delta diff the next time the client needs to pull changes* from remote.*/-const getCollectionDiff = async (collectionID: number, sinceTime: number) => {+// TODO(RE): Use me+export const getCollectionDiff = async (+ collectionID: number,+ sinceTime: number,+) => {const res = await fetch(await apiURL("/collections/v2/diff", { collectionID, sinceTime }),{ headers: await authenticatedRequestHeaders() },@@ -439,18 +445,6 @@ export const getFiles = async (}};-const removeDeletedCollectionFiles = (- collections: Collection[],- files: EnteFile[],-) => {- const syncedCollectionIds = new Set<number>();- for (const collection of collections) {- syncedCollectionIds.add(collection.id);- }- files = files.filter((file) => syncedCollectionIds.has(file.collectionID));- return files;-};-/*** Clear cached thumbnails for existing files if the thumbnail data has changed.*