Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix electronService migration issues

Abhinav1337e61eb56c
diff --git a/apps/photos/src/pages/gallery/index.tsx b/apps/photos/src/pages/gallery/index.tsx
index ff3444fb3a..8be7429504 100644
--- a/apps/photos/src/pages/gallery/index.tsx
+++ b/apps/photos/src/pages/gallery/index.tsx
@@ -128,6 +128,7 @@ import { getLocalFamilyData } from 'utils/user/family';
import InMemoryStore, { MS_KEYS } from '@ente/shared/storage/InMemoryStore';
import { syncEmbeddings } from 'services/embeddingService';
import { ClipService } from 'services/clipService';
+import isElectron from 'is-electron';
export const DeadCenter = styled('div')`
flex: 1;
@@ -342,14 +343,18 @@ export default function Gallery() {
syncInterval.current = setInterval(() => {
syncWithRemote(false, true);
}, SYNC_INTERVAL_IN_MICROSECONDS);
- ElectronAPIs.registerForegroundEventListener(() => {
- syncWithRemote(false, true);
- });
+ if (isElectron()) {
+ ElectronAPIs.registerForegroundEventListener(() => {
+ syncWithRemote(false, true);
+ });
+ }
};
main();
return () => {
clearInterval(syncInterval.current);
- ElectronAPIs.registerForegroundEventListener(() => {});
+ if (isElectron()) {
+ ElectronAPIs.registerForegroundEventListener(() => {});
+ }
ClipService.removeOnFileUploadListener();
};
}, []);
diff --git a/apps/photos/src/services/upload/thumbnailService.ts b/apps/photos/src/services/upload/thumbnailService.ts
index 1fd3b128cd..5d6422bf47 100644
--- a/apps/photos/src/services/upload/thumbnailService.ts
+++ b/apps/photos/src/services/upload/thumbnailService.ts
@@ -3,7 +3,6 @@ import { CustomError, errorWithContext } from '@ente/shared/error';
import { logError } from '@ente/shared/sentry';
import { BLACK_THUMBNAIL_BASE64 } from 'constants/upload';
import * as FFmpegService from 'services/ffmpeg/ffmpegService';
-import ElectronAPIs from '@ente/shared/electron';
import { convertBytesToHumanReadable } from '@ente/shared/utils/size';
import { ElectronFile, FileTypeInfo } from 'types/upload';
import { getUint8ArrayView } from '../readerService';
@@ -12,6 +11,7 @@ import { getFileNameSize } from '@ente/shared/logging/web';
import HeicConversionService from 'services/heicConversionService';
import { isFileHEIC } from 'utils/file';
import isElectron from 'is-electron';
+import imageProcessor from 'services/imageProcessor';
const MAX_THUMBNAIL_DIMENSION = 720;
const MIN_COMPRESSION_PERCENTAGE_SIZE_DIFF = 10;
@@ -86,7 +86,7 @@ async function generateImageThumbnail(
) {
if (isElectron()) {
try {
- return await ElectronAPIs.generateImageThumbnail(
+ return await imageProcessor.generateImageThumbnail(
file,
MAX_THUMBNAIL_DIMENSION,
MAX_THUMBNAIL_SIZE