Skip to content

armgit / ente

Public Imported from GitHub
0

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

move download client and manager to download service folder

Abhinav3fa26f70a052
diff --git a/apps/photos/src/components/Collections/CollectionCard.tsx b/apps/photos/src/components/Collections/CollectionCard.tsx
index 62c4efb6a6..1eec757058 100644
--- a/apps/photos/src/components/Collections/CollectionCard.tsx
+++ b/apps/photos/src/components/Collections/CollectionCard.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { GalleryContext } from 'pages/gallery';
import { useState, useContext, useEffect } from 'react';
-import downloadManager from 'services/downloadManager';
+import downloadManager from 'services/download';
import { EnteFile } from 'types/file';
import { StaticThumbnail } from 'components/PlaceholderThumbnails';
import { LoadingThumbnail } from 'components/PlaceholderThumbnails';
diff --git a/apps/photos/src/components/PhotoFrame.tsx b/apps/photos/src/components/PhotoFrame.tsx
index 118faea309..4a37bb6bad 100644
--- a/apps/photos/src/components/PhotoFrame.tsx
+++ b/apps/photos/src/components/PhotoFrame.tsx
@@ -3,7 +3,7 @@ import PreviewCard from './pages/gallery/PreviewCard';
import { useContext, useEffect, useState } from 'react';
import { EnteFile } from 'types/file';
import { styled } from '@mui/material';
-import DownloadManager from 'services/downloadManager';
+import DownloadManager from 'services/download';
import AutoSizer from 'react-virtualized-auto-sizer';
import PhotoViewer from 'components/PhotoViewer';
import { TRASH_SECTION } from 'constants/collection';
diff --git a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
index 5c22889619..9328cb9e70 100644
--- a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
+++ b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
@@ -19,7 +19,7 @@ import {
} from 'react';
import { EnteFile } from 'types/file';
-import downloadManager from 'services/downloadManager';
+import downloadManager from 'services/download';
import { MenuItemGroup } from 'components/Menu/MenuItemGroup';
import { EnteMenuItem } from 'components/Menu/EnteMenuItem';
import CropOriginalIcon from '@mui/icons-material/CropOriginal';
diff --git a/apps/photos/src/components/PhotoViewer/index.tsx b/apps/photos/src/components/PhotoViewer/index.tsx
index 0accc6ce97..776f1cda98 100644
--- a/apps/photos/src/components/PhotoViewer/index.tsx
+++ b/apps/photos/src/components/PhotoViewer/index.tsx
@@ -49,7 +49,7 @@ import { getParsedExifData } from 'services/upload/exifService';
import { getFileType } from 'services/typeDetectionService';
import { ConversionFailedNotification } from './styledComponents/ConversionFailedNotification';
import { GalleryContext } from 'pages/gallery';
-import downloadManager from 'services/downloadManager';
+import downloadManager from 'services/download';
import CircularProgressWithLabel from './styledComponents/CircularProgressWithLabel';
import EnteSpinner from '@ente/shared/components/EnteSpinner';
import AlbumOutlined from '@mui/icons-material/AlbumOutlined';
diff --git a/apps/photos/src/components/pages/gallery/PreviewCard.tsx b/apps/photos/src/components/pages/gallery/PreviewCard.tsx
index 3d45330df4..aba12f70d1 100644
--- a/apps/photos/src/components/pages/gallery/PreviewCard.tsx
+++ b/apps/photos/src/components/pages/gallery/PreviewCard.tsx
@@ -2,7 +2,7 @@ import React, { useContext, useEffect, useRef, useState } from 'react';
import { EnteFile } from 'types/file';
import { styled } from '@mui/material';
import PlayCircleOutlineOutlinedIcon from '@mui/icons-material/PlayCircleOutlineOutlined';
-import DownloadManager from 'services/downloadManager';
+import DownloadManager from 'services/download';
import useLongPress from '@ente/shared/hooks/useLongPress';
import { GalleryContext } from 'pages/gallery';
import { GAP_BTW_TILES, IMAGE_CONTAINER_MAX_WIDTH } from 'constants/gallery';
diff --git a/apps/photos/src/pages/gallery/index.tsx b/apps/photos/src/pages/gallery/index.tsx
index 0c0b853ae6..41ed28c099 100644
--- a/apps/photos/src/pages/gallery/index.tsx
+++ b/apps/photos/src/pages/gallery/index.tsx
@@ -129,7 +129,7 @@ import InMemoryStore, { MS_KEYS } from '@ente/shared/storage/InMemoryStore';
import { syncEmbeddings } from 'services/embeddingService';
import { ClipService } from 'services/clipService';
import isElectron from 'is-electron';
-import downloadManager from 'services/downloadManager';
+import downloadManager from 'services/download';
import { APPS } from '@ente/shared/apps/constants';
export const DeadCenter = styled('div')`
diff --git a/apps/photos/src/pages/shared-albums/index.tsx b/apps/photos/src/pages/shared-albums/index.tsx
index 775f799910..9ea3fef94d 100644
--- a/apps/photos/src/pages/shared-albums/index.tsx
+++ b/apps/photos/src/pages/shared-albums/index.tsx
@@ -59,7 +59,7 @@ import OverflowMenu from '@ente/shared/components/OverflowMenu/menu';
import { OverflowMenuOption } from '@ente/shared/components/OverflowMenu/option';
import { ENTE_WEBSITE_LINK } from '@ente/shared/constants/urls';
import { APPS } from '@ente/shared/apps/constants';
-import downloadManager from 'services/downloadManager';
+import downloadManager from 'services/download';
const defaultThumbStore = new Map();
const defaultFileStore = new Map();
diff --git a/apps/photos/src/services/clipService.ts b/apps/photos/src/services/clipService.ts
index 14417083e8..c1083258c2 100644
--- a/apps/photos/src/services/clipService.ts
+++ b/apps/photos/src/services/clipService.ts
@@ -4,7 +4,7 @@ import {
getLocalEmbeddings,
} from './embeddingService';
import { getAllLocalFiles, getLocalFiles } from './fileService';
-import downloadManager from './downloadManager';
+import downloadManager from './download';
import { logError } from '@ente/shared/sentry';
import { addLogLine } from '@ente/shared/logging';
import { Events, eventBus } from '@ente/shared/events';
diff --git a/apps/photos/src/services/downloadManagerClients/photos.ts b/apps/photos/src/services/download/clients/photos.ts
similarity index 97%
rename from apps/photos/src/services/downloadManagerClients/photos.ts
rename to apps/photos/src/services/download/clients/photos.ts
index 783bef1920..0810808423 100644
--- a/apps/photos/src/services/downloadManagerClients/photos.ts
+++ b/apps/photos/src/services/download/clients/photos.ts
@@ -1,7 +1,7 @@
import HTTPService from '@ente/shared/network/HTTPService';
import { getFileURL, getThumbnailURL } from '@ente/shared/network/api';
import { EnteFile } from 'types/file';
-import { DownloadClient } from 'services/downloadManager';
+import { DownloadClient } from 'services/download';
import { CustomError } from '@ente/shared/error';
import { retryAsyncFunction } from 'utils/network';
diff --git a/apps/photos/src/services/downloadManagerClients/publicAlbums.ts b/apps/photos/src/services/download/clients/publicAlbums.ts
similarity index 97%
rename from apps/photos/src/services/downloadManagerClients/publicAlbums.ts
rename to apps/photos/src/services/download/clients/publicAlbums.ts
index f4970b38c9..1977d5650e 100644
--- a/apps/photos/src/services/downloadManagerClients/publicAlbums.ts
+++ b/apps/photos/src/services/download/clients/publicAlbums.ts
@@ -4,7 +4,7 @@ import {
getPublicCollectionThumbnailURL,
} from '@ente/shared/network/api';
import { EnteFile } from 'types/file';
-import { DownloadClient } from 'services/downloadManager';
+import { DownloadClient } from 'services/download';
import { CustomError } from '@ente/shared/error';
import { retryAsyncFunction } from 'utils/network';
diff --git a/apps/photos/src/services/downloadManager.ts b/apps/photos/src/services/download/index.ts
similarity index 99%
rename from apps/photos/src/services/downloadManager.ts
rename to apps/photos/src/services/download/index.ts
index faa9233bab..d3849f49b4 100644
--- a/apps/photos/src/services/downloadManager.ts
+++ b/apps/photos/src/services/download/index.ts
@@ -15,8 +15,8 @@ import { DedicatedCryptoWorker } from '@ente/shared/crypto/internal/crypto.worke
import { LimitedCache } from '@ente/shared/storage/cacheStorage/types';
import { addLogLine } from '@ente/shared/logging';
import { APPS } from '@ente/shared/apps/constants';
-import { PhotosDownloadClient } from './downloadManagerClients/photos';
-import { PublicAlbumsDownloadClient } from './downloadManagerClients/publicAlbums';
+import { PhotosDownloadClient } from './clients/photos';
+import { PublicAlbumsDownloadClient } from './clients/publicAlbums';
export type SourceURLs = {
original: string[];
diff --git a/apps/photos/src/services/export/index.ts b/apps/photos/src/services/export/index.ts
index 05f39455e8..c5bed8b564 100644
--- a/apps/photos/src/services/export/index.ts
+++ b/apps/photos/src/services/export/index.ts
@@ -25,7 +25,7 @@ import {
import { logError } from '@ente/shared/sentry';
import { getData, LS_KEYS, setData } from '@ente/shared/storage/localStorage';
import { getAllLocalCollections } from '../collectionService';
-import downloadManager from '../downloadManager';
+import downloadManager from '../download';
import { getAllLocalFiles } from '../fileService';
import { EnteFile } from 'types/file';
diff --git a/apps/photos/src/services/export/migration.ts b/apps/photos/src/services/export/migration.ts
index f0d5df62a4..dd86313a8f 100644
--- a/apps/photos/src/services/export/migration.ts
+++ b/apps/photos/src/services/export/migration.ts
@@ -43,7 +43,7 @@ import {
} from 'utils/export/migration';
import { FILE_TYPE } from 'constants/file';
import { decodeLivePhoto } from 'services/livePhotoService';
-import downloadManager from 'services/downloadManager';
+import downloadManager from 'services/download';
import { sleep } from 'utils/common';
export async function migrateExport(
diff --git a/apps/photos/src/services/machineLearning/machineLearningService.ts b/apps/photos/src/services/machineLearning/machineLearningService.ts
index db777c2f50..eee95be2b1 100644
--- a/apps/photos/src/services/machineLearning/machineLearningService.ts
+++ b/apps/photos/src/services/machineLearning/machineLearningService.ts
@@ -33,7 +33,7 @@ import ObjectService from './objectService';
import ReaderService from './readerService';
import { logError } from '@ente/shared/sentry';
import { addLogLine } from '@ente/shared/logging';
-import downloadManager from 'services/downloadManager';
+import downloadManager from 'services/download';
import { APPS } from '@ente/shared/apps/constants';
class MachineLearningService {
diff --git a/apps/photos/src/services/migrateThumbnailService.ts b/apps/photos/src/services/migrateThumbnailService.ts
index a405473397..5ffd39391a 100644
--- a/apps/photos/src/services/migrateThumbnailService.ts
+++ b/apps/photos/src/services/migrateThumbnailService.ts
@@ -1,4 +1,4 @@
-import downloadManager from 'services/downloadManager';
+import downloadManager from 'services/download';
import { getLocalFiles } from 'services/fileService';
import { generateThumbnail } from 'services/upload/thumbnailService';
import { getToken } from '@ente/shared/storage/localStorage/helpers';
diff --git a/apps/photos/src/services/updateCreationTimeWithExif.ts b/apps/photos/src/services/updateCreationTimeWithExif.ts
index a18f861294..751e132cef 100644
--- a/apps/photos/src/services/updateCreationTimeWithExif.ts
+++ b/apps/photos/src/services/updateCreationTimeWithExif.ts
@@ -5,7 +5,7 @@ import {
updateExistingFilePubMetadata,
} from 'utils/file';
import { logError } from '@ente/shared/sentry';
-import downloadManager from './downloadManager';
+import downloadManager from './download';
import { EnteFile } from 'types/file';
import { getParsedExifData } from './upload/exifService';
diff --git a/apps/photos/src/utils/file/index.ts b/apps/photos/src/utils/file/index.ts
index 8007f93361..39951578e7 100644
--- a/apps/photos/src/utils/file/index.ts
+++ b/apps/photos/src/utils/file/index.ts
@@ -10,7 +10,7 @@ import {
} from 'types/file';
import { decodeLivePhoto } from 'services/livePhotoService';
import { getFileType } from 'services/typeDetectionService';
-import DownloadManager from 'services/downloadManager';
+import DownloadManager from 'services/download';
import { logError } from '@ente/shared/sentry';
import { User } from '@ente/shared/user/types';
import { getData, LS_KEYS } from '@ente/shared/storage/localStorage';
diff --git a/apps/photos/src/utils/machineLearning/index.ts b/apps/photos/src/utils/machineLearning/index.ts
index a0b94d2e2d..e6156ad9ed 100644
--- a/apps/photos/src/utils/machineLearning/index.ts
+++ b/apps/photos/src/utils/machineLearning/index.ts
@@ -3,7 +3,7 @@ import * as tf from '@tensorflow/tfjs-core';
import { BLAZEFACE_FACE_SIZE } from 'constants/mlConfig';
import { euclidean } from 'hdbscan';
import PQueue from 'p-queue';
-import DownloadManager from 'services/downloadManager';
+import DownloadManager from 'services/download';
import { getLocalFiles } from 'services/fileService';
import { EnteFile } from 'types/file';
import { Dimensions } from 'types/image';