Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Use service locators where ever necessary

ashilknf63e8b51d99c
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<Map<LocationTag, int>> getLocationTagsToOccurance(
List<EnteFile> 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<GalleryAppBarWidget> {
Future<void> 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<List<LocationFilter>> _curateLocationFilters(
) async {
final locationFilters = <LocationFilter>[];
final locationTagToOccurrence =
- await LocationService.instance.getLocationTagsToOccurance(files);
+ await locationService.getLocationTagsToOccurance(files);
for (LocationTag locationTag in locationTagToOccurrence.keys) {
locationFilters.add(
@@ -367,7 +367,7 @@ Future<List<FaceFilter>> curateFaceFilters(
Future<List<MagicFilter>> curateMagicFilters(List<EnteFile> files) async {
final magicFilters = <MagicFilter>[];
- 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();