π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove intermediary
Manav Rathi0a424deceb2e
diff --git a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsxindex d69e80ab90..24f7d56bbb 100644--- a/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx+++ b/web/apps/photos/src/components/Collections/GalleryBarAndListHeader.tsx@@ -13,7 +13,6 @@ import {type CollectionsSortBy,type CollectionSummaries,} from "@/new/photos/services/collection/ui";-import { AppContext } from "@/new/photos/types/context";import { includes } from "@/utils/type-guards";import {getData,@@ -24,13 +23,7 @@ import AllCollections from "components/Collections/AllCollections";import { SetCollectionNamerAttributes } from "components/Collections/CollectionNamer";import CollectionShare from "components/Collections/CollectionShare";import { ITEM_TYPE, TimeStampListItem } from "components/PhotoList";-import React, {- useCallback,- useContext,- useEffect,- useMemo,- useState,-} from "react";+import React, { useCallback, useEffect, useMemo, useState } from "react";import { sortCollectionSummaries } from "services/collectionService";import { SetFilesDownloadProgressAttributesCreator } from "types/gallery";import { ALL_SECTION } from "utils/collection";@@ -101,8 +94,6 @@ export const GalleryBarAndListHeader: React.FC<CollectionsProps> = ({filesDownloadProgressAttributesList,setFilesDownloadProgressAttributesCreator,}) => {- const appContext = useContext(AppContext);-const [openAllCollectionDialog, setOpenAllCollectionDialog] =useState(false);const [openCollectionShareView, setOpenCollectionShareView] =@@ -174,7 +165,7 @@ export const GalleryBarAndListHeader: React.FC<CollectionsProps> = ({) : activePerson ? (<PeopleHeaderperson={activePerson}- {...{ onSelectPerson, people, appContext }}+ {...{ onSelectPerson, people }}/>) : (<></>diff --git a/web/packages/new/photos/components/MLSettings.tsx b/web/packages/new/photos/components/MLSettings.tsxindex 6cbf2b6a27..cf55625bf3 100644--- a/web/packages/new/photos/components/MLSettings.tsx+++ b/web/packages/new/photos/components/MLSettings.tsx@@ -27,7 +27,7 @@ import {import { t } from "i18next";import React, { useEffect, useState, useSyncExternalStore } from "react";import { Trans } from "react-i18next";-import { useAppContext, type NewAppContextPhotos } from "../types/context";+import { useAppContext, type AppContextT } from "../types/context";import { openURL } from "../utils/web";import { useWrapAsyncOperation } from "./use-wrap-async";@@ -253,7 +253,7 @@ interface ManageMLProps {/** Called when the user wants to disable ML. */onDisableML: () => void;/** Subset of appContext. */- setDialogBoxAttributesV2: NewAppContextPhotos["setDialogBoxAttributesV2"];+ setDialogBoxAttributesV2: AppContextT["setDialogBoxAttributesV2"];}const ManageML: React.FC<ManageMLProps> = ({diff --git a/web/packages/new/photos/components/gallery/PeopleHeader.tsx b/web/packages/new/photos/components/gallery/PeopleHeader.tsxindex 6187689f11..301679a2ab 100644--- a/web/packages/new/photos/components/gallery/PeopleHeader.tsx+++ b/web/packages/new/photos/components/gallery/PeopleHeader.tsx@@ -16,7 +16,7 @@ import { t } from "i18next";import React, { useState } from "react";import type { FaceCluster } from "../../services/ml/cluster";import type { CGroup } from "../../services/user-entity";-import type { NewAppContextPhotos } from "../../types/context";+import { useAppContext } from "../../types/context";import { AddPersonDialog } from "../AddPersonDialog";import { SpaceBetweenFlex } from "../mui";import { NameInputDialog } from "../NameInputDialog";@@ -50,14 +50,12 @@ type PeopleHeaderProps = Pick<"people" | "onSelectPerson"> & {person: Person;- appContext: NewAppContextPhotos;};export const PeopleHeader: React.FC<PeopleHeaderProps> = ({people,onSelectPerson,person,- appContext,}) => {return (<GalleryItemsHeaderAdapter>@@ -72,12 +70,12 @@ export const PeopleHeader: React.FC<PeopleHeaderProps> = ({{person.type == "cgroup" ? (<CGroupPersonOptionscgroup={person.cgroup}- {...{ onSelectPerson, appContext }}+ {...{ onSelectPerson }}/>) : (<ClusterPersonOptionscluster={person.cluster}- {...{ people, appContext }}+ {...{ people }}/>)}</SpaceBetweenFlex>@@ -85,16 +83,12 @@ export const PeopleHeader: React.FC<PeopleHeaderProps> = ({);};-type CGroupPersonOptionsProps = Pick<- PeopleHeaderProps,- "appContext" | "onSelectPerson"-> & {+type CGroupPersonOptionsProps = Pick<PeopleHeaderProps, "onSelectPerson"> & {cgroup: CGroup;};const CGroupPersonOptions: React.FC<CGroupPersonOptionsProps> = ({cgroup,- appContext,onSelectPerson,}) => {const {@@ -102,7 +96,7 @@ const CGroupPersonOptions: React.FC<CGroupPersonOptionsProps> = ({finishLoading,onGenericError,setDialogBoxAttributesV2,- } = appContext;+ } = useAppContext();const [openAddNameInput, setOpenAddNameInput] = useState(false);@@ -182,19 +176,15 @@ const CGroupPersonOptions: React.FC<CGroupPersonOptionsProps> = ({);};-type ClusterPersonOptionsProps = Pick<- PeopleHeaderProps,- "people" | "appContext"-> & {+type ClusterPersonOptionsProps = Pick<PeopleHeaderProps, "people"> & {cluster: FaceCluster;};const ClusterPersonOptions: React.FC<ClusterPersonOptionsProps> = ({people,cluster,- appContext,}) => {- const { startLoading, finishLoading } = appContext;+ const { startLoading, finishLoading } = useAppContext();const [openNameInput, setOpenNameInput] = useState(false);const [openAddPersonDialog, setOpenAddPersonDialog] = useState(false);diff --git a/web/packages/new/photos/types/context.ts b/web/packages/new/photos/types/context.tsindex f0a3e08feb..2235c35c11 100644--- a/web/packages/new/photos/types/context.ts+++ b/web/packages/new/photos/types/context.ts@@ -1,33 +1,14 @@import type { AccountsContextT } from "@/accounts/types/context";import { ensure } from "@/utils/ensure";import type { SetDialogBoxAttributes } from "@ente/shared/components/DialogBox/types";-import type { DialogBoxAttributesV2 } from "@ente/shared/components/DialogBoxV2/types";import { THEME_COLOR } from "@ente/shared/themes/constants";import { createContext, useContext } from "react";import type { SetNotificationAttributes } from "./notification";-/**- * A subset of the AppContext type used by the photos app.- *- * [Note: Migrating components that need the app context]- *- * This only exists to make it easier to migrate code into the @/new package.- * Once we move this code back (after TypeScript strict mode migration is done),- * then the code that uses this can start directly using the actual app context- * instead of needing to explicitly pass a prop of this type.- * */-export interface NewAppContextPhotos {- startLoading: () => void;- finishLoading: () => void;- setDialogBoxAttributesV2: (attrs: DialogBoxAttributesV2) => void;- somethingWentWrong: () => void;- onGenericError: (error: unknown) => void;-}-/*** The type of the React context available to all pages in the photos app.*/-type AppContextT = AccountsContextT & {+export type AppContextT = AccountsContextT & {/*** Show the global activity indicator (a green bar at the top of the page).*/