π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Consolidate constants
Manav Rathi4f764dc77c93
diff --git a/web/apps/photos/src/components/ExportInProgress.tsx b/web/apps/photos/src/components/ExportInProgress.tsxindex ce2da895c0..280ae52d4d 100644--- a/web/apps/photos/src/components/ExportInProgress.tsx+++ b/web/apps/photos/src/components/ExportInProgress.tsx@@ -10,9 +10,9 @@ import {LinearProgress,styled,} from "@mui/material";-import { ExportStage } from "constants/export";import { t } from "i18next";import { Trans } from "react-i18next";+import { ExportStage } from "services/export";import { ExportProgress } from "types/export";export const ComfySpan = styled("span")`diff --git a/web/apps/photos/src/components/ExportModal.tsx b/web/apps/photos/src/components/ExportModal.tsxindex 877dee90f1..159c872e44 100644--- a/web/apps/photos/src/components/ExportModal.tsx+++ b/web/apps/photos/src/components/ExportModal.tsx@@ -14,12 +14,11 @@ import {Switch,Typography,} from "@mui/material";-import { ExportStage } from "constants/export";import { t } from "i18next";import isElectron from "is-electron";import { AppContext } from "pages/_app";import { useContext, useEffect, useState } from "react";-import exportService from "services/export";+import exportService, { ExportStage } from "services/export";import { ExportProgress, ExportSettings } from "types/export";import { EnteFile } from "types/file";import { getExportDirectoryDoesNotExistMessage } from "utils/ui";diff --git a/web/apps/photos/src/constants/export.ts b/web/apps/photos/src/constants/export.tsdeleted file mode 100644index 692ee3843f..0000000000--- a/web/apps/photos/src/constants/export.ts+++ /dev/null@@ -1,12 +0,0 @@-export const ENTE_METADATA_FOLDER = "metadata";--export enum ExportStage {- INIT = 0,- MIGRATION = 1,- STARTING = 2,- EXPORTING_FILES = 3,- TRASHING_DELETED_FILES = 4,- RENAMING_COLLECTION_FOLDERS = 5,- TRASHING_DELETED_COLLECTIONS = 6,- FINISHED = 7,-}diff --git a/web/apps/photos/src/services/export/index.ts b/web/apps/photos/src/services/export/index.tsindex f6a98e069e..419db15876 100644--- a/web/apps/photos/src/services/export/index.ts+++ b/web/apps/photos/src/services/export/index.ts@@ -10,7 +10,6 @@ import QueueProcessor, {CancellationStatus,RequestCanceller,} from "@ente/shared/utils/queueProcessor";-import { ENTE_METADATA_FOLDER, ExportStage } from "constants/export";import { FILE_TYPE } from "constants/file";import { Collection } from "types/collection";import {@@ -50,6 +49,19 @@ const EXPORT_RECORD_FILE_NAME = "export_status.json";export const ENTE_EXPORT_DIRECTORY = "ente Photos";+export const ENTE_METADATA_FOLDER = "metadata";++export enum ExportStage {+ INIT = 0,+ MIGRATION = 1,+ STARTING = 2,+ EXPORTING_FILES = 3,+ TRASHING_DELETED_FILES = 4,+ RENAMING_COLLECTION_FOLDERS = 5,+ TRASHING_DELETED_COLLECTIONS = 6,+ FINISHED = 7,+}+export const NULL_EXPORT_RECORD: ExportRecord = {version: 3,lastAttemptTimestamp: null,diff --git a/web/apps/photos/src/services/export/migration.ts b/web/apps/photos/src/services/export/migration.tsindex 68ea9a4626..49265cf348 100644--- a/web/apps/photos/src/services/export/migration.ts+++ b/web/apps/photos/src/services/export/migration.ts@@ -2,7 +2,6 @@ import log from "@/next/log";import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";import { User } from "@ente/shared/user/types";import { sleep } from "@ente/shared/utils";-import { ENTE_METADATA_FOLDER } from "constants/export";import { FILE_TYPE } from "constants/file";import { getLocalCollections } from "services/collectionService";import downloadManager from "services/download";@@ -29,6 +28,7 @@ import {} from "utils/file";import { sanitizeName } from "utils/native-fs";import {+ ENTE_METADATA_FOLDER,getCollectionIDFromFileUID,getExportRecordFileUID,getLivePhotoExportName,diff --git a/web/apps/photos/src/types/export/index.ts b/web/apps/photos/src/types/export/index.tsindex ce85f32fd1..64ef249eda 100644--- a/web/apps/photos/src/types/export/index.ts+++ b/web/apps/photos/src/types/export/index.ts@@ -1,4 +1,4 @@-import { ExportStage } from "constants/export";+import type { ExportStage } from "services/export";import { EnteFile } from "types/file";export interface ExportProgress {diff --git a/web/apps/photos/src/utils/upload/index.ts b/web/apps/photos/src/utils/upload/index.tsindex 6cce03aa9d..708ec5dcf7 100644--- a/web/apps/photos/src/utils/upload/index.ts+++ b/web/apps/photos/src/utils/upload/index.ts@@ -1,4 +1,3 @@-import { ENTE_METADATA_FOLDER } from "constants/export";import { FILE_TYPE } from "constants/file";import {A_SEC_IN_MICROSECONDS,@@ -6,6 +5,7 @@ import {PICKED_UPLOAD_TYPE,} from "constants/upload";import isElectron from "is-electron";+import { ENTE_METADATA_FOLDER } from "services/export";import { EnteFile } from "types/file";import {ElectronFile,