π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove old code
Manav Rathid26c4a7a8463
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsxindex bfcc8bb96a..294f541551 100644--- a/web/apps/photos/src/pages/_app.tsx+++ b/web/apps/photos/src/pages/_app.tsx@@ -35,11 +35,7 @@ import {getData,migrateKVToken,} from "@ente/shared/storage/localStorage";-import {- getLocalMapEnabled,- getToken,- setLocalMapEnabled,-} from "@ente/shared/storage/localStorage/helpers";+import { getToken } from "@ente/shared/storage/localStorage/helpers";import { getTheme } from "@ente/shared/themes";import { THEME_COLOR } from "@ente/shared/themes/constants";import type { User } from "@ente/shared/user/types";@@ -58,7 +54,6 @@ import { resumeExportsIfNeeded } from "services/export";import { photosLogout } from "services/logout";import {getFamilyPortalRedirectURL,- updateMapEnabledStatus,} from "services/userService";import "styles/global.css";import { NotificationAttributes } from "types/Notification";@@ -71,7 +66,6 @@ export default function App({ Component, pageProps }: AppProps) {typeof window !== "undefined" && !window.navigator.onLine,);const [showNavbar, setShowNavBar] = useState(false);- const [mapEnabled, setMapEnabled] = useState(false);const [dialogMessage, setDialogMessage] = useState<DialogBoxAttributes>();const [messageDialogView, setMessageDialogView] = useState(false);const [watchFolderView, setWatchFolderView] = useState(false);@@ -143,10 +137,6 @@ export default function App({ Component, pageProps }: AppProps) {};}, []);- useEffect(() => {- setMapEnabled(getLocalMapEnabled());- }, []);-useEffect(() => {if (!isElectron()) {return;@@ -207,12 +197,6 @@ export default function App({ Component, pageProps }: AppProps) {const showNavBar = (show: boolean) => setShowNavBar(show);- const updateMapEnabled = async (enabled: boolean) => {- await updateMapEnabledStatus(enabled);- setLocalMapEnabled(enabled);- setMapEnabled(enabled);- };-// Use `onGenericError` instead.const somethingWentWrong = useCallback(() =>@@ -248,8 +232,6 @@ export default function App({ Component, pageProps }: AppProps) {showMiniDialog,somethingWentWrong,onGenericError,- mapEnabled,- updateMapEnabled, // <- changes on each renderisCFProxyDisabled,setIsCFProxyDisabled,logout,diff --git a/web/apps/photos/src/services/sync.ts b/web/apps/photos/src/services/sync.tsindex 5914d898ee..065fa45917 100644--- a/web/apps/photos/src/services/sync.ts+++ b/web/apps/photos/src/services/sync.ts@@ -1,14 +1,12 @@import { isMLSupported, mlStatusSync, mlSync } from "@/new/photos/services/ml";import { searchDataSync } from "@/new/photos/services/search";-import { triggerSettingsSyncIfNeeded } from "@/new/photos/services/settings";-import { syncMapEnabled } from "services/userService";+import { syncSettings } from "@/new/photos/services/settings";/*** Part 1 of {@link sync}. See TODO below for why this is split.*/export const preFileInfoSync = async () => {- triggerSettingsSyncIfNeeded();- await Promise.all([isMLSupported && mlStatusSync()]);+ await Promise.all([syncSettings(), isMLSupported && mlStatusSync()]);};/**@@ -31,7 +29,7 @@ export const preFileInfoSync = async () => {* before doing the file sync and thus should run immediately after login.*/export const sync = async () => {- await Promise.all([syncMapEnabled(), searchDataSync()]);+ await Promise.all([searchDataSync()]);// ML sync might take a very long time for initial indexing, so don't wait// for it to finish.void mlSync();diff --git a/web/apps/photos/src/services/userService.ts b/web/apps/photos/src/services/userService.tsindex 4dcda53234..50c8e19dce 100644--- a/web/apps/photos/src/services/userService.ts+++ b/web/apps/photos/src/services/userService.ts@@ -4,15 +4,11 @@ import { apiURL, customAPIOrigin, familyAppOrigin } from "@/base/origins";import { ApiError } from "@ente/shared/error";import HTTPService from "@ente/shared/network/HTTPService";import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";-import {- getToken,- setLocalMapEnabled,-} from "@ente/shared/storage/localStorage/helpers";-import { HttpStatusCode, type AxiosResponse } from "axios";+import { getToken } from "@ente/shared/storage/localStorage/helpers";+import { HttpStatusCode } from "axios";import {DeleteChallengeResponse,GetFeatureFlagResponse,- GetRemoteStoreValueResponse,UserDetails,} from "types/user";import { getLocalFamilyData, isPartOfFamily } from "utils/user/family";@@ -177,57 +173,6 @@ export const deleteAccount = async (}};-export const syncMapEnabled = async () => {- try {- const status = await getMapEnabledStatus();- setLocalMapEnabled(status);- } catch (e) {- log.error("failed to sync map enabled status", e);- throw e;- }-};--export const getMapEnabledStatus = async () => {- try {- const token = getToken();- const resp: AxiosResponse<GetRemoteStoreValueResponse> =- await HTTPService.get(- await apiURL("/remote-store"),- {- key: "mapEnabled",- defaultValue: false,- },- {- "X-Auth-Token": token,- },- );- return resp.data.value === "true";- } catch (e) {- log.error("failed to get map enabled status", e);- throw e;- }-};--export const updateMapEnabledStatus = async (newStatus: boolean) => {- try {- const token = getToken();- await HTTPService.post(- await apiURL("/remote-store/update"),- {- key: "mapEnabled",- value: newStatus.toString(),- },- null,- {- "X-Auth-Token": token,- },- );- } catch (e) {- log.error("failed to update map enabled status", e);- throw e;- }-};-/*** Return true to disable the upload of files via Cloudflare Workers.*diff --git a/web/packages/new/photos/services/migrations.ts b/web/packages/new/photos/services/migrations.tsindex 205f80bd33..225eb37588 100644--- a/web/packages/new/photos/services/migrations.ts+++ b/web/packages/new/photos/services/migrations.ts@@ -105,6 +105,7 @@ const m3 = () =>// // Added: Nov 2025 (v1.7.7-beta). Prunable.// const m4 = () => {// // Delete legacy keys for storing individual settings+// // LS_KEYS.MAP_ENABLED = "mapEnabled",// localStorage.removeItem("mapEnabled");// localStorage.removeItem("cfProxyDisabled");// };diff --git a/web/packages/new/photos/services/settings.ts b/web/packages/new/photos/services/settings.tsindex fb91e5a51e..4f4272468a 100644--- a/web/packages/new/photos/services/settings.ts+++ b/web/packages/new/photos/services/settings.ts@@ -13,7 +13,25 @@ import { fetchFeatureFlags, updateRemoteFlag } from "./remote-store";/*** In-memory flags that tracks various settings.*- * See: [Note: Remote flag lifecycle].+ * [Note: Remote flag lifecycle]+ *+ * At a high level, this is how the app manages remote flags:+ *+ * 1. On app start, the initial are read from local storage in+ * {@link initSettings}.+ *+ * 2. During the remote sync, remote flags are fetched and saved in local+ * storage, and the in-memory state updated to reflect the latest values+ * ({@link syncSettings}).+ *+ * 3. Updating a value also cause an unconditional fetch and update+ * ({@link syncSettings}).+ *+ * 4. The individual getter functions for the flags (e.g.+ * {@link isInternalUser}) return the in-memory values, and so are suitable+ * for frequent use during UI rendering.+ *+ * 5. Everything gets reset to the default state on {@link logoutSettings}.*/export interface Settings {/**@@ -50,12 +68,6 @@ class SettingsState {this.settingsSnapshot = defaultSettings();}- /**- * True if we have performed a fetch for the logged in user since the app- * started.- */- haveSynced = false;-/*** Subscriptions to {@link Settings} updates.*@@ -73,43 +85,6 @@ class SettingsState {/** State shared by the functions in this module. See {@link SettingsState}. */let _state = new SettingsState();-/**- * Fetch remote flags (feature flags and other user specific preferences) from- * remote and save them in local storage for subsequent lookup.- *- * It fetches only once per app lifetime, and so is safe to call as arbitrarily- * many times. Remember to call {@link clearFeatureFlagSessionState} on logout- * to clear any in memory state so that these can be fetched again on the- * subsequent login.- *- * The local cache will also be updated if an individual flag is changed.- *- * [Note: Remote flag lifecycle]- *- * At a high level, this is how the app manages remote flags:- *- * 1. On app start, the initial are read from local storage in- * {@link initSettings}.- *- * 2. On app start, as part of the normal sync with remote, remote flags are- * fetched once and saved in local storage, and the in-memory state updated- * to reflect the latest values ({@link triggerSettingsSyncIfNeeded}). If- * this fetch fails, we try again periodically (on every sync with remote)- * until success.- *- * 3. Some operations like opening the preferences panel or updating a value- * also cause an unconditional fetch and update ({@link syncSettings}).- *- * 4. The individual getter functions for the flags (e.g.- * {@link isInternalUser}) return the in-memory values, and so are suitable- * for frequent use during UI rendering.- *- * 5. Everything gets reset to the default state on {@link logoutSettings}.- */-export const triggerSettingsSyncIfNeeded = () => {- if (!_state.haveSynced) void syncSettings();-};-/*** Read in the locally persisted settings into memory, but otherwise do not* initiate any network requests to fetch the latest values.@@ -137,7 +112,6 @@ export const syncSettings = async () => {}saveRemoteFeatureFlagsJSONString(jsonString);readInMemoryFlagsFromLocalStorage();- _state.haveSynced = true;};const saveRemoteFeatureFlagsJSONString = (s: string) =>diff --git a/web/packages/new/photos/types/context.ts b/web/packages/new/photos/types/context.tsindex 40c679583b..dc24bad5cf 100644--- a/web/packages/new/photos/types/context.ts+++ b/web/packages/new/photos/types/context.ts@@ -31,8 +31,6 @@ export type AppContextT = AccountsContextT & {*/setDialogMessage: SetDialogBoxAttributes;setNotificationAttributes: SetNotificationAttributes;- mapEnabled: boolean;- updateMapEnabled: (enabled: boolean) => Promise<void>;watchFolderView: boolean;setWatchFolderView: (isOpen: boolean) => void;watchFolderFiles: FileList;diff --git a/web/packages/shared/storage/localStorage/helpers.ts b/web/packages/shared/storage/localStorage/helpers.tsindex 7f46b680dd..265546dfc7 100644--- a/web/packages/shared/storage/localStorage/helpers.ts+++ b/web/packages/shared/storage/localStorage/helpers.ts@@ -19,14 +19,6 @@ export function setJustSignedUp(status: boolean) {setData(LS_KEYS.JUST_SIGNED_UP, { status });}-export function getLocalMapEnabled(): boolean {- return getData(LS_KEYS.MAP_ENABLED)?.value ?? false;-}--export function setLocalMapEnabled(value: boolean) {- setData(LS_KEYS.MAP_ENABLED, { value });-}-export function getLocalReferralSource() {return getData(LS_KEYS.REFERRAL_SOURCE)?.source;}diff --git a/web/packages/shared/storage/localStorage/index.ts b/web/packages/shared/storage/localStorage/index.tsindex 2ba7e17f28..2ce68c535c 100644--- a/web/packages/shared/storage/localStorage/index.ts+++ b/web/packages/shared/storage/localStorage/index.ts@@ -18,7 +18,6 @@ export enum LS_KEYS {THEME = "theme",// Moved to the new wrapper @/base/local-storage// LOCALE = 'locale',- MAP_ENABLED = "mapEnabled",SRP_SETUP_ATTRIBUTES = "srpSetupAttributes",SRP_ATTRIBUTES = "srpAttributes",CF_PROXY_DISABLED = "cfProxyDisabled",