mirror of
				https://github.com/immich-app/immich.git
				synced 2025-10-31 02:27:08 -04:00 
			
		
		
		
	* chore: add unawaited_futures lint as warning # Conflicts: # mobile/analysis_options.yaml * remove unused dcm lints They will be added back later on a case by case basis * fix warning # Conflicts: # mobile/lib/presentation/pages/drift_remote_album.page.dart * auto gen file * review changes * conflict resolution --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
		
			
				
	
	
		
			35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'dart:async';
 | |
| 
 | |
| import 'package:auto_route/auto_route.dart';
 | |
| import 'package:immich_mobile/routing/router.dart';
 | |
| 
 | |
| /// Handles duplicate navigation to this route (primarily for deep linking)
 | |
| class GalleryGuard extends AutoRouteGuard {
 | |
|   const GalleryGuard();
 | |
|   @override
 | |
|   void onNavigation(NavigationResolver resolver, StackRouter router) async {
 | |
|     final newRouteName = resolver.route.name;
 | |
|     final currentTopRouteName = router.stack.isNotEmpty ? router.stack.last.name : null;
 | |
| 
 | |
|     if (currentTopRouteName == newRouteName) {
 | |
|       // Replace instead of pushing duplicate
 | |
|       final args = resolver.route.args as GalleryViewerRouteArgs;
 | |
| 
 | |
|       unawaited(
 | |
|         router.replace(
 | |
|           GalleryViewerRoute(
 | |
|             renderList: args.renderList,
 | |
|             initialIndex: args.initialIndex,
 | |
|             heroOffset: args.heroOffset,
 | |
|             showStack: args.showStack,
 | |
|           ),
 | |
|         ),
 | |
|       );
 | |
|       // Prevent further navigation since we replaced the route
 | |
|       resolver.next(false);
 | |
|       return;
 | |
|     }
 | |
|     resolver.next(true);
 | |
|   }
 | |
| }
 |