π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Rename 2
Manav Rathib65a7055c110
diff --git a/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx b/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsxindex f7b38a4e99..c6cb2e4caf 100644--- a/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx+++ b/web/apps/photos/src/components/Collections/CollectionInfoWithOptions.tsx@@ -37,16 +37,16 @@ export default function CollectionInfoWithOptions({const EndIcon = ({ type }: { type: CollectionSummaryType }) => {switch (type) {- case CollectionSummaryType.favorites:+ case "favorites":return <Favorite />;- case CollectionSummaryType.archived:+ case "archived":return <ArchiveOutlined />;- case CollectionSummaryType.incomingShareViewer:- case CollectionSummaryType.incomingShareCollaborator:+ case "incomingShareViewer":+ case "incomingShareCollaborator":return <PeopleIcon />;- case CollectionSummaryType.outgoingShare:+ case "outgoingShare":return <PeopleIcon />;- case CollectionSummaryType.sharedOnlyViaLink:+ case "sharedOnlyViaLink":return <LinkIcon />;default:return <></>;diff --git a/web/apps/photos/src/components/Collections/CollectionListBar.tsx b/web/apps/photos/src/components/Collections/CollectionListBar.tsxindex 0a68d5410e..cca057736d 100644--- a/web/apps/photos/src/components/Collections/CollectionListBar.tsx+++ b/web/apps/photos/src/components/Collections/CollectionListBar.tsx@@ -25,7 +25,7 @@ import memoize from "memoize-one";import React, { useEffect, useRef, useState } from "react";import AutoSizer from "react-virtualized-auto-sizer";import { FixedSizeList, ListChildComponentProps, areEqual } from "react-window";-import { CollectionSummary, CollectionSummaryType } from "types/collection";+import { CollectionSummary } from "types/collection";import { ALL_SECTION, COLLECTION_LIST_SORT_BY } from "utils/collection";import type { GalleryBarMode } from ".";import CollectionCard from "./CollectionCard";@@ -444,26 +444,21 @@ function CollectionCardText({ collectionName }) {function CollectionCardIcon({ collectionType }) {return (<CollectionBarTileIcon>- {collectionType === CollectionSummaryType.favorites && <Favorite />}- {collectionType === CollectionSummaryType.archived && (+ {collectionType == "favorites" && <Favorite />}+ {collectionType == "archived" && (<ArchiveIconsx={(theme) => ({color: theme.colors.white.muted,})}/>)}- {collectionType === CollectionSummaryType.outgoingShare && (+ {collectionType == "outgoingShare" && <PeopleIcon />}+ {(collectionType == "incomingShareViewer" ||+ collectionType == "incomingShareCollaborator") && (<PeopleIcon />)}- {(collectionType === CollectionSummaryType.incomingShareViewer ||- collectionType ===- CollectionSummaryType.incomingShareCollaborator) && (- <PeopleIcon />- )}- {collectionType === CollectionSummaryType.sharedOnlyViaLink && (- <LinkIcon />- )}- {collectionType === CollectionSummaryType.pinned && <PushPin />}+ {collectionType == "sharedOnlyViaLink" && <LinkIcon />}+ {collectionType == "pinned" && <PushPin />}</CollectionBarTileIcon>);}diff --git a/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx b/web/apps/photos/src/components/Collections/CollectionOptions/index.tsxindex c9c9641fe1..020443a50b 100644--- a/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx+++ b/web/apps/photos/src/components/Collections/CollectionOptions/index.tsx@@ -221,7 +221,7 @@ const CollectionOptions = (props: CollectionOptionsProps) => {if (isActiveCollectionDownloadInProgress()) {return;}- if (collectionSummaryType === CollectionSummaryType.hiddenItems) {+ if (collectionSummaryType == "hiddenItems") {const setFilesDownloadProgressAttributes =setFilesDownloadProgressAttributesCreator(activeCollection.name,@@ -360,33 +360,28 @@ const CollectionOptions = (props: CollectionOptionsProps) => {ariaControls={"collection-options"}triggerButtonIcon={<MoreHoriz ref={overFlowMenuIconRef} />}>- {collectionSummaryType === CollectionSummaryType.trash ? (+ {collectionSummaryType == "trash" ? (<TrashCollectionOptionhandleCollectionAction={handleCollectionAction}/>- ) : collectionSummaryType ===- CollectionSummaryType.favorites ? (+ ) : collectionSummaryType == "favorites" ? (<OnlyDownloadCollectionOptionisDownloadInProgress={isActiveCollectionDownloadInProgress()}handleCollectionAction={handleCollectionAction}downloadOptionText={t("DOWNLOAD_FAVORITES")}/>- ) : collectionSummaryType ===- CollectionSummaryType.uncategorized ? (+ ) : collectionSummaryType == "uncategorized" ? (<OnlyDownloadCollectionOptionhandleCollectionAction={handleCollectionAction}downloadOptionText={t("DOWNLOAD_UNCATEGORIZED")}/>- ) : collectionSummaryType ===- CollectionSummaryType.hiddenItems ? (+ ) : collectionSummaryType == "hiddenItems" ? (<OnlyDownloadCollectionOptionhandleCollectionAction={handleCollectionAction}downloadOptionText={t("DOWNLOAD_HIDDEN_ITEMS")}/>- ) : collectionSummaryType ===- CollectionSummaryType.incomingShareViewer ||- collectionSummaryType ===- CollectionSummaryType.incomingShareCollaborator ? (+ ) : collectionSummaryType == "incomingShareViewer" ||+ collectionSummaryType == "incomingShareCollaborator" ? (<SharedCollectionOptionisArchived={isArchivedCollection(activeCollection)}handleCollectionAction={handleCollectionAction}@@ -453,7 +448,7 @@ export const QuickOptions: React.FC<QuickOptionsProps> = ({};const showEmptyTrashQuickOption = (type: CollectionSummaryType) => {- return type === CollectionSummaryType.trash;+ return type == "trash";};interface EmptyTrashQuickOptionProps {@@ -480,17 +475,17 @@ export const EmptyTrashQuickOption: React.FC<EmptyTrashQuickOptionProps> = ({const showDownloadQuickOption = (type: CollectionSummaryType) => {return (- type === CollectionSummaryType.folder ||- type === CollectionSummaryType.favorites ||- type === CollectionSummaryType.album ||- type === CollectionSummaryType.uncategorized ||- type === CollectionSummaryType.hiddenItems ||- type === CollectionSummaryType.incomingShareViewer ||- type === CollectionSummaryType.incomingShareCollaborator ||- type === CollectionSummaryType.outgoingShare ||- type === CollectionSummaryType.sharedOnlyViaLink ||- type === CollectionSummaryType.archived ||- type === CollectionSummaryType.pinned+ type == "folder" ||+ type == "favorites" ||+ type == "album" ||+ type == "uncategorized" ||+ type == "hiddenItems" ||+ type == "incomingShareViewer" ||+ type == "incomingShareCollaborator" ||+ type == "outgoingShare" ||+ type == "sharedOnlyViaLink" ||+ type == "archived" ||+ type == "pinned");};@@ -508,11 +503,11 @@ const DownloadQuickOption: React.FC<DownloadQuickOptionProps> = ({}) => (<Tooltiptitle={- collectionSummaryType === CollectionSummaryType.favorites+ collectionSummaryType == "favorites"? t("DOWNLOAD_FAVORITES")- : collectionSummaryType === CollectionSummaryType.uncategorized+ : collectionSummaryType == "uncategorized"? t("DOWNLOAD_UNCATEGORIZED")- : collectionSummaryType === CollectionSummaryType.hiddenItems+ : collectionSummaryType == "hiddenItems"? t("DOWNLOAD_HIDDEN_ITEMS"): t("DOWNLOAD_COLLECTION")}@@ -527,14 +522,14 @@ const DownloadQuickOption: React.FC<DownloadQuickOptionProps> = ({const showShareQuickOption = (type: CollectionSummaryType) => {return (- type === CollectionSummaryType.folder ||- type === CollectionSummaryType.album ||- type === CollectionSummaryType.outgoingShare ||- type === CollectionSummaryType.sharedOnlyViaLink ||- type === CollectionSummaryType.archived ||- type === CollectionSummaryType.incomingShareViewer ||- type === CollectionSummaryType.incomingShareCollaborator ||- type === CollectionSummaryType.pinned+ type == "folder" ||+ type == "album" ||+ type == "outgoingShare" ||+ type == "sharedOnlyViaLink" ||+ type == "archived" ||+ type == "incomingShareViewer" ||+ type == "incomingShareCollaborator" ||+ type == "pinned");};@@ -552,15 +547,11 @@ const ShareQuickOption: React.FC<ShareQuickOptionProps> = ({}) => (<Tooltiptitle={- collectionSummaryType ===- CollectionSummaryType.incomingShareViewer ||- collectionSummaryType ===- CollectionSummaryType.incomingShareCollaborator+ collectionSummaryType == "incomingShareViewer" ||+ collectionSummaryType == "incomingShareCollaborator"? t("SHARING_DETAILS")- : collectionSummaryType ===- CollectionSummaryType.outgoingShare ||- collectionSummaryType ===- CollectionSummaryType.sharedOnlyViaLink+ : collectionSummaryType == "outgoingShare" ||+ collectionSummaryType == "sharedOnlyViaLink"? t("MODIFY_SHARING"): t("SHARE_COLLECTION")}diff --git a/web/apps/photos/src/components/Collections/CollectionSelector/index.tsx b/web/apps/photos/src/components/Collections/CollectionSelector/index.tsxindex 4132360aad..878dd0d38d 100644--- a/web/apps/photos/src/components/Collections/CollectionSelector/index.tsx+++ b/web/apps/photos/src/components/Collections/CollectionSelector/index.tsx@@ -6,11 +6,7 @@ import { AllCollectionDialog } from "components/Collections/AllCollections/dialoimport { t } from "i18next";import { useEffect, useState } from "react";import { createUnCategorizedCollection } from "services/collectionService";-import {- CollectionSummaries,- CollectionSummary,- CollectionSummaryType,-} from "types/collection";+import { CollectionSummaries, CollectionSummary } from "types/collection";import { CollectionSelectorIntent } from "types/gallery";import {COLLECTION_SORT_ORDER,@@ -65,14 +61,14 @@ function CollectionSelector({) {return (isMoveToAllowedCollection(type) ||- type === CollectionSummaryType.uncategorized+ type == "uncategorized");} else if (attributes.intent === CollectionSelectorIntent.restore) {return (isMoveToAllowedCollection(type) ||- type === CollectionSummaryType.uncategorized+ type == "uncategorized");} else {return isMoveToAllowedCollection(type);diff --git a/web/apps/photos/src/components/Collections/CollectionShare/index.tsx b/web/apps/photos/src/components/Collections/CollectionShare/index.tsxindex f970df0589..8384a067b6 100644--- a/web/apps/photos/src/components/Collections/CollectionShare/index.tsx+++ b/web/apps/photos/src/components/Collections/CollectionShare/index.tsx@@ -3,7 +3,7 @@ import { Titlebar } from "@/base/components/Titlebar";import type { Collection } from "@/media/collection";import { DialogProps, Stack } from "@mui/material";import { t } from "i18next";-import { CollectionSummary, CollectionSummaryType } from "types/collection";+import { CollectionSummary } from "types/collection";import EmailShare from "./emailShare";import PublicShare from "./publicShare";import SharingDetails from "./sharingDetails";@@ -46,9 +46,8 @@ function CollectionShare({ collectionSummary, ...props }: Props) {<TitlebaronClose={props.onClose}title={- type ===- CollectionSummaryType.incomingShareCollaborator ||- type === CollectionSummaryType.incomingShareViewer+ type == "incomingShareCollaborator" ||+ type == "incomingShareViewer"? t("SHARING_DETAILS"): t("SHARE_COLLECTION")}@@ -56,8 +55,8 @@ function CollectionShare({ collectionSummary, ...props }: Props) {caption={props.collection.name}/><Stack py={"20px"} px={"8px"} gap={"24px"}>- {type === CollectionSummaryType.incomingShareCollaborator ||- type === CollectionSummaryType.incomingShareViewer ? (+ {type == "incomingShareCollaborator" ||+ type == "incomingShareViewer" ? (<SharingDetailscollection={props.collection}type={type}diff --git a/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsx b/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsxindex 4d557f211f..6ac26cf3aa 100644--- a/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsx+++ b/web/apps/photos/src/components/Collections/CollectionShare/sharingDetails.tsx@@ -52,7 +52,7 @@ export default function SharingDetails({ collection, type }) {/></MenuItemGroup></Stack>- {type === CollectionSummaryType.incomingShareCollaborator &&+ {type == "incomingShareCollaborator" &&collaborators?.length > 0 && (<Stack><MenuSectionTitlediff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsxindex 0e6cde3882..6613452e5e 100644--- a/web/apps/photos/src/pages/gallery.tsx+++ b/web/apps/photos/src/pages/gallery.tsx@@ -113,7 +113,7 @@ import { preFileInfoSync, sync } from "services/sync";import { syncTrash } from "services/trashService";import uploadManager from "services/upload/uploadManager";import { isTokenValid } from "services/userService";-import { CollectionSummaries, CollectionSummaryType } from "types/collection";+import { CollectionSummaries } from "types/collection";import {GalleryContextType,SelectedState,@@ -1250,20 +1250,17 @@ export default function Gallery() {)}isFavoriteCollection={collectionSummaries.get(activeCollectionID)- ?.type === CollectionSummaryType.favorites+ ?.type == "favorites"}isUncategorizedCollection={collectionSummaries.get(activeCollectionID)- ?.type ===- CollectionSummaryType.uncategorized+ ?.type == "uncategorized"}isIncomingSharedCollection={collectionSummaries.get(activeCollectionID)- ?.type ===- CollectionSummaryType.incomingShareCollaborator ||+ ?.type == "incomingShareCollaborator" ||collectionSummaries.get(activeCollectionID)- ?.type ===- CollectionSummaryType.incomingShareViewer+ ?.type == "incomingShareViewer"}isInSearchMode={isInSearchMode}isInHiddenSection={barMode == "hidden-albums"}diff --git a/web/apps/photos/src/services/collectionService.ts b/web/apps/photos/src/services/collectionService.tsindex 622c9a9662..00f98ca629 100644--- a/web/apps/photos/src/services/collectionService.ts+++ b/web/apps/photos/src/services/collectionService.ts@@ -1130,28 +1130,44 @@ export function getCollectionSummaries(let type: CollectionSummaryType;if (isIncomingShare(collection, user)) {if (isIncomingCollabShare(collection, user)) {- type = CollectionSummaryType.incomingShareCollaborator;+ type = "incomingShareCollaborator";} else {- type = CollectionSummaryType.incomingShareViewer;+ type = "incomingShareViewer";}} else if (isOutgoingShare(collection, user)) {- type = CollectionSummaryType.outgoingShare;+ type = "outgoingShare";} else if (isSharedOnlyViaLink(collection)) {- type = CollectionSummaryType.sharedOnlyViaLink;+ type = "sharedOnlyViaLink";} else if (isArchivedCollection(collection)) {- type = CollectionSummaryType.archived;+ type = "archived";} else if (isDefaultHiddenCollection(collection)) {- type = CollectionSummaryType.defaultHidden;+ type = "defaultHidden";} else if (isPinnedCollection(collection)) {- type = CollectionSummaryType.pinned;+ type = "pinned";} else {- type = CollectionSummaryType[collection.type];+ // Directly use the collection type+ // TODO: The constants can be aligned once collection type goes from+ // an enum to an union.+ switch (collection.type) {+ case CollectionType.folder:+ type = "folder";+ break;+ case CollectionType.favorites:+ type = "favorites";+ break;+ case CollectionType.album:+ type = "album";+ break;+ case CollectionType.uncategorized:+ type = "uncategorized";+ break;+ }}let CollectionSummaryItemName: string;- if (type === CollectionSummaryType.uncategorized) {+ if (type == "uncategorized") {CollectionSummaryItemName = t("UNCATEGORIZED");- } else if (type === CollectionSummaryType.favorites) {+ } else if (type == "favorites") {CollectionSummaryItemName = t("FAVORITES");} else {CollectionSummaryItemName = collection.name;@@ -1217,7 +1233,7 @@ function getAllSectionSummary(return {id: ALL_SECTION,name: t("ALL_SECTION_NAME"),- type: CollectionSummaryType.all,+ type: "all",coverFile: allSectionFiles?.[0],latestFile: allSectionFiles?.[0],fileCount: allSectionFiles?.length || 0,@@ -1247,7 +1263,7 @@ export function getDummyUncategorizedCollectionSummary(): CollectionSummary {return {id: DUMMY_UNCATEGORIZED_COLLECTION,name: t("UNCATEGORIZED"),- type: CollectionSummaryType.uncategorized,+ type: "uncategorized",latestFile: null,coverFile: null,fileCount: 0,@@ -1264,7 +1280,7 @@ export function getArchivedSectionSummary(return {id: ARCHIVE_SECTION,name: t("ARCHIVE_SECTION_NAME"),- type: CollectionSummaryType.archive,+ type: "archive",coverFile: null,latestFile: archivedFiles?.[0],fileCount: archivedFiles?.length,@@ -1289,7 +1305,7 @@ export function getHiddenItemsSummary(return {id: HIDDEN_ITEMS_SECTION,name: t("HIDDEN_ITEMS"),- type: CollectionSummaryType.hiddenItems,+ type: "hiddenItems",coverFile: hiddenItems?.[0],latestFile: hiddenItems?.[0],fileCount: hiddenItems?.length,@@ -1303,7 +1319,7 @@ export function getTrashedCollectionSummary(return {id: TRASH_SECTION,name: t("TRASH"),- type: CollectionSummaryType.trash,+ type: "trash",coverFile: null,latestFile: trashedFiles?.[0],fileCount: trashedFiles?.length,diff --git a/web/apps/photos/src/utils/collection.ts b/web/apps/photos/src/utils/collection.tsindex 6030a548b1..2b000d6f76 100644--- a/web/apps/photos/src/utils/collection.ts+++ b/web/apps/photos/src/utils/collection.ts@@ -48,59 +48,59 @@ export enum COLLECTION_LIST_SORT_BY {UPDATION_TIME_DESCENDING,}-export const COLLECTION_SORT_ORDER = new Map([- [CollectionSummaryType.all, 0],- [CollectionSummaryType.hiddenItems, 0],- [CollectionSummaryType.uncategorized, 1],- [CollectionSummaryType.favorites, 2],- [CollectionSummaryType.pinned, 3],- [CollectionSummaryType.album, 4],- [CollectionSummaryType.folder, 4],- [CollectionSummaryType.incomingShareViewer, 4],- [CollectionSummaryType.incomingShareCollaborator, 4],- [CollectionSummaryType.outgoingShare, 4],- [CollectionSummaryType.sharedOnlyViaLink, 4],- [CollectionSummaryType.archived, 4],- [CollectionSummaryType.archive, 5],- [CollectionSummaryType.trash, 6],- [CollectionSummaryType.defaultHidden, 7],+export const COLLECTION_SORT_ORDER = new Map<CollectionSummaryType, number>([+ ["all", 0],+ ["hiddenItems", 0],+ ["uncategorized", 1],+ ["favorites", 2],+ ["pinned", 3],+ ["album", 4],+ ["folder", 4],+ ["incomingShareViewer", 4],+ ["incomingShareCollaborator", 4],+ ["outgoingShare", 4],+ ["sharedOnlyViaLink", 4],+ ["archived", 4],+ ["archive", 5],+ ["trash", 6],+ ["defaultHidden", 7],]);-const SYSTEM_COLLECTION_TYPES = new Set([- CollectionSummaryType.all,- CollectionSummaryType.archive,- CollectionSummaryType.trash,- CollectionSummaryType.uncategorized,- CollectionSummaryType.hiddenItems,- CollectionSummaryType.defaultHidden,+const SYSTEM_COLLECTION_TYPES = new Set<CollectionSummaryType>([+ "all",+ "archive",+ "trash",+ "uncategorized",+ "hiddenItems",+ "defaultHidden",]);-const ADD_TO_NOT_ALLOWED_COLLECTION = new Set([- CollectionSummaryType.all,- CollectionSummaryType.archive,- CollectionSummaryType.incomingShareViewer,- CollectionSummaryType.trash,- CollectionSummaryType.uncategorized,- CollectionSummaryType.defaultHidden,- CollectionSummaryType.hiddenItems,+const ADD_TO_NOT_ALLOWED_COLLECTION = new Set<CollectionSummaryType>([+ "all",+ "archive",+ "incomingShareViewer",+ "trash",+ "uncategorized",+ "defaultHidden",+ "hiddenItems",]);-const MOVE_TO_NOT_ALLOWED_COLLECTION = new Set([- CollectionSummaryType.all,- CollectionSummaryType.archive,- CollectionSummaryType.incomingShareViewer,- CollectionSummaryType.incomingShareCollaborator,- CollectionSummaryType.trash,- CollectionSummaryType.uncategorized,- CollectionSummaryType.defaultHidden,- CollectionSummaryType.hiddenItems,+const MOVE_TO_NOT_ALLOWED_COLLECTION = new Set<CollectionSummaryType>([+ "all",+ "archive",+ "incomingShareViewer",+ "incomingShareCollaborator",+ "trash",+ "uncategorized",+ "defaultHidden",+ "hiddenItems",]);-const HIDE_FROM_COLLECTION_BAR_TYPES = new Set([- CollectionSummaryType.trash,- CollectionSummaryType.archive,- CollectionSummaryType.uncategorized,- CollectionSummaryType.defaultHidden,+const HIDE_FROM_COLLECTION_BAR_TYPES = new Set<CollectionSummaryType>([+ "trash",+ "archive",+ "uncategorized",+ "defaultHidden",]);export enum COLLECTION_OPS_TYPE {