π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Update
Manav Rathi477c01bc55b4
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsxindex 0b9aa1f2e5..31ee389976 100644--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx@@ -31,6 +31,7 @@ import {} from "ente-gallery/services/magic-metadata";import { CollectionOrder, type Collection } from "ente-media/collection";import { ItemVisibility } from "ente-media/file-metadata";+import type { RemotePullOpts } from "ente-new/photos/components/gallery";import {GalleryItemsHeaderAdapter,GalleryItemsSummary,@@ -51,8 +52,7 @@ import {import { emptyTrash } from "ente-new/photos/services/trash";import { usePhotosAppContext } from "ente-new/photos/types/context";import { t } from "i18next";-import { GalleryContext } from "pages/gallery";-import React, { useCallback, useContext, useRef } from "react";+import React, { useCallback, useRef } from "react";import { Trans } from "react-i18next";import * as CollectionAPI from "services/collectionService";import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";@@ -61,11 +61,16 @@ import {downloadDefaultHiddenCollectionHelper,} from "utils/collection";-interface CollectionHeaderProps {+export interface CollectionHeaderProps {collectionSummary: CollectionSummary;activeCollection: Collection;setActiveCollectionID: (collectionID: number) => void;isActiveCollectionDownloadInProgress: () => boolean;+ /**+ * Called when an operation (e.g. renaming a collection) completes and wants+ * to perform a full remote pull.+ */+ onRemotePull: (opts?: RemotePullOpts) => Promise<void>;onCollectionShare: () => void;onCollectionCast: () => void;setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator;@@ -110,7 +115,9 @@ export const CollectionHeader: React.FC<CollectionHeaderProps> = (props) => {fileCount={fileCount}endIcon={<EndIcon type={type} />}/>- {shouldShowOptions(type) && <CollectionOptions {...props} />}+ {shouldShowOptions(type) && (+ <CollectionHeaderOptions {...props} />+ )}</SpacedRow></GalleryItemsHeaderAdapter>);@@ -119,10 +126,11 @@ export const CollectionHeader: React.FC<CollectionHeaderProps> = (props) => {const shouldShowOptions = (type: CollectionSummaryType) =>type != "all" && type != "archive";-const CollectionOptions: React.FC<CollectionHeaderProps> = ({+const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({activeCollection,collectionSummary,setActiveCollectionID,+ onRemotePull,onCollectionShare,onCollectionCast,setFilesDownloadProgressAttributesCreator,@@ -130,7 +138,6 @@ const CollectionOptions: React.FC<CollectionHeaderProps> = ({}) => {const { showMiniDialog, onGenericError } = useBaseContext();const { showLoadingBar, hideLoadingBar } = usePhotosAppContext();- const { syncWithRemote } = useContext(GalleryContext);const overflowMenuIconRef = useRef<SVGSVGElement>(null);const { show: showSortOrderMenu, props: sortOrderMenuVisibilityProps } =@@ -154,23 +161,23 @@ const CollectionOptions: React.FC<CollectionHeaderProps> = ({} catch (e) {onGenericError(e);} finally {- void syncWithRemote(true);+ void onRemotePull({ silent: true });hideLoadingBar();}};return (): void => void wrapped();},- [showLoadingBar, hideLoadingBar, onGenericError, syncWithRemote],+ [showLoadingBar, hideLoadingBar, onGenericError, onRemotePull],);const handleRenameCollection = useCallback(async (newName: string) => {if (activeCollection.name !== newName) {await renameCollection(activeCollection, newName);- void syncWithRemote(true);+ void onRemotePull({ silent: true });}},- [activeCollection],+ [activeCollection, onRemotePull],);const confirmDeleteCollection = () => {diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsxindex 4bc8c0ae57..af3c6c5b5d 100644--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx@@ -21,16 +21,18 @@ import { getData, removeData } from "ente-shared/storage/localStorage";import { includes } from "ente-utils/type-guards";import React, { useCallback, useEffect, useMemo, useState } from "react";import { sortCollectionSummaries } from "services/collectionService";-import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";import {FilesDownloadProgressAttributes,isFilesDownloadCancelled,isFilesDownloadCompleted,} from "../FilesDownloadProgress";import { AlbumCastDialog } from "./AlbumCastDialog";-import { CollectionHeader } from "./CollectionHeader";+import {+ CollectionHeader,+ type CollectionHeaderProps,+} from "./CollectionHeader";-type CollectionsProps = Omit<+type GalleryBarAndListHeaderProps = Omit<GalleryBarImplProps,| "collectionSummaries"| "hiddenCollectionSummaries"@@ -49,8 +51,10 @@ type CollectionsProps = Omit<hiddenCollectionSummaries: CollectionSummaries;setPhotoListHeader: (value: TimeStampListItem) => void;filesDownloadProgressAttributesList: FilesDownloadProgressAttributes[];- setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator;-};+} & Pick<+ CollectionHeaderProps,+ "setFilesDownloadProgressAttributesCreator" | "onRemotePull"+ >;/*** The gallery bar, the header for the list items, and state for any associated@@ -70,7 +74,9 @@ type CollectionsProps = Omit<* TODO: Once the gallery code is better responsibilitied out, consider moving* this code back inline into the gallery.*/-export const GalleryBarAndListHeader: React.FC<CollectionsProps> = ({+export const GalleryBarAndListHeader: React.FC<+ GalleryBarAndListHeaderProps+> = ({shouldHide,mode,onChangeMode,@@ -81,6 +87,7 @@ export const GalleryBarAndListHeader: React.FC<CollectionsProps> = ({hiddenCollectionSummaries,people,activePerson,+ onRemotePull,onSelectPerson,setPhotoListHeader,filesDownloadProgressAttributesList,@@ -144,6 +151,7 @@ export const GalleryBarAndListHeader: React.FC<CollectionsProps> = ({setActiveCollectionID,setFilesDownloadProgressAttributesCreator,isActiveCollectionDownloadInProgress,+ onRemotePull,}}collectionSummary={toShowCollectionSummaries.get(activeCollectionID,diff --git a/web/apps/photos/src/components/FixCreationTime.tsx b/web/apps/photos/src/components/FixCreationTime.tsxindex bee5e78621..ac7991c0ea 100644--- a/web/apps/photos/src/components/FixCreationTime.tsx+++ b/web/apps/photos/src/components/FixCreationTime.tsx@@ -27,14 +27,17 @@ import { FileDateTimePicker } from "ente-new/photos/components/FileDateTimePickeimport { updateFilePublicMagicMetadata } from "ente-new/photos/services/file";import { useFormik } from "formik";import { t } from "i18next";-import { GalleryContext } from "pages/gallery";-import React, { useContext, useEffect, useState } from "react";+import React, { useEffect, useState } from "react";type FixCreationTimeProps = ModalVisibilityProps & {/**- * The {@link EnteFile}s whose creation time the user wishes to modify.+ * The {@link EnteFile}s whose creation time should be modified.*/files: EnteFile[];+ /**+ * Perform a full remote pull.+ */+ onRemotePull: () => Promise<void>;};/**@@ -44,12 +47,11 @@ export const FixCreationTime: React.FC<FixCreationTimeProps> = ({open,onClose,files,+ onRemotePull,}) => {const [step, setStep] = useState<Step | undefined>();const [progress, setProgress] = useState({ completed: 0, total: 0 });- const galleryContext = useContext(GalleryContext);-useEffect(() => {// Reset the step whenever the dialog is reopened.if (open) setStep(undefined);@@ -64,7 +66,7 @@ export const FixCreationTime: React.FC<FixCreationTimeProps> = ({setProgress,);setStep(completedWithErrors ? "completed-with-errors" : "completed");- await galleryContext.syncWithRemote();+ await onRemotePull();};const title =diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex ae4156c663..fbe1d351a8 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -938,6 +938,7 @@ const Page: React.FC = () => {<FixCreationTime{...fixCreationTimeVisibilityProps}files={fixCreationTimeFiles}+ onRemotePull={remotePull}/><NavbarBasesx={[@@ -1030,6 +1031,7 @@ const Page: React.FC = () => {}onChangeMode={handleChangeBarMode}setActiveCollectionID={handleShowCollectionSummary}+ onRemotePull={remotePull}onSelectPerson={handleSelectPerson}/>diff --git a/web/apps/photos/src/pages/shared-albums.tsx b/web/apps/photos/src/pages/shared-albums.tsxindex 3f07390b22..b6b5ce3c8c 100644--- a/web/apps/photos/src/pages/shared-albums.tsx+++ b/web/apps/photos/src/pages/shared-albums.tsx@@ -238,7 +238,7 @@ export default function PublicCollectionGallery() {downloadManager.setPublicAlbumsCredentials(credentials.current);// Update the CF proxy flag, but we don't need to block on it.void updateShouldDisableCFUploadProxy();- await syncWithRemote();+ await publicAlbumsRemotePull();} finally {if (!redirectingToWebsite) {setLoading(false);@@ -284,7 +284,11 @@ export default function PublicCollectionGallery() {);}, [onAddPhotos]);- const syncWithRemote = useCallback(async () => {+ /**+ * Pull the latest data related to the public album from remote, updating+ * both our local database and component state.+ */+ const publicAlbumsRemotePull = useCallback(async () => {const collectionUID = getPublicCollectionUID(credentials.current.accessToken,);@@ -397,7 +401,7 @@ export default function PublicCollectionGallery() {throw e;}- await syncWithRemote();+ await publicAlbumsRemotePull();};const clearSelection = () => {@@ -519,7 +523,7 @@ export default function PublicCollectionGallery() {setFilesDownloadProgressAttributesCreator={setFilesDownloadProgressAttributesCreator}- onRemotePull={syncWithRemote}+ onRemotePull={publicAlbumsRemotePull}onVisualFeedback={handleVisualFeedback}/>{blockingLoad && <TranslucentLoadingOverlay />}@@ -527,7 +531,7 @@ export default function PublicCollectionGallery() {uploadCollection={publicCollection}setLoading={setBlockingLoad}setShouldDisableDropzone={setShouldDisableDropzone}- onRemotePull={syncWithRemote}+ onRemotePull={publicAlbumsRemotePull}onUploadFile={(file) =>setPublicFiles(sortFiles([...publicFiles, file]))}