This commit is contained in:
Manav Rathi
2024-12-26 17:29:13 +05:30
parent 7cd1ce0a99
commit f5a3b8a3fb

View File

@@ -3,9 +3,12 @@ import { newID } from "@/base/id";
import { ensureLocalUser } from "@/base/local-user";
import type { EnteFile } from "@/media/file";
import { metadataHash } from "@/media/file-metadata";
import { wait } from "@/utils/promise";
import { getPublicMagicMetadataSync } from "@ente/shared/file-metadata";
import { addToCollection, createCollectionNameByID } from "./collection";
import {
addToCollection,
createCollectionNameByID,
moveToTrash,
} from "./collection";
import { getLocalCollections } from "./collections";
import { getLocalFiles } from "./files";
@@ -274,36 +277,22 @@ export const removeSelectedDuplicateGroups = async (
const collections = await getLocalCollections("normal");
const collectionsByID = new Map(collections.map((c) => [c.id, c]));
for (const [collectionID, collectionFiles] of filesToAdd.entries()) {
await addToCollection(collectionsByID.get(collectionID)!, collectionFiles)
await addToCollection(
collectionsByID.get(collectionID)!,
collectionFiles,
);
tickProgress();
}
// Process the removes.
if (filesToTrash.length) {
// await trashFiles(filesToTrash);
// onProgress(
// ((selectedDuplicateGroups.length - i++) /
// selectedDuplicateGroups.length) *
// -100,
// );
await moveToTrash(filesToTrash);
tickProgress();
}
return new Set(selectedDuplicateGroups.map((g) => g.id));
};
/**
* Retain only file from amongst these duplicates whilst keeping the existing
* collection entries intact.
*
*/
const removeDuplicateGroup = async (duplicateGroup: DuplicateGroup) => {
console.log({ fileToRetain });
// const collections;
// TODO: Remove me after testing the UI
await wait(1000);
};
/**
* Find the most eligible item from amongst the duplicates to retain.
*