This commit is contained in:
Manav Rathi
2024-11-23 14:33:48 +05:30
parent f2b4f7ada0
commit face515003
2 changed files with 4 additions and 11 deletions

View File

@@ -396,7 +396,6 @@ const PhotoFrame = ({
const dummyImgSrcUrl: SourceURLs = {
url: imageURL,
isRenderable: !!imageURL,
type: "normal",
};
try {
@@ -423,7 +422,6 @@ const PhotoFrame = ({
const videoURL = await srcImgURL.video();
const loadedLivePhotoSrcURL: SourceURLs = {
url: { video: videoURL, image: imageURL },
isRenderable: !!videoURL,
type: "livePhoto",
};
try {
@@ -605,7 +603,8 @@ async function updateFileSrcProps(
srcURLs: SourceURLs,
enableDownload: boolean,
) {
const { url, isRenderable } = srcURLs;
const { url } = srcURLs;
const isRenderable = !!url;
file.w = window.innerWidth;
file.h = window.innerHeight;
file.isSourceLoaded =

View File

@@ -31,7 +31,6 @@ export interface LoadedLivePhotoSourceURL {
export interface SourceURLs {
url: string | LivePhotoSourceURL | LoadedLivePhotoSourceURL;
isRenderable: boolean;
type: "normal" | "livePhoto";
/**
* `true` if there is potential conversion that can still be applied.
@@ -521,7 +520,6 @@ async function getRenderableFileURL(
: undefined;
let url: SourceURLs["url"] | undefined;
let isRenderable: boolean;
let type: SourceURLs["type"] = "normal";
let mimeType: string | undefined;
let canForceConvert = false;
@@ -532,13 +530,11 @@ async function getRenderableFileURL(
const convertedBlob = await renderableImageBlob(fileName, fileBlob);
const convertedURL = existingOrNewObjectURL(convertedBlob);
url = convertedURL;
isRenderable = !!convertedURL;
mimeType = convertedBlob.type;
break;
}
case FileType.livePhoto: {
url = await getRenderableLivePhotoURL(file, fileBlob);
isRenderable = false;
type = "livePhoto";
break;
}
@@ -550,10 +546,10 @@ async function getRenderableFileURL(
);
const convertedURL = existingOrNewObjectURL(convertedBlob);
url = convertedURL;
const isOriginal = convertedURL === originalFileURL;
isRenderable = !!convertedURL;
mimeType = convertedBlob?.type;
const isOriginal = convertedURL === originalFileURL;
const isRenderable = !!convertedURL;
canForceConvert =
isDesktop && !forceConvert && isOriginal && isRenderable;
@@ -561,7 +557,6 @@ async function getRenderableFileURL(
}
default: {
url = originalFileURL;
isRenderable = false;
break;
}
}
@@ -569,7 +564,6 @@ async function getRenderableFileURL(
// TODO: Can we remove this non-null assertion and reflect it in the types?
return {
url: url!,
isRenderable,
type,
mimeType,
canForceConvert,