From f63e8b51d99cf606c226858fc25c5e105bb8ea45 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Sat, 19 Oct 2024 22:44:08 +0530 Subject: [PATCH] [mob][photos] Use service locators where ever necessary --- mobile/lib/services/location_service.dart | 3 +-- mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart | 3 +-- mobile/lib/utils/hierarchical_search_util.dart | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/mobile/lib/services/location_service.dart b/mobile/lib/services/location_service.dart index ed62db9e5a..6a3aeb9ceb 100644 --- a/mobile/lib/services/location_service.dart +++ b/mobile/lib/services/location_service.dart @@ -48,8 +48,7 @@ class LocationService { Future> getLocationTagsToOccurance( List files, ) async { - final locationTagEntities = - await LocationService.instance.getLocationTags(); + final locationTagEntities = await locationService.getLocationTags(); final locationTagToOccurrence = await _computer.compute( _getLocationTagsToOccurenceForIsolate, diff --git a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart index 39a173f655..8c2b280f24 100644 --- a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart +++ b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart @@ -24,7 +24,6 @@ import "package:photos/models/metadata/common_keys.dart"; import 'package:photos/models/selected_files.dart'; import 'package:photos/service_locator.dart'; import 'package:photos/services/collections_service.dart'; -import "package:photos/services/location_service.dart"; import 'package:photos/services/sync_service.dart'; import "package:photos/states/location_screen_state.dart"; import "package:photos/theme/colors.dart"; @@ -617,7 +616,7 @@ class _GalleryAppBarWidgetState extends State { Future deleteLocation() async { try { - await LocationService.instance.deleteLocationTag( + await locationService.deleteLocationTag( InheritedLocationScreenState.of(context).locationTagEntity.id, ); Navigator.of(context).pop(); diff --git a/mobile/lib/utils/hierarchical_search_util.dart b/mobile/lib/utils/hierarchical_search_util.dart index 1b75e897fc..a030a1b4d9 100644 --- a/mobile/lib/utils/hierarchical_search_util.dart +++ b/mobile/lib/utils/hierarchical_search_util.dart @@ -17,8 +17,8 @@ import "package:photos/models/search/hierarchical/file_type_filter.dart"; import "package:photos/models/search/hierarchical/hierarchical_search_filter.dart"; import "package:photos/models/search/hierarchical/location_filter.dart"; import "package:photos/models/search/hierarchical/magic_filter.dart"; +import "package:photos/service_locator.dart"; import "package:photos/services/collections_service.dart"; -import "package:photos/services/location_service.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/magic_cache_service.dart"; @@ -231,7 +231,7 @@ Future> _curateLocationFilters( ) async { final locationFilters = []; final locationTagToOccurrence = - await LocationService.instance.getLocationTagsToOccurance(files); + await locationService.getLocationTagsToOccurance(files); for (LocationTag locationTag in locationTagToOccurrence.keys) { locationFilters.add( @@ -367,7 +367,7 @@ Future> curateFaceFilters( Future> curateMagicFilters(List files) async { final magicFilters = []; - final magicCaches = await MagicCacheService.instance.getMagicCache(); + final magicCaches = await magicCacheService.getMagicCache(); final filesUploadedFileIDs = filesToUploadedFileIDs(files); for (MagicCache magicCache in magicCaches) { final uploadedIDs = magicCache.fileUploadedIDs.toSet();