1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00
immich/mobile/lib/modules/search/providers/search_page_state.provider.dart

30 lines
796 B
Dart
Raw Normal View History

2022-02-27 20:45:12 +02:00
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/models/search/search_curated_content.model.dart';
2022-02-27 20:45:12 +02:00
import 'package:immich_mobile/modules/search/services/search.service.dart';
final getPlacesProvider =
FutureProvider.autoDispose<List<SearchCuratedContent>>((ref) async {
final SearchService searchService = ref.watch(searchServiceProvider);
final exploreData = await searchService.getExploreData();
if (exploreData == null) {
return [];
}
2022-02-27 20:45:12 +02:00
final locations =
exploreData.firstWhere((data) => data.fieldName == "exifInfo.city").items;
final curatedContent = locations
.map(
(l) => SearchCuratedContent(
label: l.value,
id: l.data.id,
),
)
.toList();
return curatedContent;
});