π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fin
Manav Rathi1605b44c6e92
diff --git a/web/apps/photos/src/components/AuthenticateUserModal.tsx b/web/apps/photos/src/components/AuthenticateUserModal.tsxindex e81bed170c..972dd33d68 100644--- a/web/apps/photos/src/components/AuthenticateUserModal.tsx+++ b/web/apps/photos/src/components/AuthenticateUserModal.tsx@@ -3,15 +3,16 @@ import {TitledMiniDialog,type MiniDialogAttributes,} from "@/base/components/MiniDialog";+import { useBaseContext } from "@/base/context";import log from "@/base/log";-import { AppContext } from "@/new/photos/types/context";+import { usePhotosAppContext } from "@/new/photos/types/context";import VerifyMasterPasswordForm, {type VerifyMasterPasswordFormProps,} from "@ente/shared/components/VerifyMasterPasswordForm";import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";import type { KeyAttributes, User } from "@ente/shared/user/types";import { t } from "i18next";-import { useCallback, useContext, useEffect, useState } from "react";+import { useCallback, useEffect, useState } from "react";interface Iprops {open: boolean;@@ -24,7 +25,8 @@ export default function AuthenticateUserModal({onClose,onAuthenticate,}: Iprops) {- const { showMiniDialog, onGenericError, logout } = useContext(AppContext);+ const { logout, showMiniDialog } = useBaseContext();+ const { onGenericError } = usePhotosAppContext();const [user, setUser] = useState<User>();const [keyAttributes, setKeyAttributes] = useState<KeyAttributes>();diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsxindex 444bebb3d1..583dd8b6da 100644--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx@@ -28,7 +28,7 @@ import { COLLECTION_ROLE, type CollectionUser } from "@/media/collection";import { PublicLinkCreated } from "@/new/photos/components/share/PublicLinkCreated";import { avatarTextColor } from "@/new/photos/services/avatar";import type { CollectionSummary } from "@/new/photos/services/collection/ui";-import { AppContext } from "@/new/photos/types/context";+import { usePhotosAppContext } from "@/new/photos/types/context";import { FlexWrapper } from "@ente/shared/components/Container";import SingleInputForm, {type SingleInputFormProps,@@ -812,7 +812,7 @@ const ManageEmailShare: React.FC<ManageEmailShareProps> = ({onRootClose,peopleCount,}) => {- const { showLoadingBar, hideLoadingBar } = useContext(AppContext);+ const { showLoadingBar, hideLoadingBar } = usePhotosAppContext();const galleryContext = useContext(GalleryContext);const [addParticipantView, setAddParticipantView] = useState(false);diff --git a/web/apps/photos/src/components/DeleteAccountModal.tsx b/web/apps/photos/src/components/DeleteAccountModal.tsxindex 896acee7c8..8e195fe649 100644--- a/web/apps/photos/src/components/DeleteAccountModal.tsx+++ b/web/apps/photos/src/components/DeleteAccountModal.tsx@@ -2,12 +2,14 @@ import { assertionFailed } from "@/base/assert";import { TitledMiniDialog } from "@/base/components/MiniDialog";import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";import { LoadingButton } from "@/base/components/mui/LoadingButton";+import type { ModalVisibilityProps } from "@/base/components/utils/modal";+import { useBaseContext } from "@/base/context";import { sharedCryptoWorker } from "@/base/crypto";import {DropdownInput,type DropdownOption,} from "@/new/photos/components/DropdownInput";-import { AppContext } from "@/new/photos/types/context";+import { usePhotosAppContext } from "@/new/photos/types/context";import { initiateEmail } from "@/new/photos/utils/web";import { getData, LS_KEYS } from "@ente/shared/storage/localStorage";import { getActualKey } from "@ente/shared/user";@@ -28,18 +30,17 @@ import { Trans } from "react-i18next";import { deleteAccount, getAccountDeleteChallenge } from "services/userService";import * as Yup from "yup";-interface Iprops {- onClose: () => void;- open: boolean;-}-interface FormValues {reason: string;feedback: string;}-const DeleteAccountModal = ({ open, onClose }: Iprops) => {- const { showMiniDialog, onGenericError, logout } = useContext(AppContext);+const DeleteAccountModal: React.FC<ModalVisibilityProps> = ({+ open,+ onClose,+}) => {+ const { logout, showMiniDialog } = useBaseContext();+ const { onGenericError } = usePhotosAppContext();const { authenticateUser } = useContext(GalleryContext);const [loading, setLoading] = useState(false);diff --git a/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx b/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsxindex e2805f6594..dc9fd24e3d 100644--- a/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx+++ b/web/apps/photos/src/components/PhotoViewer/ImageEditorOverlay.tsx@@ -8,6 +8,7 @@ import {RowSwitch,} from "@/base/components/RowButton";import type { ModalVisibilityProps } from "@/base/components/utils/modal";+import { useBaseContext } from "@/base/context";import { nameAndExtension } from "@/base/file-name";import log from "@/base/log";import { downloadAndRevokeObjectURL } from "@/base/utils/web";@@ -16,7 +17,6 @@ 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";-import { AppContext } from "@/new/photos/types/context";import { CenteredFlex } from "@ente/shared/components/Container";import ChevronRightIcon from "@mui/icons-material/ChevronRight";import CloseIcon from "@mui/icons-material/Close";@@ -48,7 +48,6 @@ import { t } from "i18next";import React, {forwardRef,Fragment,- useContext,useEffect,useRef,useState,@@ -97,7 +96,7 @@ interface CropBoxProps {export const ImageEditorOverlay: React.FC<ImageEditorOverlayProps> = (props,) => {- const { showMiniDialog } = useContext(AppContext);+ const { showMiniDialog } = useBaseContext();const canvasRef = useRef<HTMLCanvasElement | null>(null);const originalSizeCanvasRef = useRef<HTMLCanvasElement | null>(null);diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsxindex a875819696..73aff4a6ad 100644--- a/web/apps/photos/src/components/PhotoViewer/index.tsx+++ b/web/apps/photos/src/components/PhotoViewer/index.tsx@@ -22,7 +22,7 @@ import { isHEICExtension, needsJPEGConversion } from "@/media/formats";import { ConfirmDeleteFileDialog } from "@/new/photos/components/FileViewer";import { moveToTrash } from "@/new/photos/services/collection";import { extractRawExif, parseExif } from "@/new/photos/services/exif";-import { AppContext } from "@/new/photos/types/context";+import { usePhotosAppContext } from "@/new/photos/types/context";import AlbumOutlinedIcon from "@mui/icons-material/AlbumOutlined";import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";import ChevronRightIcon from "@mui/icons-material/ChevronRight";@@ -143,8 +143,7 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({collectionNameMap,onSelectPerson,}) => {- const { showLoadingBar, hideLoadingBar, showMiniDialog } =- useContext(AppContext);+ const { showLoadingBar, hideLoadingBar } = usePhotosAppContext();const galleryContext = useContext(GalleryContext);const publicCollectionGalleryContext = useContext(PublicCollectionGalleryContext,@@ -997,7 +996,6 @@ export const PhotoViewer: React.FC<PhotoViewerProps> = ({handleCloseInfo={handleCloseInfo}file={photoSwipe?.currItem as EnteFile}exif={exif?.value}- showMiniDialog={showMiniDialog}shouldDisableEdits={!isOwnFile}allowMap={!publicCollectionGalleryContext.credentials}showCollectionChips={diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsxindex 70e6e9e51b..e5b919e622 100644--- a/web/apps/photos/src/pages/_app.tsx+++ b/web/apps/photos/src/pages/_app.tsx@@ -31,7 +31,7 @@ import { aboveFileViewerContentZ } from "@/new/photos/components/utils/z-index";import { runMigrations } from "@/new/photos/services/migration";import { initML, isMLSupported } from "@/new/photos/services/ml";import { getFamilyPortalRedirectURL } from "@/new/photos/services/user-details";-import { AppContext } from "@/new/photos/types/context";+import { PhotosAppContext } from "@/new/photos/types/context";import HTTPService from "@ente/shared/network/HTTPService";import {getData,@@ -201,7 +201,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {{isDesktop && <WindowTitlebar>{title}</WindowTitlebar>}<BaseContext value={baseContext}>- <AppContext.Provider value={appContext}>+ <PhotosAppContext value={appContext}>{!isI18nReady ? (<LoadingIndicator />) : (@@ -210,7 +210,7 @@ const App: React.FC<AppProps> = ({ Component, pageProps }) => {<Component {...pageProps} /></>)}- </AppContext.Provider>+ </PhotosAppContext></BaseContext></ThemeProvider>);diff --git a/web/packages/accounts/types/page.ts b/web/packages/accounts/types/page.tsdeleted file mode 100644index ffb7a27126..0000000000--- a/web/packages/accounts/types/page.ts+++ /dev/null@@ -1,16 +0,0 @@-import type { BaseContextT } from "@/base/context";--/**- * The default type for pages exposed by this package.- *- * Some specific pages might extend this further (e.g. the two-factor/recover).- */-export interface PageProps {- /**- * The common denominator AppContext.- *- * Within this package we do not have access to the context object declared- * with the app's code, so we need to take the context as a parameter.- */- appContext: BaseContextT;-}diff --git a/web/packages/base/components/OverflowMenu.tsx b/web/packages/base/components/OverflowMenu.tsxindex 99b7692b1f..b3a474c92b 100644--- a/web/packages/base/components/OverflowMenu.tsx+++ b/web/packages/base/components/OverflowMenu.tsx@@ -59,7 +59,7 @@ export const OverflowMenu: React.FC<[],);return (- <OverflowMenuContext.Provider value={context}>+ <OverflowMenuContext value={context}><IconButtononClick={(event) => setAnchorEl(event.currentTarget)}aria-controls={anchorEl ? ariaID : undefined}@@ -85,7 +85,7 @@ export const OverflowMenu: React.FC<>{children}</Menu>- </OverflowMenuContext.Provider>+ </OverflowMenuContext>);};diff --git a/web/packages/gallery/components/FileInfo.tsx b/web/packages/gallery/components/FileInfo.tsxindex 3a4ad8fccc..0e28b39e37 100644--- a/web/packages/gallery/components/FileInfo.tsx+++ b/web/packages/gallery/components/FileInfo.tsx@@ -13,7 +13,7 @@ import { SidebarDrawer } from "@/base/components/mui/SidebarDrawer";import { Titlebar } from "@/base/components/Titlebar";import { EllipsizedTypography } from "@/base/components/Typography";import { useModalVisibility } from "@/base/components/utils/modal";-import type { BaseContextT } from "@/base/context";+import { useBaseContext } from "@/base/context";import { haveWindow } from "@/base/env";import { nameAndExtension } from "@/base/file-name";import log from "@/base/log";@@ -109,11 +109,6 @@ export interface FileInfoProps {showInfo: boolean;handleCloseInfo: () => void;exif: FileInfoExif | undefined;- /**- * This is the same as the {@link showMiniDialog} prop in the top level- * {@link AppContext} of the app which we're currently being shown in.- */- showMiniDialog: BaseContextT["showMiniDialog"];/*** TODO: Rename and flip to allowEdits.*/@@ -141,7 +136,6 @@ export interface FileInfoProps {export const FileInfo: React.FC<FileInfoProps> = ({file,- showMiniDialog,shouldDisableEdits,allowMap,showInfo,@@ -155,6 +149,8 @@ export const FileInfo: React.FC<FileInfoProps> = ({onSelectCollection,onSelectPerson,}) => {+ const { showMiniDialog } = useBaseContext();+const { mapEnabled } = useSettingsSnapshot();const [exifInfo, setExifInfo] = useState<ExifInfo | undefined>();@@ -916,6 +912,7 @@ const MapBox: React.FC<MapBoxProps> = ({}}}+ // eslint-disable-next-line react-hooks/exhaustive-deps}, [mapEnabled]);return mapEnabled ? (