From 6a26cce94d6e4ba7908a886d04599335fe042d2e Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 9 Jun 2023 11:57:07 +0530 Subject: [PATCH 1/4] remove testing changes --- apps/photos/src/utils/file/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/photos/src/utils/file/index.ts b/apps/photos/src/utils/file/index.ts index f57acc051..70b972e8b 100644 --- a/apps/photos/src/utils/file/index.ts +++ b/apps/photos/src/utils/file/index.ts @@ -359,7 +359,6 @@ export async function getPlayableVideo( export async function getRenderableImage(fileName: string, imageBlob: Blob) { try { - throw Error('not implemented'); const tempFile = new File([imageBlob], fileName); const { exactType } = await getFileType(tempFile); let convertedImageBlob: Blob; From 0d16e002efb242377fea70a4fc2959ddd5af0e42 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 9 Jun 2023 12:52:48 +0530 Subject: [PATCH 2/4] extract MetadataDate while fixing time too --- apps/photos/src/services/updateCreationTimeWithExif.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/photos/src/services/updateCreationTimeWithExif.ts b/apps/photos/src/services/updateCreationTimeWithExif.ts index ac2b237f7..fc57f8870 100644 --- a/apps/photos/src/services/updateCreationTimeWithExif.ts +++ b/apps/photos/src/services/updateCreationTimeWithExif.ts @@ -19,6 +19,7 @@ const EXIF_TIME_TAGS = [ 'CreateDate', 'ModifyDate', 'DateCreated', + 'MetadataDate', ]; export async function updateCreationTimeWithExif( From 0e87171c5f6323c8b3002cbf8686b09f951f7786 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 9 Jun 2023 13:33:18 +0530 Subject: [PATCH 3/4] add file type info log --- apps/photos/src/utils/file/index.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/photos/src/utils/file/index.ts b/apps/photos/src/utils/file/index.ts index 70b972e8b..d4e2a4335 100644 --- a/apps/photos/src/utils/file/index.ts +++ b/apps/photos/src/utils/file/index.ts @@ -30,7 +30,7 @@ import * as ffmpegService from 'services/ffmpeg/ffmpegService'; import { VISIBILITY_STATE } from 'types/magicMetadata'; import { IsArchived, updateMagicMetadata } from 'utils/magicMetadata'; -import { addLogLine } from 'utils/logging'; +import { addLocalLog, addLogLine } from 'utils/logging'; import { CustomError } from 'utils/error'; import { convertBytesToHumanReadable } from './size'; import ComlinkCryptoWorker from 'utils/comlink/ComlinkCryptoWorker'; @@ -41,6 +41,7 @@ import { import isElectron from 'is-electron'; import imageProcessor from 'services/electron/imageProcessor'; import { isPlaybackPossible } from 'utils/photoFrame'; +import { FileTypeInfo } from 'types/upload'; const WAIT_TIME_IMAGE_CONVERSION = 30 * 1000; @@ -358,9 +359,12 @@ export async function getPlayableVideo( } export async function getRenderableImage(fileName: string, imageBlob: Blob) { + let fileTypeInfo: FileTypeInfo; try { const tempFile = new File([imageBlob], fileName); - const { exactType } = await getFileType(tempFile); + fileTypeInfo = await getFileType(tempFile); + addLocalLog(() => `file type info: ${JSON.stringify(fileTypeInfo)}`); + const { exactType } = fileTypeInfo; let convertedImageBlob: Blob; if (isRawFile(exactType)) { try { @@ -404,7 +408,7 @@ export async function getRenderableImage(fileName: string, imageBlob: Blob) { return imageBlob; } } catch (e) { - logError(e, 'get Renderable Image failed'); + logError(e, 'get Renderable Image failed', { fileTypeInfo }); return null; } } From d0c522f18acfd2c2afad79c4422e6898d8c06c4b Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 9 Jun 2023 13:39:27 +0530 Subject: [PATCH 4/4] update conversion failed notification position and copy --- apps/photos/public/locales/en/translation.json | 2 +- .../styledComponents/ConversionFailedNotification.tsx | 4 ++-- apps/photos/src/types/Notification/index.tsx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/photos/public/locales/en/translation.json b/apps/photos/public/locales/en/translation.json index 124806fd1..c9d37f69a 100644 --- a/apps/photos/public/locales/en/translation.json +++ b/apps/photos/public/locales/en/translation.json @@ -528,5 +528,5 @@ "SORT_BY": "Sort by", "NEWEST_FIRST": "Newest first", "OLDEST_FIRST": "Oldest first", - "CONVERSION_FAILED_NOTIFICATION_MESSAGE": "This file could not be previewed, click here to download the original" + "CONVERSION_FAILED_NOTIFICATION_MESSAGE": "This file could not be previewed. Click here to download the original." } diff --git a/apps/photos/src/components/PhotoViewer/styledComponents/ConversionFailedNotification.tsx b/apps/photos/src/components/PhotoViewer/styledComponents/ConversionFailedNotification.tsx index 7641830b3..274511cbb 100644 --- a/apps/photos/src/components/PhotoViewer/styledComponents/ConversionFailedNotification.tsx +++ b/apps/photos/src/components/PhotoViewer/styledComponents/ConversionFailedNotification.tsx @@ -19,10 +19,10 @@ export const ConversionFailedNotification = ({ onClick }: Iprops) => { onClose={handleClose} attributes={{ variant: 'secondary', - message: t('CONVERSION_FAILED_NOTIFICATION_MESSAGE'), + subtext: t('CONVERSION_FAILED_NOTIFICATION_MESSAGE'), onClick: onClick, }} - horizontal="left" + horizontal="right" vertical="bottom" sx={{ zIndex: 4000 }} /> diff --git a/apps/photos/src/types/Notification/index.tsx b/apps/photos/src/types/Notification/index.tsx index 553ab20d4..d94e2c3ca 100644 --- a/apps/photos/src/types/Notification/index.tsx +++ b/apps/photos/src/types/Notification/index.tsx @@ -4,7 +4,7 @@ import { ReactNode } from 'react'; export interface NotificationAttributes { startIcon?: ReactNode; variant: ButtonProps['color']; - message: JSX.Element | string; + message?: JSX.Element | string; subtext?: JSX.Element | string; onClick: () => void; endIcon?: ReactNode;