π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
attr
Manav Rathie70d704cede6
diff --git a/web/apps/photos/src/components/Collections/CollectionHeader.tsx b/web/apps/photos/src/components/Collections/CollectionHeader.tsxindex ba37199e03..81b710a0b1 100644--- a/web/apps/photos/src/components/Collections/CollectionHeader.tsx+++ b/web/apps/photos/src/components/Collections/CollectionHeader.tsx@@ -89,12 +89,8 @@ export const CollectionHeader: React.FC<CollectionHeaderProps> = (props) => {if (attributes.has("archived")) return <ArchiveOutlinedIcon />;if (attributes.has("sharedOnlyViaLink")) return <LinkIcon />;if (attributes.has("shared")) return <PeopleIcon />;- switch (type) {- case "favorites":- return <FavoriteRoundedIcon />;- default:- return <></>;- }+ if (attributes.has("userFavorites")) return <FavoriteRoundedIcon />;+ return <></>;};return (@@ -313,7 +309,7 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({];break;- case "favorites":+ case "userFavorites":menuOptions = [<DownloadOptionkey="download"@@ -494,7 +490,6 @@ const CollectionHeaderOptions: React.FC<CollectionHeaderProps> = ({<Box sx={{ display: "inline-flex", gap: "16px" }}><QuickOptionscollectionSummary={collectionSummary}- collectionSummaryType={collectionSummaryType}isDownloadInProgress={isActiveCollectionDownloadInProgress}onEmptyTrashClick={confirmEmptyTrash}onDownloadClick={downloadCollection}@@ -533,7 +528,6 @@ interface OptionProps {interface QuickOptionsProps {collectionSummary: CollectionSummary;- collectionSummaryType: CollectionSummary["type"];isDownloadInProgress: () => boolean;onEmptyTrashClick: () => void;onDownloadClick: () => void;@@ -545,11 +539,10 @@ const QuickOptions: React.FC<QuickOptionsProps> = ({onDownloadClick,onShareClick,collectionSummary,- collectionSummaryType: type,isDownloadInProgress,}) => (<Stack direction="row" sx={{ alignItems: "center", gap: "16px" }}>- {showEmptyTrashQuickOption(type) && (+ {showEmptyTrashQuickOption(collectionSummary) && (<EmptyTrashQuickOption onClick={onEmptyTrashClick} />)}{showDownloadQuickOption(collectionSummary) &&@@ -557,21 +550,20 @@ const QuickOptions: React.FC<QuickOptionsProps> = ({<ActivityIndicator size="20px" sx={{ m: "12px" }} />) : (<DownloadQuickOption+ collectionSummary={collectionSummary}onClick={onDownloadClick}- collectionSummaryType={type}/>))}{showShareQuickOption(collectionSummary) && (<ShareQuickOption- onClick={onShareClick}collectionSummary={collectionSummary}- collectionSummaryType={type}+ onClick={onShareClick}/>)}</Stack>);-const showEmptyTrashQuickOption = (type: CollectionSummaryType) =>+const showEmptyTrashQuickOption = ({ type }: CollectionSummary) =>type == "trash";const EmptyTrashQuickOption: React.FC<OptionProps> = ({ onClick }) => (@@ -585,26 +577,26 @@ const EmptyTrashQuickOption: React.FC<OptionProps> = ({ onClick }) => (const showDownloadQuickOption = ({ type, attributes }: CollectionSummary) =>type == "album" ||type == "folder" ||- type == "favorites" ||type == "uncategorized" ||type == "hiddenItems" ||+ attributes.has("favorites") ||attributes.has("shared");type DownloadQuickOptionProps = OptionProps & {- collectionSummaryType: CollectionSummaryType;+ collectionSummary: CollectionSummary;};const DownloadQuickOption: React.FC<DownloadQuickOptionProps> = ({+ collectionSummary: { type },onClick,- collectionSummaryType,}) => (<Tooltiptitle={- collectionSummaryType == "favorites"+ type == "userFavorites"? t("download_favorites")- : collectionSummaryType == "uncategorized"+ : type == "uncategorized"? t("download_uncategorized")- : collectionSummaryType == "hiddenItems"+ : type == "hiddenItems"? t("download_hidden_items"): t("download_album")}@@ -618,27 +610,25 @@ const DownloadQuickOption: React.FC<DownloadQuickOptionProps> = ({const showShareQuickOption = ({ type, attributes }: CollectionSummary) =>type == "album" ||type == "folder" ||- type == "favorites" ||+ attributes.has("favorites") ||attributes.has("shared");interface ShareQuickOptionProps {- onClick: () => void;collectionSummary: CollectionSummary;- collectionSummaryType: CollectionSummaryType;+ onClick: () => void;}const ShareQuickOption: React.FC<ShareQuickOptionProps> = ({+ collectionSummary: { attributes },onClick,- collectionSummary,- collectionSummaryType,}) => (<Tooltiptitle={- collectionSummary.attributes.has("sharedIncoming")+ attributes.has("sharedIncoming")? t("sharing_details")- : collectionSummary.attributes.has("shared")+ : attributes.has("shared")? t("modify_sharing")- : collectionSummaryType == "favorites"+ : attributes.has("userFavorites")? t("share_favorites"): t("share_album")}diff --git a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsxindex 7baa0f80ac..e69fa522d1 100644--- a/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx+++ b/web/apps/photos/src/components/pages/gallery/SelectedFileOptions.tsx@@ -89,13 +89,14 @@ const SelectedFileOptions = ({const peopleMode = barMode == "people";- const isFavoriteCollection = activeCollectionSummary?.type == "favorites";+ const isFavoriteCollection =+ !!activeCollectionSummary?.attributes.has("userFavorites");const isUncategorizedCollection =activeCollectionSummary?.type == "uncategorized";const isSharedIncomingCollection =- activeCollectionSummary?.attributes.has("sharedIncoming");+ !!activeCollectionSummary?.attributes.has("sharedIncoming");const addToCollection = () =>onOpenCollectionSelector({diff --git a/web/packages/new/photos/components/gallery/BarImpl.tsx b/web/packages/new/photos/components/gallery/BarImpl.tsxindex 7f9c5c6fda..27198b86dc 100644--- a/web/packages/new/photos/components/gallery/BarImpl.tsx+++ b/web/packages/new/photos/components/gallery/BarImpl.tsx@@ -538,7 +538,7 @@ const CollectionBarCardIcon: React.FC<CollectionBarCardIconProps> = ({// will be true simultaneously even in the rarest of cases (a pinned and// shared album that is also archived), and there is enough space for 3.<CollectionBarCardIcon_>- {attributes.has("favorites") && <FavoriteRoundedIcon />}+ {attributes.has("userFavorites") && <FavoriteRoundedIcon />}{attributes.has("pinned") && (// Need && to override the 20px set in the container.<PushPinIcon sx={{ "&&": { fontSize: "18px" } }} />diff --git a/web/packages/new/photos/components/gallery/reducer.ts b/web/packages/new/photos/components/gallery/reducer.tsindex 22a77b07e9..429c584c5c 100644--- a/web/packages/new/photos/components/gallery/reducer.ts+++ b/web/packages/new/photos/components/gallery/reducer.ts@@ -1344,7 +1344,7 @@ const deriveNormalCollectionSummaries = (id: PseudoCollectionID.archiveItems,name: t("section_archive"),type: "archiveItems",- attributes: new Set(["archiveItems"]),+ attributes: new Set(),coverFile: undefined,sortPriority: CollectionSummarySortPriority.other,});@@ -1424,6 +1424,8 @@ const createCollectionSummaries = (let sortPriority: CollectionSummarySortPriority =CollectionSummarySortPriority.other;if (collection.owner.id != user.id) {+ // This case needs to be the first; the rest assume that they're+ // dealing with collections owned by the user.type = "sharedIncoming";} else if (collectionType == "uncategorized") {type = "uncategorized";@@ -1433,9 +1435,12 @@ const createCollectionSummaries = (//// "favorites" can be both the user's own favorites, or favorites of// other users shared with them. However, all of the latter will get- // typed as "sharedIncoming" in the first case above. So if a- // collection summary has type "favorites", it is guaranteed to be- // the user's own favorites.+ // typed as "sharedIncoming" in the first case above.+ //+ // So if we get here and the collection summary has type+ // "favorites", it is guaranteed to be the user's own favorites. We+ // mark these with the type "userFavorites", which gives it special+ // treatment like custom icon etc.//// However, notice that the type of the _collection_ itself is not// changed, so whenever we're checking the type of the collection@@ -1447,7 +1452,7 @@ const createCollectionSummaries = (// classification of this collection summary is that it is the// user's "favorites", everything else is secondary and can be part// of the `attributes` computed below.- type = collectionType;+ type = "userFavorites";sortPriority = CollectionSummarySortPriority.favorites;} else if (isDefaultHiddenCollection(collection)) {type = "defaultHidden";@@ -1486,23 +1491,12 @@ const createCollectionSummaries = (attributes.add("pinned");sortPriority = CollectionSummarySortPriority.pinned;}- switch (collectionType) {- case "favorites":- // We don't want to treat other folks' favorites specially like- // the user's own favorites (giving it a special icon etc), so- // only apply the favorites attribute if it is the user's own.- if (collection.owner.id == user.id)- attributes.add(collectionType);- break;- default:- attributes.add(collectionType);- break;- }+ attributes.add(collectionType);let name: string;if (type == "uncategorized") {name = t("section_uncategorized");- } else if (type == "favorites") {+ } else if (type == "userFavorites") {name = t("favorites");} else if (collectionType == "favorites") {// See: [Note: User and shared favorites] above.diff --git a/web/packages/new/photos/services/collection-summary.ts b/web/packages/new/photos/services/collection-summary.tsindex 7611e62d32..07a6d1e7d5 100644--- a/web/packages/new/photos/services/collection-summary.ts+++ b/web/packages/new/photos/services/collection-summary.ts@@ -8,18 +8,13 @@ export type CollectionSummaryType =| "defaultHidden"| "archiveItems"| "trash"+ | "userFavorites"| "sharedIncoming";export type CollectionSummaryAttribute =- | CollectionType- | "all"- | "hiddenItems"- | "defaultHidden"- | "archiveItems"- | "trash"+ | CollectionSummaryType| "shared"| "sharedOutgoing"- | "sharedIncoming"| "sharedIncomingViewer"| "sharedIncomingCollaborator"| "sharedOnlyViaLink"