diff --git a/mobile/lib/modules/login/ui/login_form.dart b/mobile/lib/modules/login/ui/login_form.dart index 669ac45abb..ea741faf1e 100644 --- a/mobile/lib/modules/login/ui/login_form.dart +++ b/mobile/lib/modules/login/ui/login_form.dart @@ -228,7 +228,7 @@ class LoginButton extends ConsumerWidget { AutoRouter.of(context).push(const ChangePasswordRoute()); } else { ref.watch(backupProvider.notifier).resumeBackup(); - AutoRouter.of(context).pushNamed("/tab-controller-page"); + AutoRouter.of(context).replace(const TabControllerRoute()); } } else { ImmichToast.show( diff --git a/mobile/lib/shared/views/splash_screen.dart b/mobile/lib/shared/views/splash_screen.dart index e7fc8ae495..ead677582a 100644 --- a/mobile/lib/shared/views/splash_screen.dart +++ b/mobile/lib/shared/views/splash_screen.dart @@ -29,9 +29,9 @@ class SplashScreenPage extends HookConsumerWidget { if (isAuthenticated) { // Resume backup (if enable) then navigate ref.watch(backupProvider.notifier).resumeBackup(); - AutoRouter.of(context).pushNamed("/tab-controller-page"); + AutoRouter.of(context).replace(const TabControllerRoute()); } else { - AutoRouter.of(context).push(const LoginRoute()); + AutoRouter.of(context).replace(const LoginRoute()); } } @@ -40,7 +40,7 @@ class SplashScreenPage extends HookConsumerWidget { if (loginInfo?.isSaveLogin == true) { performLoggingIn(); } else { - AutoRouter.of(context).push(const LoginRoute()); + AutoRouter.of(context).replace(const LoginRoute()); } return null; }, diff --git a/mobile/lib/shared/views/tab_controller_page.dart b/mobile/lib/shared/views/tab_controller_page.dart index 83435edc4c..92d79022c2 100644 --- a/mobile/lib/shared/views/tab_controller_page.dart +++ b/mobile/lib/shared/views/tab_controller_page.dart @@ -12,7 +12,6 @@ class TabControllerPage extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { final multiselectEnabled = ref.watch(multiselectProvider); - return AutoTabsRouter( routes: [ const HomeRoute(), @@ -22,9 +21,17 @@ class TabControllerPage extends ConsumerWidget { ], builder: (context, child, animation) { final tabsRouter = AutoTabsRouter.of(context); + final appRouter = AutoRouter.of(context); return WillPopScope( onWillPop: () async { - tabsRouter.setActiveIndex(0); + if (tabsRouter.activeIndex == 0) { + if (!appRouter.canNavigateBack) { + appRouter.navigateBack(); + } + return appRouter.canNavigateBack; + } else { + tabsRouter.setActiveIndex(0); + } return false; }, child: Scaffold(