2022-03-16 17:19:31 +02:00
|
|
|
import 'package:auto_route/auto_route.dart';
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
|
|
|
|
import 'package:immich_mobile/modules/search/providers/search_page_state.provider.dart';
|
2022-03-22 08:22:04 +02:00
|
|
|
import 'package:immich_mobile/shared/providers/server_info.provider.dart';
|
2022-03-16 17:19:31 +02:00
|
|
|
|
|
|
|
class TabNavigationObserver extends AutoRouterObserver {
|
|
|
|
/// Riverpod Instance
|
|
|
|
final WidgetRef ref;
|
|
|
|
|
|
|
|
TabNavigationObserver({
|
|
|
|
required this.ref,
|
|
|
|
});
|
|
|
|
|
|
|
|
@override
|
|
|
|
void didInitTabRoute(TabPageRoute route, TabPageRoute? previousRoute) {
|
|
|
|
// Perform tasks on first navigation to SearchRoute
|
|
|
|
if (route.name == 'SearchRoute') {
|
|
|
|
// ref.refresh(getCuratedLocationProvider);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Future<void> didChangeTabRoute(TabPageRoute route, TabPageRoute previousRoute) async {
|
|
|
|
// Perform tasks on re-visit to SearchRoute
|
|
|
|
if (route.name == 'SearchRoute') {
|
|
|
|
// Refresh Location State
|
|
|
|
ref.refresh(getCuratedLocationProvider);
|
2022-03-27 21:58:54 +02:00
|
|
|
ref.refresh(getCuratedObjectProvider);
|
2022-03-16 17:19:31 +02:00
|
|
|
}
|
2022-03-22 08:22:04 +02:00
|
|
|
|
|
|
|
ref.watch(serverInfoProvider.notifier).getServerVersion();
|
2022-03-16 17:19:31 +02:00
|
|
|
}
|
|
|
|
}
|