π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Up
Manav Rathi2d5dc734aa7c
diff --git a/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx b/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsxindex ac3b36bc28..f4e3e40af8 100644--- a/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx+++ b/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx@@ -11,6 +11,7 @@ import { nameAndExtension } from "@/base/file-name";import log from "@/base/log";import { downloadAndRevokeObjectURL } from "@/base/utils/web";import { downloadManager } from "@/gallery/services/download";+import type { Collection } from "@/media/collection";import { EnteFile } from "@/media/file";import { aboveFileViewerContentZ } from "@/new/photos/components/utils/z-index";import { getLocalCollections } from "@/new/photos/services/collections";@@ -53,13 +54,25 @@ import React, {type Ref,type RefObject,} from "react";-import uploadManager from "services/upload/uploadManager";interface ImageEditorOverlayProps {file: EnteFile;show: boolean;onClose: () => void;- closePhotoViewer: () => void;+ /**+ * Called when the user activates the button to save a copy of the given+ * {@link enteFile} to their Ente account with the edits they have made.+ *+ * @param editedFile A Web {@link File} containing the edited contents.+ * @param collection The collection to which the edited file should be+ * added.+ * @param enteFile The original {@link EnteFile}.+ */+ onSaveEditedCopy: (+ editedFile: File,+ collection: Collection,+ enteFile: EnteFile,+ ) => void;}const filterDefaultValues = {@@ -478,12 +491,8 @@ export const ImageEditorOverlay: React.FC<ImageEditorOverlayProps> = (const editedFile = await getEditedFile();- uploadManager.prepareForNewUpload();- uploadManager.showUploadProgressDialog();- uploadManager.uploadFile(editedFile, collection, props.file);+ props.onSaveEditedCopy(editedFile, collection, props.file);setFileURL(undefined);- props.onClose();- props.closePhotoViewer();} catch (e) {log.error("Error saving copy to ente", e);}diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsxindex e740effc31..015ea73137 100644--- a/web/apps/photos/src/components/PhotoViewer/index.tsx+++ b/web/apps/photos/src/components/PhotoViewer/index.tsx@@ -15,6 +15,7 @@ import {type FileInfoProps,} from "@/gallery/components/FileInfo";import { downloadManager } from "@/gallery/services/download";+import type { Collection } from "@/media/collection";import { fileLogID, type EnteFile } from "@/media/file";import { FileType } from "@/media/file-type";import { isHEICExtension, needsJPEGConversion } from "@/media/formats";@@ -66,6 +67,7 @@ import {addToFavorites,removeFromFavorites,} from "services/collectionService";+import uploadManager from "services/upload/uploadManager";import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";import {copyFileToClipboard,@@ -655,6 +657,18 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({setShowImageEditorOverlay(false);};+ const handleSaveEditedCopy = (+ editedFile: File,+ collection: Collection,+ enteFile: EnteFile,+ ) => {+ uploadManager.prepareForNewUpload();+ uploadManager.showUploadProgressDialog();+ uploadManager.uploadFile(editedFile, collection, enteFile);+ handleCloseEditor();+ handleClose();+ };+const downloadFileHelper = async (file: EnteFile) => {if (file &&@@ -1000,7 +1014,7 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({show={showImageEditorOverlay}file={photoSwipe?.currItem as EnteFile}onClose={handleCloseEditor}- closePhotoViewer={handleClose}+ onSaveEditedCopy={handleSaveEditedCopy}/></>);