Move and grow

This commit is contained in:
Manav Rathi
2024-08-05 20:33:54 +05:30
parent f38d432bf9
commit 296bcbc8c2
9 changed files with 50 additions and 27 deletions

View File

@@ -1,5 +1,5 @@
import log from "@/base/log";
import { ItemVisibility } from "@/new/photos/types/magicMetadata";
import { ItemVisibility } from "@/media/file-metadata";
import { HorizontalFlex } from "@ente/shared/components/Container";
import OverflowMenu from "@ente/shared/components/OverflowMenu/menu";
import MoreHoriz from "@mui/icons-material/MoreHoriz";

View File

@@ -4,10 +4,10 @@ import { getLocalFiles } from "@/new/photos/services/files";
import { EnteFile } from "@/new/photos/types/file";
import {
EncryptedMagicMetadata,
ItemVisibility,
SUB_TYPE,
UpdateMagicMetadataRequest,
} from "@/new/photos/types/magicMetadata";
import { ItemVisibility } from "@/media/file-metadata";
import { batch } from "@/utils/array";
import ComlinkCryptoWorker from "@ente/shared/crypto";
import { CustomError } from "@ente/shared/error";

View File

@@ -1,7 +1,7 @@
import { ItemVisibility } from "@/media/file-metadata";
import { EnteFile } from "@/new/photos/types/file";
import {
EncryptedMagicMetadata,
ItemVisibility,
MagicMetadataCore,
SUB_TYPE,
} from "@/new/photos/types/magicMetadata";

View File

@@ -1,8 +1,9 @@
import { ensureElectron } from "@/base/electron";
import log from "@/base/log";
import { ItemVisibility } from "@/media/file-metadata";
import { getAllLocalFiles, getLocalFiles } from "@/new/photos/services/files";
import { EnteFile } from "@/new/photos/types/file";
import { ItemVisibility, SUB_TYPE } from "@/new/photos/types/magicMetadata";
import { SUB_TYPE } from "@/new/photos/types/magicMetadata";
import { safeDirectoryName } from "@/new/photos/utils/native-fs";
import { CustomError } from "@ente/shared/error";
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";

View File

@@ -1,5 +1,6 @@
import log from "@/base/log";
import { type Electron } from "@/base/types/ipc";
import { ItemVisibility } from "@/media/file-metadata";
import { FileType } from "@/media/file-type";
import { decodeLivePhoto } from "@/media/live-photo";
import DownloadManager from "@/new/photos/services/download";
@@ -13,7 +14,6 @@ import {
FilePublicMagicMetadataProps,
FileWithUpdatedMagicMetadata,
} from "@/new/photos/types/file";
import { ItemVisibility } from "@/new/photos/types/magicMetadata";
import { detectFileTypeInfo } from "@/new/photos/utils/detect-type";
import { mergeMetadata } from "@/new/photos/utils/file";
import { safeFileName } from "@/new/photos/utils/native-fs";

View File

@@ -1,8 +1,6 @@
import { ItemVisibility } from "@/media/file-metadata";
import { EnteFile } from "@/new/photos/types/file";
import {
ItemVisibility,
MagicMetadataCore,
} from "@/new/photos/types/magicMetadata";
import { MagicMetadataCore } from "@/new/photos/types/magicMetadata";
import ComlinkCryptoWorker from "@ente/shared/crypto";
import { Collection } from "types/collection";

View File

@@ -88,13 +88,50 @@ export interface Metadata {
}
/**
* Mutable metadata associated with an {@link EnteFile}.
* Mutable private metadata associated with an {@link EnteFile}.
*
* - Unlike {@link Metadata}, this can change after the file has been
* uploaded.
*
* - Unlike {@link MagicMetadata}, this is available to all the people with
* whom the file has been shared.
* - Unlike {@link PublicMagicMetadata}, this is only available to the owner
* of the file.
*
* For historical reasons, the unqualified phrase "magic metadata" in various
* APIs refers to the (this) private metadata, even though the mutable public
* metadata is the much more frequently used of the two. See: [Note: Metadatum].
*/
export interface PrivateMagicMetadata {
/**
* The visibility of the file.
*
* The file's visibility is user specific attribute, and thus we keep it in
* the private magic metadata. This allows the file's owner to share a file
* and independently edit its visibility without revealing their visibility
* preference to the other people with whom they have shared the file.
*/
visibility?: ItemVisibility;
}
/**
* The visibility of an Ente file or collection.
*/
export enum ItemVisibility {
/** The normal state - The item is visible. */
visible = 0,
/** The item has been archived. */
archived = 1,
/** The item has been hidden. */
hidden = 2,
}
/**
* Mutable public metadata associated with an {@link EnteFile}.
*
* - Unlike {@link Metadata}, this can change after the file has been
* uploaded.
*
* - Unlike {@link PrivateMagicMetadata}, this is available to all the people
* with whom the file has been shared.
*
* For more details, see [Note: Metadatum].
*/
@@ -200,7 +237,7 @@ export type EncryptMetadataF = typeof encryptMetadata;
*/
export const updateMagicMetadataRequest = async (
enteFile: EnteFile,
metadata: PublicMagicMetadata,
metadata: PrivateMagicMetadata | PublicMagicMetadata,
metadataVersion: number,
encryptMetadataF: EncryptMetadataF,
): Promise<UpdateMagicMetadataRequest> => {

View File

@@ -1,6 +1,5 @@
import type { Metadata } from "@/media/file-metadata";
import { type Metadata, ItemVisibility } from "@/media/file-metadata";
import {
ItemVisibility,
type EncryptedMagicMetadata,
type MagicMetadataCore,
} from "./magicMetadata";

View File

@@ -7,18 +7,6 @@ export interface MagicMetadataCore<T> {
export type EncryptedMagicMetadata = MagicMetadataCore<string>;
/**
* The visibility of an Ente file or collection.
*/
export enum ItemVisibility {
/** The normal state - The item is visible. */
visible = 0,
/** The item has been archived. */
archived = 1,
/** The item has been hidden. */
hidden = 2,
}
export enum SUB_TYPE {
DEFAULT = 0,
DEFAULT_HIDDEN = 1,