π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix issues
Abhinav8c28b48e8652
diff --git a/apps/photos/src/components/PhotoFrame.tsx b/apps/photos/src/components/PhotoFrame.tsxindex 3999882108..3171dda880 100644--- a/apps/photos/src/components/PhotoFrame.tsx+++ b/apps/photos/src/components/PhotoFrame.tsx@@ -200,16 +200,14 @@ const PhotoFrame = ({// this is to prevent outdate updateSrcURL call from updating the wrong fileif (file.id !== id) {addLogLine(- `[${id}]PhotoSwipe: updateSrcURL: file id mismatch: ${file.id} !== ${id}`+ `[${id}]PhotoSwipe: updateSrcURL: file id mismatch: ${file.id}`);throw Error(CustomError.UPDATE_URL_FILE_ID_MISMATCH);}if (file.isSourceLoaded && !forceUpdate) {throw Error(CustomError.URL_ALREADY_SET);} else if (file.conversionFailed) {- addLogLine(- `[${id}]PhotoSwipe: updateSrcURL: conversion failed: ${file.id}`- );+ addLogLine(`[${id}]PhotoSwipe: updateSrcURL: conversion failed`);throw Error(CustomError.FILE_CONVERSION_FAILED);}@@ -412,7 +410,7 @@ const PhotoFrame = ({const srcURLs = await DownloadManager.getFileForPreview(item);if (item.metadata.fileType === FILE_TYPE.LIVE_PHOTO) {const srcImgURL = srcURLs.url as LivePhotoSourceURL;- const imageURL = await srcImgURL.image;+ const imageURL = await srcImgURL.image();const dummyImgSrcUrl: SourceURL = {url: imageURL,@@ -438,7 +436,7 @@ const PhotoFrame = ({}}- const videoURL = await srcImgURL.video;+ const videoURL = imageURL ? await srcImgURL.video() : null;const loadedLivePhotoSrcURL: SourceURL = {url: { video: videoURL, image: imageURL },isOriginal: false,diff --git a/apps/photos/src/components/PhotoViewer/index.tsx b/apps/photos/src/components/PhotoViewer/index.tsxindex a9286a9fce..0aa4f31972 100644--- a/apps/photos/src/components/PhotoViewer/index.tsx+++ b/apps/photos/src/components/PhotoViewer/index.tsx@@ -49,7 +49,7 @@ import { getParsedExifData } from 'services/upload/exifService';import { getFileType } from 'services/typeDetectionService';import { ConversionFailedNotification } from './styledComponents/ConversionFailedNotification';import { GalleryContext } from 'pages/gallery';-import downloadManager from 'services/download';+import downloadManager, { LoadedLivePhotoSourceURL } from 'services/download';import CircularProgressWithLabel from './styledComponents/CircularProgressWithLabel';import EnteSpinner from '@ente/shared/components/EnteSpinner';import AlbumOutlined from '@mui/icons-material/AlbumOutlined';@@ -294,18 +294,19 @@ function PhotoViewer(props: Iprops) {setExif({ key: file.src, value: null });return;}- if (!file.isSourceLoaded) {+ if (!file.isSourceLoaded || file.conversionFailed) {+ return;+ }++ if (!file || !exifCopy?.current?.value === null) {return;}const key =file.metadata.fileType === FILE_TYPE.IMAGE? file.src- : (file.srcURLs.url as any).image;- if (- !file ||- !exifCopy?.current?.value === null ||- exifCopy?.current?.key === key- ) {+ : (file.srcURLs.url as LoadedLivePhotoSourceURL).image;++ if (exifCopy?.current?.key === key) {return;}setExif({ key, value: undefined });@@ -555,9 +556,8 @@ function PhotoViewer(props: Iprops) {file.metadata.title);} else {- const url = (- file.srcURLs.url as { image: string; video: string }- ).image;+ const url = (file.srcURLs.url as LoadedLivePhotoSourceURL)+ .image;fileObject = await getFileFromURL(url, file.metadata.title);}const fileTypeInfo = await getFileType(fileObject);diff --git a/apps/photos/src/services/download/index.ts b/apps/photos/src/services/download/index.tsindex 6d6ccf86d9..dc3ca37d0c 100644--- a/apps/photos/src/services/download/index.ts+++ b/apps/photos/src/services/download/index.ts@@ -19,8 +19,8 @@ import { PhotosDownloadClient } from './clients/photos';import { PublicAlbumsDownloadClient } from './clients/publicAlbums';export type LivePhotoSourceURL = {- image: Promise<string>;- video: Promise<string>;+ image: () => Promise<string>;+ video: () => Promise<string>;};export type LoadedLivePhotoSourceURL = {@@ -216,13 +216,6 @@ class DownloadManager {);}const fileURLs = await this.fileConversionPromises.get(file.id);- this.fileConversionPromises.delete(file.id);- if (fileURLs.isRenderable) {- this.fileObjectURLPromises.set(- file.id,- Promise.resolve(fileURLs)- );- }return fileURLs;} catch (e) {this.fileConversionPromises.delete(file.id);diff --git a/apps/photos/src/utils/file/index.ts b/apps/photos/src/utils/file/index.tsindex 646d14948c..3aafc4a2b9 100644--- a/apps/photos/src/utils/file/index.ts+++ b/apps/photos/src/utils/file/index.ts@@ -339,7 +339,8 @@ export async function getRenderableFileURL(return {url: srcURLs,isOriginal,- isRenderable: !!srcURLs,+ isRenderable:+ file.metadata.fileType !== FILE_TYPE.LIVE_PHOTO && !!srcURLs,type:file.metadata.fileType === FILE_TYPE.LIVE_PHOTO? 'livePhoto'@@ -387,8 +388,8 @@ async function getRenderableLivePhotoURL(};return {- image: getRenderableLivePhotoImageURL(),- video: getRenderableLivePhotoVideoURL(),+ image: getRenderableLivePhotoImageURL,+ video: getRenderableLivePhotoVideoURL,};}diff --git a/apps/photos/src/utils/photoFrame/index.ts b/apps/photos/src/utils/photoFrame/index.tsindex 3863f4485e..b55bcde186 100644--- a/apps/photos/src/utils/photoFrame/index.ts+++ b/apps/photos/src/utils/photoFrame/index.ts@@ -70,17 +70,18 @@ export function updateFileMsrcProps(file: EnteFile, url: string) {}export async function updateFileSrcProps(file: EnteFile, srcURLs: SourceURL) {- const { url, isRenderable } = srcURLs;+ const { url, isRenderable, isOriginal } = srcURLs;file.w = window.innerWidth;file.h = window.innerHeight;file.isSourceLoaded =file.metadata.fileType === FILE_TYPE.LIVE_PHOTO? srcURLs.type === 'livePhoto': true;- file.isConverted = !srcURLs.isOriginal;- file.conversionFailed = !srcURLs.isRenderable;+ file.isConverted = !isOriginal;+ file.conversionFailed = !isRenderable;file.srcURLs = srcURLs;if (!isRenderable) {+ file.isSourceLoaded = true;return;}