This commit is contained in:
Manav Rathi
2024-11-23 10:21:10 +05:30
parent 1e406cdb90
commit 01cc72a15f
3 changed files with 9 additions and 15 deletions

View File

@@ -631,10 +631,6 @@ export function PhotoList({
/**
* Checks and merge multiple dates into a single row.
*
* @param items
* @param columns
* @returns
*/
const mergeTimeStampList = (
items: TimeStampListItem[],

View File

@@ -178,8 +178,8 @@ class DownloadManagerImpl {
this.ensureInitialized();
if (!this.thumbnailURLPromises.has(file.id)) {
const url = this.thumbnailBytes(file, cachedOnly).then((bytes) =>
bytes ? URL.createObjectURL(new Blob([bytes])) : undefined,
const url = this.thumbnailData(file, cachedOnly).then((data) =>
data ? URL.createObjectURL(new Blob([data])) : undefined,
);
this.thumbnailURLPromises.set(file.id, url);
}
@@ -204,11 +204,11 @@ class DownloadManagerImpl {
* @param cachedOnly If true, then the thumbnail is not downloaded if it is
* not already present in the disk cache.
*
* @returns The bytes of the thumbnail. This method can return `undefined`
* iff the thumbnail is not already cached, and {@link cachedOnly} is set to
* `true`.
* @returns The bytes of the thumbnail, as a {@link Uint8Array}. This method
* can return `undefined` iff the thumbnail is not already cached, and
* {@link cachedOnly} is set to `true`.
*/
async thumbnailBytes(file: EnteFile, cachedOnly = false) {
async thumbnailData(file: EnteFile, cachedOnly = false) {
this.ensureInitialized();
const key = file.id.toString();
@@ -287,8 +287,6 @@ class DownloadManagerImpl {
* cached for subsequent use.
*
* @param file The {@link EnteFile} whose data we want.
*
* @returns
*/
async fileStream(
file: EnteFile,

View File

@@ -91,8 +91,8 @@ const fetchRenderableUploadItemBlob = async (
) => {
const fileType = file.metadata.fileType;
if (fileType == FileType.video) {
const data = await DownloadManager.thumbnailBytes(file);
return new Blob([data!]);
const thumbnailData = await DownloadManager.thumbnailData(file);
return new Blob([thumbnailData!]);
} else {
const blob = await readNonVideoUploadItem(uploadItem, electron);
return renderableImageBlob(file.metadata.title, blob);
@@ -146,7 +146,7 @@ export const fetchRenderableEnteFileBlob = async (
): Promise<Blob> => {
const fileType = file.metadata.fileType;
if (fileType == FileType.video) {
const thumbnailData = await DownloadManager.thumbnailBytes(file);
const thumbnailData = await DownloadManager.thumbnailData(file);
return new Blob([thumbnailData!]);
}