mirror of
https://github.com/immich-app/immich.git
synced 2026-06-28 17:33:36 -07:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11ee153c84 | |||
| 5baf71c008 | |||
| 23455cbd07 | |||
| 9d5fe5f1a4 | |||
| 2c7a24d81f | |||
| 8e9bec75ac |
@@ -16,7 +16,6 @@ import 'package:immich_mobile/presentation/widgets/bottom_sheet/map_bottom_sheet
|
|||||||
import 'package:immich_mobile/presentation/widgets/map/map.state.dart';
|
import 'package:immich_mobile/presentation/widgets/map/map.state.dart';
|
||||||
import 'package:immich_mobile/presentation/widgets/map/map_utils.dart';
|
import 'package:immich_mobile/presentation/widgets/map/map_utils.dart';
|
||||||
import 'package:immich_mobile/providers/routes.provider.dart';
|
import 'package:immich_mobile/providers/routes.provider.dart';
|
||||||
import 'package:immich_mobile/routing/router.dart';
|
|
||||||
import 'package:immich_mobile/utils/async_mutex.dart';
|
import 'package:immich_mobile/utils/async_mutex.dart';
|
||||||
import 'package:immich_mobile/utils/debounce.dart';
|
import 'package:immich_mobile/utils/debounce.dart';
|
||||||
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
||||||
@@ -133,8 +132,7 @@ class _DriftMapState extends ConsumerState<DriftMap> {
|
|||||||
// When the AssetViewer is open, the DriftMap route stays alive in the background.
|
// When the AssetViewer is open, the DriftMap route stays alive in the background.
|
||||||
// If we continue to update bounds, the map-scoped timeline service gets recreated and the previous one disposed,
|
// If we continue to update bounds, the map-scoped timeline service gets recreated and the previous one disposed,
|
||||||
// which can invalidate the TimelineService instance that was passed into AssetViewerRoute (causing "loading forever").
|
// which can invalidate the TimelineService instance that was passed into AssetViewerRoute (causing "loading forever").
|
||||||
final currentRoute = ref.read(currentRouteNameProvider);
|
if (ref.read(isAssetViewerOpenProvider)) {
|
||||||
if (currentRoute == AssetViewerRoute.name) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,6 +181,11 @@ class _DriftMapState extends ConsumerState<DriftMap> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
ref.listen<bool>(isAssetViewerOpenProvider, (previous, current) {
|
||||||
|
if (previous == true && !current) {
|
||||||
|
_debouncer.run(() => setBounds(forceReload: true));
|
||||||
|
}
|
||||||
|
});
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
_Map(initialLocation: widget.initialLocation, onMapCreated: onMapCreated, onMapReady: onMapReady),
|
_Map(initialLocation: widget.initialLocation, onMapCreated: onMapCreated, onMapReady: onMapReady),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/widgets.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
|
||||||
final inLockedViewProvider = StateProvider<bool>((ref) => false);
|
final inLockedViewProvider = StateProvider<bool>((ref) => false);
|
||||||
|
final isAssetViewerOpenProvider = StateProvider<bool>((ref) => false);
|
||||||
final currentRouteNameProvider = StateProvider<String?>((ref) => null);
|
final currentRouteNameProvider = StateProvider<String?>((ref) => null);
|
||||||
final previousRouteNameProvider = StateProvider<String?>((ref) => null);
|
final previousRouteNameProvider = StateProvider<String?>((ref) => null);
|
||||||
final previousRouteDataProvider = StateProvider<RouteSettings?>((ref) => null);
|
final previousRouteDataProvider = StateProvider<RouteSettings?>((ref) => null);
|
||||||
|
|||||||
@@ -24,9 +24,20 @@ class AppNavigationObserver extends AutoRouterObserver {
|
|||||||
ref.read(currentRouteNameProvider.notifier).state = route.settings.name;
|
ref.read(currentRouteNameProvider.notifier).state = route.settings.name;
|
||||||
ref.read(previousRouteNameProvider.notifier).state = previousRoute?.settings.name;
|
ref.read(previousRouteNameProvider.notifier).state = previousRoute?.settings.name;
|
||||||
ref.read(previousRouteDataProvider.notifier).state = previousRoute?.settings;
|
ref.read(previousRouteDataProvider.notifier).state = previousRoute?.settings;
|
||||||
|
if (route.settings.name == AssetViewerRoute.name) {
|
||||||
|
ref.read(isAssetViewerOpenProvider.notifier).state = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didPop(Route route, Route? previousRoute) {
|
||||||
|
_handleDriftLockedFolderState(previousRoute ?? route, null);
|
||||||
|
if (route.settings.name == AssetViewerRoute.name) {
|
||||||
|
Future(() => ref.read(isAssetViewerOpenProvider.notifier).state = false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_handleDriftLockedFolderState(Route route, Route? previousRoute) {
|
_handleDriftLockedFolderState(Route route, Route? previousRoute) {
|
||||||
final isInLockedView = ref.read(inLockedViewProvider);
|
final isInLockedView = ref.read(inLockedViewProvider);
|
||||||
final isFromLockedViewToDetailView =
|
final isFromLockedViewToDetailView =
|
||||||
|
|||||||
Reference in New Issue
Block a user