2022-02-03 10:06:44 -06:00
|
|
|
import 'package:auto_route/auto_route.dart';
|
2026-04-18 01:58:36 +05:30
|
|
|
import 'package:collection/collection.dart';
|
2022-04-23 21:08:45 -05:00
|
|
|
import 'package:flutter/material.dart';
|
2022-07-13 07:23:48 -05:00
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2025-07-10 10:13:46 -05:00
|
|
|
import 'package:immich_mobile/domain/models/album/album.model.dart';
|
|
|
|
|
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
2025-07-07 23:41:37 -05:00
|
|
|
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
|
2026-04-15 09:26:40 -05:00
|
|
|
import 'package:immich_mobile/domain/models/asset_edit.model.dart';
|
2025-02-28 01:48:49 +05:30
|
|
|
import 'package:immich_mobile/domain/models/log.model.dart';
|
2025-07-04 13:49:15 -05:00
|
|
|
import 'package:immich_mobile/domain/models/memory.model.dart';
|
2025-07-29 22:07:53 -05:00
|
|
|
import 'package:immich_mobile/domain/models/person.model.dart';
|
2025-03-12 19:26:56 +05:30
|
|
|
import 'package:immich_mobile/domain/models/user.model.dart';
|
2025-07-02 23:54:37 +05:30
|
|
|
import 'package:immich_mobile/domain/services/timeline.service.dart';
|
2025-03-06 18:27:43 +01:00
|
|
|
import 'package:immich_mobile/models/folder/recursive_folder.model.dart';
|
2024-05-14 19:07:31 +00:00
|
|
|
import 'package:immich_mobile/models/shared_link/shared_link.model.dart';
|
2025-01-16 21:20:44 -06:00
|
|
|
import 'package:immich_mobile/models/upload/share_intent_attachment.model.dart';
|
2025-08-05 10:31:58 -05:00
|
|
|
import 'package:immich_mobile/pages/backup/drift_backup.page.dart';
|
|
|
|
|
import 'package:immich_mobile/pages/backup/drift_backup_album_selection.page.dart';
|
2025-08-21 12:18:31 -05:00
|
|
|
import 'package:immich_mobile/pages/backup/drift_backup_asset_detail.page.dart';
|
2025-07-30 11:43:20 -05:00
|
|
|
import 'package:immich_mobile/pages/backup/drift_backup_options.page.dart';
|
2025-07-21 15:30:51 -05:00
|
|
|
import 'package:immich_mobile/pages/backup/drift_upload_detail.page.dart';
|
2024-05-14 19:07:31 +00:00
|
|
|
import 'package:immich_mobile/pages/common/app_log.page.dart';
|
|
|
|
|
import 'package:immich_mobile/pages/common/app_log_detail.page.dart';
|
2024-06-26 15:31:55 -04:00
|
|
|
import 'package:immich_mobile/pages/common/headers_settings.page.dart';
|
2024-05-14 19:07:31 +00:00
|
|
|
import 'package:immich_mobile/pages/common/settings.page.dart';
|
|
|
|
|
import 'package:immich_mobile/pages/common/splash_screen.page.dart';
|
2025-06-24 20:02:46 -05:00
|
|
|
import 'package:immich_mobile/pages/common/tab_shell.page.dart';
|
2025-03-12 19:26:56 +05:30
|
|
|
import 'package:immich_mobile/pages/library/folder/folder.page.dart';
|
2025-05-20 08:35:22 -05:00
|
|
|
import 'package:immich_mobile/pages/library/locked/pin_auth.page.dart';
|
2026-06-04 18:35:45 +05:30
|
|
|
import 'package:immich_mobile/pages/library/partner/partner.page.dart';
|
2025-02-28 01:48:49 +05:30
|
|
|
import 'package:immich_mobile/pages/library/shared_link/shared_link.page.dart';
|
|
|
|
|
import 'package:immich_mobile/pages/library/shared_link/shared_link_edit.page.dart';
|
2024-05-05 13:14:49 -05:00
|
|
|
import 'package:immich_mobile/pages/login/change_password.page.dart';
|
|
|
|
|
import 'package:immich_mobile/pages/login/login.page.dart';
|
2024-05-14 19:07:31 +00:00
|
|
|
import 'package:immich_mobile/pages/search/map/map_location_picker.page.dart';
|
2025-09-10 12:11:46 -05:00
|
|
|
import 'package:immich_mobile/pages/settings/sync_status.page.dart';
|
2025-01-16 21:20:44 -06:00
|
|
|
import 'package:immich_mobile/pages/share_intent/share_intent.page.dart';
|
2026-02-19 23:57:16 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/cleanup_preview.page.dart';
|
2025-07-17 21:42:29 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/dev/main_timeline.page.dart';
|
|
|
|
|
import 'package:immich_mobile/presentation/pages/dev/media_stat.page.dart';
|
2026-06-30 13:53:13 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/feature_message/whats_new.page.dart';
|
2025-09-19 00:47:01 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/download_info.page.dart';
|
2025-08-14 17:50:56 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/drift_activities.page.dart';
|
2025-07-17 21:42:29 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/drift_album.page.dart';
|
2025-08-05 10:31:58 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/drift_album_options.page.dart';
|
2025-07-17 21:42:29 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/drift_archive.page.dart';
|
|
|
|
|
import 'package:immich_mobile/presentation/pages/drift_asset_selection_timeline.page.dart';
|
2025-09-10 19:08:53 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/drift_asset_troubleshoot.page.dart';
|
2025-07-17 21:42:29 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/drift_create_album.page.dart';
|
2025-07-11 10:34:38 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/drift_favorite.page.dart';
|
2025-07-17 21:42:29 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/drift_library.page.dart';
|
2025-07-11 10:34:38 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/drift_local_album.page.dart';
|
2025-07-17 21:42:29 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/drift_locked_folder.page.dart';
|
2025-08-06 11:05:49 -04:00
|
|
|
import 'package:immich_mobile/presentation/pages/drift_map.page.dart';
|
2025-07-17 21:42:29 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/drift_memory.page.dart';
|
|
|
|
|
import 'package:immich_mobile/presentation/pages/drift_partner_detail.page.dart';
|
2025-07-29 22:07:53 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/drift_people_collection.page.dart';
|
|
|
|
|
import 'package:immich_mobile/presentation/pages/drift_person.page.dart';
|
2025-07-15 23:10:12 +08:00
|
|
|
import 'package:immich_mobile/presentation/pages/drift_place.page.dart';
|
|
|
|
|
import 'package:immich_mobile/presentation/pages/drift_place_detail.page.dart';
|
2026-05-11 14:35:10 -07:00
|
|
|
import 'package:immich_mobile/presentation/pages/drift_recently_added.page.dart';
|
2026-06-04 18:35:45 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/drift_recently_taken.page.dart';
|
2025-07-17 21:42:29 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/drift_remote_album.page.dart';
|
2026-05-15 16:12:04 -07:00
|
|
|
import 'package:immich_mobile/presentation/pages/drift_slideshow.page.dart';
|
2025-07-11 10:34:38 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/drift_trash.page.dart';
|
2025-08-05 10:31:58 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/drift_user_selection.page.dart';
|
2025-07-17 21:42:29 +05:30
|
|
|
import 'package:immich_mobile/presentation/pages/drift_video.page.dart';
|
2026-04-15 09:26:40 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/edit/drift_edit.page.dart';
|
2025-07-11 10:34:38 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/local_timeline.page.dart';
|
2026-04-15 09:26:40 -05:00
|
|
|
import 'package:immich_mobile/presentation/pages/profile/profile_picture_crop.page.dart';
|
2025-07-18 04:25:25 +08:00
|
|
|
import 'package:immich_mobile/presentation/pages/search/drift_search.page.dart';
|
2025-07-02 23:54:37 +05:30
|
|
|
import 'package:immich_mobile/presentation/widgets/asset_viewer/asset_viewer.page.dart';
|
2024-05-14 19:07:31 +00:00
|
|
|
import 'package:immich_mobile/providers/api.provider.dart';
|
|
|
|
|
import 'package:immich_mobile/providers/gallery_permission.provider.dart';
|
|
|
|
|
import 'package:immich_mobile/routing/auth_guard.dart';
|
|
|
|
|
import 'package:immich_mobile/routing/duplicate_guard.dart';
|
2025-05-20 08:35:22 -05:00
|
|
|
import 'package:immich_mobile/routing/locked_guard.dart';
|
2024-05-02 15:59:14 -05:00
|
|
|
import 'package:immich_mobile/services/api.service.dart';
|
2026-04-21 22:52:00 +02:00
|
|
|
import 'package:immich_mobile/services/auth.service.dart';
|
2025-05-20 08:35:22 -05:00
|
|
|
import 'package:immich_mobile/services/local_auth.service.dart';
|
|
|
|
|
import 'package:immich_mobile/services/secure_storage.service.dart';
|
2024-01-15 15:26:13 +00:00
|
|
|
import 'package:maplibre_gl/maplibre_gl.dart';
|
2022-02-03 10:06:44 -06:00
|
|
|
|
|
|
|
|
part 'router.gr.dart';
|
|
|
|
|
|
2025-05-20 08:35:22 -05:00
|
|
|
final appRouterProvider = Provider(
|
|
|
|
|
(ref) => AppRouter(
|
|
|
|
|
ref.watch(apiServiceProvider),
|
2026-04-21 22:52:00 +02:00
|
|
|
ref.watch(authServiceProvider),
|
2025-05-20 08:35:22 -05:00
|
|
|
ref.watch(galleryPermissionNotifier.notifier),
|
|
|
|
|
ref.watch(secureStorageServiceProvider),
|
|
|
|
|
ref.watch(localAuthServiceProvider),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
2024-01-15 16:50:33 +00:00
|
|
|
@AutoRouterConfig(replaceInRouteName: 'Page,Route')
|
2024-08-06 12:50:20 -05:00
|
|
|
class AppRouter extends RootStackRouter {
|
2024-01-15 16:50:33 +00:00
|
|
|
late final AuthGuard _authGuard;
|
|
|
|
|
late final DuplicateGuard _duplicateGuard;
|
2025-05-20 08:35:22 -05:00
|
|
|
late final LockedGuard _lockedGuard;
|
2024-01-15 16:50:33 +00:00
|
|
|
|
|
|
|
|
AppRouter(
|
|
|
|
|
ApiService apiService,
|
2026-04-21 22:52:00 +02:00
|
|
|
AuthService authService,
|
2024-01-15 16:50:33 +00:00
|
|
|
GalleryPermissionNotifier galleryPermissionNotifier,
|
2025-05-20 08:35:22 -05:00
|
|
|
SecureStorageService secureStorageService,
|
|
|
|
|
LocalAuthService localAuthService,
|
2024-01-15 16:50:33 +00:00
|
|
|
) {
|
2026-04-21 22:52:00 +02:00
|
|
|
_authGuard = AuthGuard(apiService, authService);
|
2025-06-25 13:06:24 +05:30
|
|
|
_duplicateGuard = const DuplicateGuard();
|
2025-07-25 08:07:22 +05:30
|
|
|
_lockedGuard = LockedGuard(apiService, secureStorageService, localAuthService);
|
2024-01-15 16:50:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
RouteType get defaultRouteType => const RouteType.material();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
late final List<AutoRoute> routes = [
|
|
|
|
|
AutoRoute(page: SplashScreenRoute.page, initial: true),
|
2026-02-12 16:27:43 +02:00
|
|
|
AutoRoute(page: LoginRoute.page),
|
2024-01-15 16:50:33 +00:00
|
|
|
AutoRoute(page: ChangePasswordRoute.page),
|
2025-12-06 04:02:04 +11:00
|
|
|
AutoRoute(
|
2025-06-24 20:02:46 -05:00
|
|
|
page: TabShellRoute.page,
|
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
|
children: [
|
2025-07-29 00:34:03 +05:30
|
|
|
AutoRoute(page: MainTimelineRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftSearchRoute.page, guards: [_authGuard, _duplicateGuard], maintainState: false),
|
|
|
|
|
AutoRoute(page: DriftLibraryRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftAlbumsRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2022-02-27 12:43:29 -06:00
|
|
|
],
|
|
|
|
|
),
|
2026-02-22 07:02:33 +01:00
|
|
|
AutoRoute(page: ProfilePictureCropRoute.page),
|
2024-01-15 16:50:33 +00:00
|
|
|
AutoRoute(page: SettingsRoute.page, guards: [_duplicateGuard]),
|
2024-03-12 14:56:08 +00:00
|
|
|
AutoRoute(page: SettingsSubRoute.page, guards: [_duplicateGuard]),
|
2026-06-30 13:53:13 -05:00
|
|
|
AutoRoute(page: WhatsNewRoute.page, guards: [_duplicateGuard]),
|
2024-01-15 16:50:33 +00:00
|
|
|
AutoRoute(page: AppLogRoute.page, guards: [_duplicateGuard]),
|
|
|
|
|
AutoRoute(page: AppLogDetailRoute.page, guards: [_duplicateGuard]),
|
2025-12-01 06:01:01 +11:00
|
|
|
AutoRoute(page: FolderRoute.page, guards: [_authGuard]),
|
|
|
|
|
AutoRoute(page: SharedLinkRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-07-29 00:34:03 +05:30
|
|
|
AutoRoute(page: SharedLinkEditRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
CustomRoute(page: MapLocationPickerRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: HeaderSettingsRoute.page, guards: [_duplicateGuard]),
|
|
|
|
|
AutoRoute(page: ShareIntentRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: PinAuthRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: LocalMediaSummaryRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: RemoteMediaSummaryRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftBackupRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftBackupAlbumSelectionRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: LocalTimelineRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: MainTimelineRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-10-28 11:52:01 -05:00
|
|
|
AutoRoute(page: RemoteAlbumRoute.page, guards: [_authGuard]),
|
2025-07-02 23:54:37 +05:30
|
|
|
AutoRoute(
|
|
|
|
|
page: AssetViewerRoute.page,
|
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
|
type: RouteType.custom(
|
|
|
|
|
customRouteBuilder: <T>(context, child, page) => PageRouteBuilder<T>(
|
|
|
|
|
fullscreenDialog: page.fullscreenDialog,
|
|
|
|
|
settings: page,
|
|
|
|
|
pageBuilder: (_, __, ___) => child,
|
|
|
|
|
opaque: false,
|
2025-11-07 15:13:43 -08:00
|
|
|
transitionsBuilder: TransitionsBuilders.fadeIn,
|
2025-07-02 23:54:37 +05:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
2025-07-29 00:34:03 +05:30
|
|
|
AutoRoute(page: DriftMemoryRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftFavoriteRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftTrashRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftArchiveRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftLockedFolderRoute.page, guards: [_authGuard, _lockedGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftVideoRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftLibraryRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftAssetSelectionTimelineRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftPartnerDetailRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftRecentlyTakenRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2026-05-11 14:35:10 -07:00
|
|
|
AutoRoute(page: DriftRecentlyAddedRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-07-29 00:34:03 +05:30
|
|
|
AutoRoute(page: DriftLocalAlbumsRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftCreateAlbumRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftPlaceRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftPlaceDetailRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftUserSelectionRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2026-06-04 18:35:45 +05:30
|
|
|
AutoRoute(page: PartnerRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-07-29 00:34:03 +05:30
|
|
|
AutoRoute(page: DriftUploadDetailRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-09-10 12:11:46 -05:00
|
|
|
AutoRoute(page: SyncStatusRoute.page, guards: [_duplicateGuard]),
|
2025-07-29 22:07:53 -05:00
|
|
|
AutoRoute(page: DriftPeopleCollectionRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
|
AutoRoute(page: DriftPersonRoute.page, guards: [_authGuard]),
|
2025-07-30 11:43:20 -05:00
|
|
|
AutoRoute(page: DriftBackupOptionsRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-08-05 10:31:58 -05:00
|
|
|
AutoRoute(page: DriftAlbumOptionsRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-08-06 11:05:49 -04:00
|
|
|
AutoRoute(page: DriftMapRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-08-11 15:01:31 -05:00
|
|
|
AutoRoute(page: DriftEditImageRoute.page),
|
2025-08-14 17:50:56 -05:00
|
|
|
AutoRoute(page: DriftActivitiesRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-08-21 12:18:31 -05:00
|
|
|
AutoRoute(page: DriftBackupAssetDetailRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-09-10 19:08:53 +05:30
|
|
|
AutoRoute(page: AssetTroubleshootRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-09-19 00:47:01 -05:00
|
|
|
AutoRoute(page: DownloadInfoRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2026-01-07 20:55:28 -06:00
|
|
|
AutoRoute(page: CleanupPreviewRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2026-05-15 16:12:04 -07:00
|
|
|
AutoRoute(page: DriftSlideshowRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2025-06-24 09:20:24 -05:00
|
|
|
// required to handle all deeplinks in deep_link.service.dart
|
|
|
|
|
// auto_route_library#1722
|
|
|
|
|
RedirectRoute(path: '*', redirectTo: '/'),
|
2024-01-15 16:50:33 +00:00
|
|
|
];
|
2022-02-03 10:06:44 -06:00
|
|
|
}
|