[web] Fix build (#1528)
This commit is contained in:
commit
c8fc007898
|
@ -490,7 +490,8 @@ export default function Uploader(props: Props) {
|
|||
throw e;
|
||||
}
|
||||
await waitInQueueAndUploadFiles(
|
||||
filesWithCollectionToUpload,
|
||||
/* TODO(MR): ElectronFile changes */
|
||||
filesWithCollectionToUpload as FileWithCollection[],
|
||||
collections,
|
||||
);
|
||||
toUploadFiles.current = null;
|
||||
|
@ -569,7 +570,8 @@ export default function Uploader(props: Props) {
|
|||
if (isElectron()) {
|
||||
if (watcher.isUploadRunning()) {
|
||||
await watcher.allFileUploadsDone(
|
||||
filesWithCollectionToUploadIn,
|
||||
/* TODO(MR): ElectronFile changes */
|
||||
filesWithCollectionToUploadIn as FileWithCollection2[],
|
||||
collections,
|
||||
);
|
||||
} else if (watcher.isSyncPaused()) {
|
||||
|
|
|
@ -364,11 +364,17 @@ class UploadManager {
|
|||
this.uiService.setUploadStage(
|
||||
UPLOAD_STAGES.READING_GOOGLE_METADATA_FILES,
|
||||
);
|
||||
await this.parseMetadataJSONFiles(metadataJSONFiles);
|
||||
/* TODO(MR): ElectronFile changes */
|
||||
await this.parseMetadataJSONFiles(
|
||||
metadataJSONFiles as FileWithCollection2[],
|
||||
);
|
||||
}
|
||||
|
||||
if (mediaFiles.length) {
|
||||
const clusteredMediaFiles = clusterLivePhotos(mediaFiles);
|
||||
/* TODO(MR): ElectronFile changes */
|
||||
const clusteredMediaFiles = clusterLivePhotos(
|
||||
mediaFiles as ClusterableFile[],
|
||||
);
|
||||
|
||||
if (uploadCancelService.isUploadCancelationRequested()) {
|
||||
throw Error(CustomError.UPLOAD_CANCELLED);
|
||||
|
@ -378,7 +384,8 @@ class UploadManager {
|
|||
new Map<number, string>(
|
||||
clusteredMediaFiles.map((mediaFile) => [
|
||||
mediaFile.localID,
|
||||
assetName(mediaFile),
|
||||
/* TODO(MR): ElectronFile changes */
|
||||
assetName(mediaFile as FileWithCollection2),
|
||||
]),
|
||||
),
|
||||
);
|
||||
|
@ -387,7 +394,10 @@ class UploadManager {
|
|||
mediaFiles.length !== clusteredMediaFiles.length,
|
||||
);
|
||||
|
||||
await this.uploadMediaFiles(clusteredMediaFiles);
|
||||
/* TODO(MR): ElectronFile changes */
|
||||
await this.uploadMediaFiles(
|
||||
clusteredMediaFiles as FileWithCollection2[],
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.message === CustomError.UPLOAD_CANCELLED) {
|
||||
|
@ -721,7 +731,7 @@ type ClusterableFile = {
|
|||
localID: number;
|
||||
collectionID: number;
|
||||
// fileOrPath: File | ElectronFile | string;
|
||||
file: File | ElectronFile | string;
|
||||
file?: File | ElectronFile | string;
|
||||
};
|
||||
|
||||
type ClusteredFile = ClusterableFile & {
|
||||
|
@ -770,8 +780,13 @@ const clusterLivePhotos = (mediaFiles: ClusterableFile[]) => {
|
|||
collectionID: f.collectionID,
|
||||
isLivePhoto: true,
|
||||
livePhotoAssets: {
|
||||
image: fFileType == FILE_TYPE.IMAGE ? f.file : g.file,
|
||||
video: fFileType == FILE_TYPE.IMAGE ? g.file : f.file,
|
||||
/* TODO(MR): ElectronFile changes */
|
||||
image: (fFileType == FILE_TYPE.IMAGE ? f.file : g.file) as
|
||||
| string
|
||||
| File,
|
||||
video: (fFileType == FILE_TYPE.IMAGE ? g.file : f.file) as
|
||||
| string
|
||||
| File,
|
||||
},
|
||||
});
|
||||
index += 2;
|
||||
|
|
|
@ -195,7 +195,7 @@ export const uploader = async (
|
|||
const { metadata, publicMagicMetadata } = await extractAssetMetadata(
|
||||
worker,
|
||||
parsedMetadataJSONMap,
|
||||
uploadAsset,
|
||||
uploadAsset2,
|
||||
collection.id,
|
||||
fileTypeInfo,
|
||||
);
|
||||
|
@ -229,7 +229,7 @@ export const uploader = async (
|
|||
|
||||
abortIfCancelled();
|
||||
|
||||
const file = await readAsset(fileTypeInfo, uploadAsset);
|
||||
const file = await readAsset(fileTypeInfo, uploadAsset2);
|
||||
|
||||
if (file.hasStaticThumbnail) metadata.hasStaticThumbnail = true;
|
||||
|
||||
|
@ -760,6 +760,12 @@ const areFilesSameHash = (f: Metadata, g: Metadata) => {
|
|||
/**
|
||||
* Older files that were uploaded before we introduced hashing will not have
|
||||
* hashes, so retain and use the logic we used back then for such files.
|
||||
*
|
||||
* Deprecation notice April 2024: Note that hashing was introduced very early
|
||||
* (years ago), so the chance of us finding files without hashes is rare. And
|
||||
* even in these cases, the worst that'll happen is that a duplicate file would
|
||||
* get uploaded which can later be deduped. So we can get rid of this case at
|
||||
* some point (e.g. the mobile app doesn't do this extra check, just uploads).
|
||||
*/
|
||||
const areFilesSameNoHash = (f: Metadata, g: Metadata) => {
|
||||
/*
|
||||
|
@ -773,10 +779,10 @@ const areFilesSameNoHash = (f: Metadata, g: Metadata) => {
|
|||
*/
|
||||
const oneSecond = 1e6;
|
||||
return (
|
||||
f.fileType === g.fileType &&
|
||||
f.fileType == g.fileType &&
|
||||
f.title == g.title &&
|
||||
Math.abs(f.creationTime - g.creationTime) < oneSecond &&
|
||||
Math.abs(f.modificationTime - g.modificationTime) < oneSecond &&
|
||||
f.title === g.title
|
||||
Math.abs(f.modificationTime - g.modificationTime) < oneSecond
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue