Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

sketch web side 1

Manav Rathi2e657d88f429
diff --git a/desktop/src/preload.ts b/desktop/src/preload.ts
index 2199535457..0780cb5e54 100644
--- a/desktop/src/preload.ts
+++ b/desktop/src/preload.ts
@@ -290,13 +290,11 @@ const pendingUploads = () => ipcRenderer.invoke("pendingUploads");
const setPendingUploads = (pendingUploads: PendingUploads) =>
ipcRenderer.invoke("setPendingUploads", pendingUploads);
-const markUploadedFile = (path: string, associatedPath: string | undefined) =>
+const markUploadedFile = (path: string, associatedPath?: string) =>
ipcRenderer.invoke("markUploadedFile", path, associatedPath);
-const markUploadedZipItem = (
- item: ZipItem,
- associatedItem: ZipItem | undefined,
-) => ipcRenderer.invoke("markUploadedZipItem", item, associatedItem);
+const markUploadedZipItem = (item: ZipItem, associatedItem?: ZipItem) =>
+ ipcRenderer.invoke("markUploadedZipItem", item, associatedItem);
const clearPendingUploads = () => ipcRenderer.invoke("clearPendingUploads");
diff --git a/web/apps/photos/src/services/upload/uploadManager.ts b/web/apps/photos/src/services/upload/uploadManager.ts
index 5a1d3e954d..99fbaa0b0e 100644
--- a/web/apps/photos/src/services/upload/uploadManager.ts
+++ b/web/apps/photos/src/services/upload/uploadManager.ts
@@ -814,16 +814,15 @@ const splitMetadataAndMediaItems = (
);
const markUploaded = async (electron: Electron, item: ClusteredUploadItem) => {
- // TODO: This can be done better
if (item.isLivePhoto) {
const [p0, p1] = [
item.livePhotoAssets.image,
item.livePhotoAssets.video,
];
if (Array.isArray(p0) && Array.isArray(p1)) {
- electron.markUploadedZipItems([p0, p1]);
+ return electron.markUploadedZipItem(p0, p1);
} else if (typeof p0 == "string" && typeof p1 == "string") {
- electron.markUploadedFiles([p0, p1]);
+ return electron.markUploadedFile(p0, p1);
} else if (
p0 &&
typeof p0 == "object" &&
diff --git a/web/packages/base/types/ipc.ts b/web/packages/base/types/ipc.ts
index 345efd30f7..f13888ceb8 100644
--- a/web/packages/base/types/ipc.ts
+++ b/web/packages/base/types/ipc.ts
@@ -531,7 +531,7 @@ export interface Electron {
* - Typically, this would be called at the start of an upload.
*
* - Thereafter, as each item gets uploaded one by one, we'd call
- * {@link markUploadedFiles} or {@link markUploadedZipItems}.
+ * {@link markUploadedFile} or {@link markUploadedZipItem}.
*
* - Finally, once the upload completes (or gets cancelled), we'd call
* {@link clearPendingUploads} to complete the circle.
@@ -539,15 +539,41 @@ export interface Electron {
setPendingUploads: (pendingUploads: PendingUploads) => Promise<void>;
/**
- * Mark the given files (given by their {@link paths}) as having been
+ * Mark the given files (specified by their disk paths) as having been
* uploaded.
+ *
+ * @param {@link path} The path to the file system file which was uploaded.
+ *
+ * @param {@link associatedPath} The path file (if any) of the file
+ * associated with the file which was uploaded. This will be present only in
+ * the case of live photos, where this will be set to the path of the video
+ * component of the live photo on disk.
+ *
+ * @returns The last modified time (epoch milliseconds) of the file at
+ * {@link path}.
*/
- markUploadedFiles: (paths: PendingUploads["filePaths"]) => Promise<void>;
+ markUploadedFile: (
+ path: string,
+ associatedPath?: string,
+ ) => Promise<number>;
/**
* Mark the given {@link ZipItem}s as having been uploaded.
+ *
+ * @param {@link item} The {@link ZipItem} which was uploaded.
+ *
+ * @param {@link associatedItem} An optional extra {@link ZipItem}
+ * associated with the {@link item} which was uploaded. This will be present
+ * only in case of live photos, where this'll be set to the {@link ZipItem}
+ * representing the video component of the live photo on disk.
+ *
+ * @returns The last modified time (epoch milliseconds) of the zip file
+ * containing {@link item}.
*/
- markUploadedZipItems: (items: PendingUploads["zipItems"]) => Promise<void>;
+ markUploadedZipItem: (
+ item: ZipItem,
+ associatedItem?: ZipItem,
+ ) => Promise<number>;
/**
* Clear any pending uploads.