mirror of
https://github.com/immich-app/immich.git
synced 2024-12-25 10:43:13 +02:00
fix(mobile): show all places don't show all places (#9193)
fix(mobile): show all places doesn't show all places
This commit is contained in:
parent
f057fe045e
commit
c0495ca23f
@ -3,7 +3,7 @@ import 'package:immich_mobile/models/search/search_curated_content.model.dart';
|
|||||||
|
|
||||||
import 'package:immich_mobile/modules/search/services/search.service.dart';
|
import 'package:immich_mobile/modules/search/services/search.service.dart';
|
||||||
|
|
||||||
final getPlacesProvider =
|
final getPreviewPlacesProvider =
|
||||||
FutureProvider.autoDispose<List<SearchCuratedContent>>((ref) async {
|
FutureProvider.autoDispose<List<SearchCuratedContent>>((ref) async {
|
||||||
final SearchService searchService = ref.watch(searchServiceProvider);
|
final SearchService searchService = ref.watch(searchServiceProvider);
|
||||||
|
|
||||||
@ -27,3 +27,25 @@ final getPlacesProvider =
|
|||||||
|
|
||||||
return curatedContent;
|
return curatedContent;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final getAllPlacesProvider =
|
||||||
|
FutureProvider.autoDispose<List<SearchCuratedContent>>((ref) async {
|
||||||
|
final SearchService searchService = ref.watch(searchServiceProvider);
|
||||||
|
|
||||||
|
final assetPlaces = await searchService.getAllPlaces();
|
||||||
|
|
||||||
|
if (assetPlaces == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
final curatedContent = assetPlaces
|
||||||
|
.map(
|
||||||
|
(data) => SearchCuratedContent(
|
||||||
|
label: data.exifInfo!.city!,
|
||||||
|
id: data.id,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return curatedContent;
|
||||||
|
});
|
||||||
|
@ -119,4 +119,13 @@ class SearchService {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<List<AssetResponseDto>?> getAllPlaces() async {
|
||||||
|
try {
|
||||||
|
return await _apiService.searchApi.getAssetsByCity();
|
||||||
|
} catch (error, stackTrace) {
|
||||||
|
_log.severe("Failed to getAllPlaces", error, stackTrace);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,13 @@ import 'package:immich_mobile/modules/search/providers/search_page_state.provide
|
|||||||
import 'package:immich_mobile/modules/search/ui/explore_grid.dart';
|
import 'package:immich_mobile/modules/search/ui/explore_grid.dart';
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
class CuratedLocationPage extends HookConsumerWidget {
|
class AllPlacesPage extends HookConsumerWidget {
|
||||||
const CuratedLocationPage({super.key});
|
const AllPlacesPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
AsyncValue<List<SearchCuratedContent>> places =
|
AsyncValue<List<SearchCuratedContent>> places =
|
||||||
ref.watch(getPlacesProvider);
|
ref.watch(getAllPlacesProvider);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
@ -27,7 +27,7 @@ class SearchPage extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final places = ref.watch(getPlacesProvider);
|
final places = ref.watch(getPreviewPlacesProvider);
|
||||||
final curatedPeople = ref.watch(getAllPeopleProvider);
|
final curatedPeople = ref.watch(getAllPeopleProvider);
|
||||||
final isMapEnabled =
|
final isMapEnabled =
|
||||||
ref.watch(serverInfoProvider.select((v) => v.serverFeatures.map));
|
ref.watch(serverInfoProvider.select((v) => v.serverFeatures.map));
|
||||||
@ -174,7 +174,7 @@ class SearchPage extends HookConsumerWidget {
|
|||||||
SearchRowTitle(
|
SearchRowTitle(
|
||||||
title: "search_page_places".tr(),
|
title: "search_page_places".tr(),
|
||||||
onViewAllPressed: () =>
|
onViewAllPressed: () =>
|
||||||
context.pushRoute(const CuratedLocationRoute()),
|
context.pushRoute(const AllPlacesRoute()),
|
||||||
top: 0,
|
top: 0,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10.0),
|
const SizedBox(height: 10.0),
|
||||||
|
@ -41,7 +41,7 @@ import 'package:immich_mobile/modules/trash/views/trash_page.dart';
|
|||||||
import 'package:immich_mobile/modules/search/views/all_motion_videos_page.dart';
|
import 'package:immich_mobile/modules/search/views/all_motion_videos_page.dart';
|
||||||
import 'package:immich_mobile/modules/search/views/all_people_page.dart';
|
import 'package:immich_mobile/modules/search/views/all_people_page.dart';
|
||||||
import 'package:immich_mobile/modules/search/views/all_videos_page.dart';
|
import 'package:immich_mobile/modules/search/views/all_videos_page.dart';
|
||||||
import 'package:immich_mobile/modules/search/views/curated_location_page.dart';
|
import 'package:immich_mobile/modules/search/views/all_places_page.dart';
|
||||||
import 'package:immich_mobile/modules/search/views/person_result_page.dart';
|
import 'package:immich_mobile/modules/search/views/person_result_page.dart';
|
||||||
import 'package:immich_mobile/modules/search/views/recently_added_page.dart';
|
import 'package:immich_mobile/modules/search/views/recently_added_page.dart';
|
||||||
import 'package:immich_mobile/modules/search/views/search_page.dart';
|
import 'package:immich_mobile/modules/search/views/search_page.dart';
|
||||||
@ -127,7 +127,7 @@ class AppRouter extends _$AppRouter {
|
|||||||
guards: [_authGuard, _duplicateGuard, _backupPermissionGuard],
|
guards: [_authGuard, _duplicateGuard, _backupPermissionGuard],
|
||||||
),
|
),
|
||||||
AutoRoute(
|
AutoRoute(
|
||||||
page: CuratedLocationRoute.page,
|
page: AllPlacesRoute.page,
|
||||||
guards: [_authGuard, _duplicateGuard],
|
guards: [_authGuard, _duplicateGuard],
|
||||||
),
|
),
|
||||||
AutoRoute(
|
AutoRoute(
|
||||||
|
@ -138,10 +138,10 @@ abstract class _$AppRouter extends RootStackRouter {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
CuratedLocationRoute.name: (routeData) {
|
AllPlacesRoute.name: (routeData) {
|
||||||
return AutoRoutePage<dynamic>(
|
return AutoRoutePage<dynamic>(
|
||||||
routeData: routeData,
|
routeData: routeData,
|
||||||
child: const CuratedLocationPage(),
|
child: const AllPlacesPage(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
FailedBackupStatusRoute.name: (routeData) {
|
FailedBackupStatusRoute.name: (routeData) {
|
||||||
@ -753,11 +753,11 @@ class CreateAlbumRouteArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [CuratedLocationPage]
|
/// [AllPlacesPage]
|
||||||
class CuratedLocationRoute extends PageRouteInfo<void> {
|
class AllPlacesRoute extends PageRouteInfo<void> {
|
||||||
const CuratedLocationRoute({List<PageRouteInfo>? children})
|
const AllPlacesRoute({List<PageRouteInfo>? children})
|
||||||
: super(
|
: super(
|
||||||
CuratedLocationRoute.name,
|
AllPlacesRoute.name,
|
||||||
initialChildren: children,
|
initialChildren: children,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class TabNavigationObserver extends AutoRouterObserver {
|
|||||||
// Perform tasks on re-visit to SearchRoute
|
// Perform tasks on re-visit to SearchRoute
|
||||||
if (route.name == 'SearchRoute') {
|
if (route.name == 'SearchRoute') {
|
||||||
// Refresh Location State
|
// Refresh Location State
|
||||||
ref.invalidate(getPlacesProvider);
|
ref.invalidate(getPreviewPlacesProvider);
|
||||||
ref.invalidate(getAllPeopleProvider);
|
ref.invalidate(getAllPeopleProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user