Skip to content

armgit / ente

Public Imported from GitHub
0

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

Move thumbnail loading into download module

Neeraj Gupta06fe646f746c
diff --git a/mobile/apps/photos/lib/utils/thumbnail_util.dart b/mobile/apps/photos/lib/module/download/thumbnail.dart
similarity index 100%
rename from mobile/apps/photos/lib/utils/thumbnail_util.dart
rename to mobile/apps/photos/lib/module/download/thumbnail.dart
diff --git a/mobile/apps/photos/lib/module/upload/upload_data.dart b/mobile/apps/photos/lib/module/upload/upload_data.dart
index 9961586cac..039db5d24e 100644
--- a/mobile/apps/photos/lib/module/upload/upload_data.dart
+++ b/mobile/apps/photos/lib/module/upload/upload_data.dart
@@ -19,6 +19,7 @@ import "package:photos/models/file/extensions/file_props.dart";
import 'package:photos/models/file/file.dart';
import 'package:photos/models/file/file_type.dart';
import "package:photos/models/location/location.dart";
+import 'package:photos/module/download/thumbnail.dart';
import "package:photos/module/live_photo/archive.dart";
import 'package:photos/module/upload/model/media_upload_data.dart';
import "package:photos/services/sync/local_sync_service.dart";
@@ -28,7 +29,6 @@ import "package:photos/utils/embedded_media_location.dart";
import "package:photos/utils/exif_util.dart";
import 'package:photos/utils/file_util.dart';
import "package:photos/utils/image_util.dart";
-import 'package:photos/utils/thumbnail_util.dart';
import "package:uuid/uuid.dart";
import 'package:video_thumbnail/video_thumbnail.dart';
diff --git a/mobile/apps/photos/lib/services/home_widget_service.dart b/mobile/apps/photos/lib/services/home_widget_service.dart
index 2e86dc8a24..ac29910eff 100644
--- a/mobile/apps/photos/lib/services/home_widget_service.dart
+++ b/mobile/apps/photos/lib/services/home_widget_service.dart
@@ -8,11 +8,11 @@ import 'package:path_provider/path_provider.dart';
import 'package:path_provider_foundation/path_provider_foundation.dart';
import 'package:photos/core/constants.dart';
import 'package:photos/models/file/file.dart';
+import 'package:photos/module/download/thumbnail.dart';
import 'package:photos/services/album_home_widget_service.dart';
import 'package:photos/services/memory_home_widget_service.dart';
import 'package:photos/services/people_home_widget_service.dart';
import 'package:photos/services/smart_memories_service.dart';
-import 'package:photos/utils/thumbnail_util.dart';
import 'package:synchronized/synchronized.dart';
enum WidgetStatus {
diff --git a/mobile/apps/photos/lib/services/wrapped/wrapped_media_preloader.dart b/mobile/apps/photos/lib/services/wrapped/wrapped_media_preloader.dart
index 7dc80ed5d7..762672be07 100644
--- a/mobile/apps/photos/lib/services/wrapped/wrapped_media_preloader.dart
+++ b/mobile/apps/photos/lib/services/wrapped/wrapped_media_preloader.dart
@@ -3,8 +3,8 @@ import "dart:async";
import "package:logging/logging.dart";
import "package:photos/db/files_db.dart";
import "package:photos/models/file/file.dart";
+import "package:photos/module/download/thumbnail.dart";
import "package:photos/services/wrapped/models.dart";
-import "package:photos/utils/thumbnail_util.dart";
/// Preloads the media referenced by Wrapped cards so the viewer can render
/// without waiting on database and thumbnail fetches.
diff --git a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
index 72100c0bee..dfec0765b2 100644
--- a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
+++ b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
@@ -22,6 +22,7 @@ import "package:photos/models/file/extensions/file_props.dart";
import "package:photos/models/file/file.dart";
import "package:photos/models/file/file_type.dart";
import "package:photos/models/memories/memory.dart";
+import "package:photos/module/download/thumbnail.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/memory_share_service.dart";
import "package:photos/services/smart_memories_service.dart";
@@ -40,7 +41,6 @@ import "package:photos/ui/viewer/gallery/jump_to_date_gallery.dart";
import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/file_util.dart";
import "package:photos/utils/share_util.dart";
-import "package:photos/utils/thumbnail_util.dart";
//There are two states of variables that FullScreenMemory depends on:
//1. The list of memories
diff --git a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
index 674de196b1..10c45174fa 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
@@ -18,6 +18,7 @@ import 'package:photos/models/file/file.dart';
import "package:photos/models/file/file_type.dart";
import "package:photos/models/file/trash_file.dart";
import "package:photos/models/gallery_type.dart";
+import "package:photos/module/download/thumbnail.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/collections_service.dart";
import "package:photos/states/detail_page_state.dart";
@@ -35,7 +36,6 @@ import "package:photos/ui/viewer/file/qr_code_highlight_overlay.dart";
import 'package:photos/ui/viewer/gallery/gallery.dart';
import 'package:photos/utils/dialog_util.dart';
import 'package:photos/utils/file_util.dart';
-import "package:photos/utils/thumbnail_util.dart";
enum DetailPageMode { minimalistic, full }
diff --git a/mobile/apps/photos/lib/ui/viewer/file/thumbnail_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/thumbnail_widget.dart
index 0855f4f747..7efd6bd72f 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/thumbnail_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/thumbnail_widget.dart
@@ -20,6 +20,7 @@ import 'package:photos/models/file/file.dart';
import 'package:photos/models/file/file_type.dart';
import 'package:photos/models/file/trash_file.dart';
import 'package:photos/models/gallery_type.dart';
+import 'package:photos/module/download/thumbnail.dart';
import 'package:photos/service_locator.dart';
import 'package:photos/services/collections_service.dart';
import 'package:photos/services/favorites_service.dart';
@@ -28,7 +29,6 @@ import 'package:photos/ui/viewer/file/file_icons_widget.dart';
import 'package:photos/ui/viewer/gallery/component/group/type.dart';
import 'package:photos/ui/viewer/gallery/state/gallery_context_state.dart';
import 'package:photos/utils/file_util.dart';
-import 'package:photos/utils/thumbnail_util.dart';
class ThumbnailWidget extends StatefulWidget {
final EnteFile file;
diff --git a/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart b/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
index 22e6ddd138..799fe044b3 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
@@ -18,6 +18,7 @@ import "package:photos/events/reset_zoom_of_photo_view_event.dart";
import "package:photos/events/retry_failed_image_load_event.dart";
import "package:photos/models/file/extensions/file_props.dart";
import 'package:photos/models/file/file.dart';
+import 'package:photos/module/download/thumbnail.dart';
import "package:photos/service_locator.dart" show flagService;
import "package:photos/src/rust/api/image_processing_api.dart" as rust_image;
import "package:photos/states/detail_page_state.dart";
@@ -30,7 +31,6 @@ import "package:photos/utils/exif_util.dart";
import 'package:photos/utils/file_util.dart';
import 'package:photos/utils/image_util.dart';
import "package:photos/utils/ram_check_util.dart";
-import 'package:photos/utils/thumbnail_util.dart';
class ZoomableImage extends StatefulWidget {
final EnteFile photo;
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart b/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart
index 8ba4d3f437..dabfcfdf3d 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/edit_contact_page.dart
@@ -15,6 +15,7 @@ import "package:photos/models/file/file.dart";
import "package:photos/models/ml/face/person.dart";
import "package:photos/models/search/generic_search_result.dart";
import "package:photos/models/search/search_constants.dart";
+import "package:photos/module/download/thumbnail.dart";
import "package:photos/services/machine_learning/face_ml/face_filtering/face_filtering_constants.dart";
import "package:photos/services/machine_learning/face_ml/person/person_service.dart";
import "package:photos/services/machine_learning/ml_result.dart";
@@ -34,7 +35,6 @@ import "package:photos/ui/viewer/search/result/contact_photo_adjust_page.dart";
import "package:photos/ui/viewer/search/result/contact_photo_picker_sheet.dart";
import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/face/face_thumbnail_cache.dart";
-import "package:photos/utils/thumbnail_util.dart";
class EditContactPage extends StatefulWidget {
final int contactUserId;
diff --git a/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart b/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
index f915a434ff..2ce5ebe0ea 100644
--- a/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
+++ b/mobile/apps/photos/lib/utils/face/face_thumbnail_cache.dart
@@ -13,10 +13,10 @@ import "package:photos/models/file/file.dart";
import "package:photos/models/file/file_type.dart";
import "package:photos/models/ml/face/box.dart";
import "package:photos/models/ml/face/face.dart";
+import "package:photos/module/download/thumbnail.dart";
import "package:photos/service_locator.dart" show isLocalGalleryMode;
import "package:photos/services/machine_learning/face_thumbnail_generator.dart";
import "package:photos/utils/file_util.dart";
-import "package:photos/utils/thumbnail_util.dart";
final _logger = Logger("FaceCropUtils");
diff --git a/mobile/apps/photos/lib/utils/ml_util.dart b/mobile/apps/photos/lib/utils/ml_util.dart
index 829f7a2c87..94c52c3d76 100644
--- a/mobile/apps/photos/lib/utils/ml_util.dart
+++ b/mobile/apps/photos/lib/utils/ml_util.dart
@@ -20,6 +20,7 @@ import "package:photos/models/ml/face/dimension.dart";
import "package:photos/models/ml/face/face.dart";
import "package:photos/models/ml/ml_typedefs.dart";
import "package:photos/models/ml/ml_versions.dart";
+import "package:photos/module/download/thumbnail.dart";
import "package:photos/service_locator.dart";
import "package:photos/services/collections_service.dart";
import "package:photos/services/filedata/model/file_data.dart";
@@ -36,7 +37,6 @@ import "package:photos/src/rust/api/ml_indexing_api.dart" as rust_ml;
import "package:photos/utils/file_util.dart";
import "package:photos/utils/image_ml_util.dart";
import "package:photos/utils/network_util.dart";
-import "package:photos/utils/thumbnail_util.dart";
final _logger = Logger("MlUtil");
const _kMlStaleCleanupMaxIds = 5;