2022-02-03 18:06:44 +02:00
|
|
|
import 'package:auto_route/auto_route.dart';
|
2022-04-24 04:08:45 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2022-07-13 14:23:48 +02:00
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
2023-11-06 17:46:26 +02:00
|
|
|
import 'package:immich_mobile/modules/activities/views/activities_page.dart';
|
2022-11-27 22:34:19 +02:00
|
|
|
import 'package:immich_mobile/modules/album/models/asset_selection_page_result.model.dart';
|
2023-08-18 06:26:12 +02:00
|
|
|
import 'package:immich_mobile/modules/album/views/album_options_part.dart';
|
2022-11-27 22:34:19 +02:00
|
|
|
import 'package:immich_mobile/modules/album/views/album_viewer_page.dart';
|
|
|
|
import 'package:immich_mobile/modules/album/views/asset_selection_page.dart';
|
|
|
|
import 'package:immich_mobile/modules/album/views/create_album_page.dart';
|
2022-08-03 07:04:34 +02:00
|
|
|
import 'package:immich_mobile/modules/album/views/library_page.dart';
|
2023-12-07 17:53:15 +02:00
|
|
|
import 'package:immich_mobile/modules/backup/views/backup_options_page.dart';
|
2024-01-15 17:26:13 +02:00
|
|
|
import 'package:immich_mobile/modules/map/views/map_location_picker_page.dart';
|
2023-08-27 07:07:35 +02:00
|
|
|
import 'package:immich_mobile/modules/map/views/map_page.dart';
|
2023-06-27 23:00:20 +02:00
|
|
|
import 'package:immich_mobile/modules/memories/models/memory.dart';
|
|
|
|
import 'package:immich_mobile/modules/memories/views/memory_page.dart';
|
2023-05-25 05:52:43 +02:00
|
|
|
import 'package:immich_mobile/modules/partner/views/partner_detail_page.dart';
|
|
|
|
import 'package:immich_mobile/modules/partner/views/partner_page.dart';
|
2022-11-27 22:34:19 +02:00
|
|
|
import 'package:immich_mobile/modules/album/views/select_additional_user_for_sharing_page.dart';
|
|
|
|
import 'package:immich_mobile/modules/album/views/select_user_for_sharing_page.dart';
|
|
|
|
import 'package:immich_mobile/modules/album/views/sharing_page.dart';
|
2023-04-17 07:02:07 +02:00
|
|
|
import 'package:immich_mobile/modules/archive/views/archive_page.dart';
|
2022-08-03 22:36:12 +02:00
|
|
|
import 'package:immich_mobile/modules/asset_viewer/views/gallery_viewer.dart';
|
2022-11-27 22:34:19 +02:00
|
|
|
import 'package:immich_mobile/modules/asset_viewer/views/video_viewer_page.dart';
|
2022-05-06 14:22:23 +02:00
|
|
|
import 'package:immich_mobile/modules/backup/views/album_preview_page.dart';
|
|
|
|
import 'package:immich_mobile/modules/backup/views/backup_album_selection_page.dart';
|
2022-11-27 22:34:19 +02:00
|
|
|
import 'package:immich_mobile/modules/backup/views/backup_controller_page.dart';
|
2022-07-06 23:12:55 +02:00
|
|
|
import 'package:immich_mobile/modules/backup/views/failed_backup_status_page.dart';
|
2023-02-05 05:25:11 +02:00
|
|
|
import 'package:immich_mobile/modules/favorite/views/favorites_page.dart';
|
2022-11-27 22:34:19 +02:00
|
|
|
import 'package:immich_mobile/modules/home/views/home_page.dart';
|
2022-06-27 22:13:07 +02:00
|
|
|
import 'package:immich_mobile/modules/login/views/change_password_page.dart';
|
2022-02-03 18:06:44 +02:00
|
|
|
import 'package:immich_mobile/modules/login/views/login_page.dart';
|
2023-02-28 18:22:18 +02:00
|
|
|
import 'package:immich_mobile/modules/onboarding/providers/gallery_permission.provider.dart';
|
|
|
|
import 'package:immich_mobile/modules/onboarding/views/permission_onboarding_page.dart';
|
2024-04-01 16:45:11 +02:00
|
|
|
import 'package:immich_mobile/modules/search/models/search_filter.dart';
|
2024-03-12 16:56:08 +02:00
|
|
|
import 'package:immich_mobile/modules/settings/views/settings_sub_page.dart';
|
2024-04-01 16:45:11 +02:00
|
|
|
import 'package:immich_mobile/modules/search/views/search_input_page.dart';
|
2023-10-22 17:05:10 +02:00
|
|
|
import 'package:immich_mobile/modules/shared_link/models/shared_link.dart';
|
|
|
|
import 'package:immich_mobile/modules/shared_link/views/shared_link_edit_page.dart';
|
|
|
|
import 'package:immich_mobile/modules/shared_link/views/shared_link_page.dart';
|
2023-10-06 09:01:14 +02:00
|
|
|
import 'package:immich_mobile/modules/trash/views/trash_page.dart';
|
2023-03-25 05:44:53 +02:00
|
|
|
import 'package:immich_mobile/modules/search/views/all_motion_videos_page.dart';
|
2023-06-23 17:44:02 +02:00
|
|
|
import 'package:immich_mobile/modules/search/views/all_people_page.dart';
|
2023-03-25 05:44:53 +02:00
|
|
|
import 'package:immich_mobile/modules/search/views/all_videos_page.dart';
|
2023-03-23 17:08:14 +02:00
|
|
|
import 'package:immich_mobile/modules/search/views/curated_location_page.dart';
|
2023-06-23 17:44:02 +02:00
|
|
|
import 'package:immich_mobile/modules/search/views/person_result_page.dart';
|
2023-03-25 05:44:53 +02:00
|
|
|
import 'package:immich_mobile/modules/search/views/recently_added_page.dart';
|
2022-02-27 20:43:29 +02:00
|
|
|
import 'package:immich_mobile/modules/search/views/search_page.dart';
|
2022-08-13 22:51:09 +02:00
|
|
|
import 'package:immich_mobile/modules/settings/views/settings_page.dart';
|
2022-02-03 18:06:44 +02:00
|
|
|
import 'package:immich_mobile/routing/auth_guard.dart';
|
2023-12-05 17:45:04 +02:00
|
|
|
import 'package:immich_mobile/routing/custom_transition_builders.dart';
|
2023-02-24 18:51:35 +02:00
|
|
|
import 'package:immich_mobile/routing/duplicate_guard.dart';
|
2023-11-14 22:30:27 +02:00
|
|
|
import 'package:immich_mobile/routing/backup_permission_guard.dart';
|
2022-11-08 19:00:24 +02:00
|
|
|
import 'package:immich_mobile/shared/models/asset.dart';
|
2023-02-06 09:13:32 +02:00
|
|
|
import 'package:immich_mobile/shared/models/album.dart';
|
2023-04-03 23:43:46 +02:00
|
|
|
import 'package:immich_mobile/shared/models/logger_message.model.dart';
|
2023-06-23 17:44:02 +02:00
|
|
|
import 'package:immich_mobile/shared/models/user.dart';
|
2022-08-03 07:04:34 +02:00
|
|
|
import 'package:immich_mobile/shared/providers/api.provider.dart';
|
2022-07-13 14:23:48 +02:00
|
|
|
import 'package:immich_mobile/shared/services/api.service.dart';
|
2023-04-03 23:43:46 +02:00
|
|
|
import 'package:immich_mobile/shared/views/app_log_detail_page.dart';
|
2022-11-27 22:34:19 +02:00
|
|
|
import 'package:immich_mobile/shared/views/app_log_page.dart';
|
2022-06-21 01:10:23 +02:00
|
|
|
import 'package:immich_mobile/shared/views/splash_screen.dart';
|
2022-02-27 20:43:29 +02:00
|
|
|
import 'package:immich_mobile/shared/views/tab_controller_page.dart';
|
2023-10-22 04:38:07 +02:00
|
|
|
import 'package:isar/isar.dart';
|
2024-01-15 17:26:13 +02:00
|
|
|
import 'package:maplibre_gl/maplibre_gl.dart';
|
2023-12-05 21:34:37 +02:00
|
|
|
import 'package:photo_manager/photo_manager.dart' hide LatLng;
|
2022-02-03 18:06:44 +02:00
|
|
|
|
|
|
|
part 'router.gr.dart';
|
|
|
|
|
2024-01-15 18:50:33 +02:00
|
|
|
@AutoRouterConfig(replaceInRouteName: 'Page,Route')
|
|
|
|
class AppRouter extends _$AppRouter {
|
|
|
|
late final AuthGuard _authGuard;
|
|
|
|
late final DuplicateGuard _duplicateGuard;
|
|
|
|
late final BackupPermissionGuard _backupPermissionGuard;
|
|
|
|
|
|
|
|
AppRouter(
|
|
|
|
ApiService apiService,
|
|
|
|
GalleryPermissionNotifier galleryPermissionNotifier,
|
|
|
|
) {
|
|
|
|
_authGuard = AuthGuard(apiService);
|
|
|
|
_duplicateGuard = DuplicateGuard();
|
|
|
|
_backupPermissionGuard = BackupPermissionGuard(galleryPermissionNotifier);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
RouteType get defaultRouteType => const RouteType.material();
|
|
|
|
|
|
|
|
@override
|
|
|
|
late final List<AutoRoute> routes = [
|
|
|
|
AutoRoute(page: SplashScreenRoute.page, initial: true),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: PermissionOnboardingRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-02-24 18:51:35 +02:00
|
|
|
),
|
2024-01-15 18:50:33 +02:00
|
|
|
AutoRoute(page: LoginRoute.page, guards: [_duplicateGuard]),
|
|
|
|
AutoRoute(page: ChangePasswordRoute.page),
|
2022-06-21 01:10:23 +02:00
|
|
|
CustomRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: TabControllerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2022-02-27 20:43:29 +02:00
|
|
|
children: [
|
2024-01-15 18:50:33 +02:00
|
|
|
AutoRoute(page: HomeRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
AutoRoute(
|
|
|
|
page: SearchRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(
|
|
|
|
page: SharingRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(
|
|
|
|
page: LibraryRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
2022-02-27 20:43:29 +02:00
|
|
|
],
|
2022-06-21 01:10:23 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.fadeIn,
|
2022-02-27 20:43:29 +02:00
|
|
|
),
|
2023-12-05 17:45:04 +02:00
|
|
|
CustomRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: GalleryViewerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-12-05 17:45:04 +02:00
|
|
|
transitionsBuilder: CustomTransitionsBuilders.zoomedPage,
|
2023-04-03 23:43:46 +02:00
|
|
|
),
|
2023-11-14 22:30:27 +02:00
|
|
|
AutoRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: VideoViewerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(
|
|
|
|
page: BackupControllerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard, _backupPermissionGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(
|
|
|
|
page: CuratedLocationRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(
|
|
|
|
page: CreateAlbumRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(page: FavoritesRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
AutoRoute(page: AllVideosRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
AutoRoute(
|
|
|
|
page: AllMotionPhotosRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-11-14 22:30:27 +02:00
|
|
|
),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: RecentlyAddedRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-04-03 23:43:46 +02:00
|
|
|
),
|
2024-01-15 18:50:33 +02:00
|
|
|
CustomRoute(
|
|
|
|
page: AssetSelectionRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2022-04-24 04:08:45 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
2024-01-15 18:50:33 +02:00
|
|
|
CustomRoute(
|
|
|
|
page: SelectUserForSharingRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2022-04-24 04:08:45 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
2024-01-15 18:50:33 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: AlbumViewerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
|
|
|
CustomRoute(
|
|
|
|
page: SelectAdditionalUserForSharingRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2022-04-24 04:08:45 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: BackupAlbumSelectionRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(
|
|
|
|
page: AlbumPreviewRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-04-03 23:43:46 +02:00
|
|
|
),
|
2022-07-06 23:12:55 +02:00
|
|
|
CustomRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: FailedBackupStatusRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2022-07-06 23:12:55 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
2024-01-15 18:50:33 +02:00
|
|
|
AutoRoute(page: SettingsRoute.page, guards: [_duplicateGuard]),
|
2024-03-12 16:56:08 +02:00
|
|
|
AutoRoute(page: SettingsSubRoute.page, guards: [_duplicateGuard]),
|
2024-01-15 18:50:33 +02:00
|
|
|
AutoRoute(page: AppLogRoute.page, guards: [_duplicateGuard]),
|
|
|
|
AutoRoute(page: AppLogDetailRoute.page, guards: [_duplicateGuard]),
|
|
|
|
AutoRoute(page: ArchiveRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
AutoRoute(page: PartnerRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: PartnerDetailRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-02-24 18:51:35 +02:00
|
|
|
),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: PersonResultRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-04-03 23:43:46 +02:00
|
|
|
),
|
2024-01-15 18:50:33 +02:00
|
|
|
AutoRoute(page: AllPeopleRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
AutoRoute(page: MemoryRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
AutoRoute(page: MapRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2023-04-17 07:02:07 +02:00
|
|
|
AutoRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: AlbumOptionsRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-04-17 07:02:07 +02:00
|
|
|
),
|
2024-01-15 18:50:33 +02:00
|
|
|
AutoRoute(page: TrashRoute.page, guards: [_authGuard, _duplicateGuard]),
|
2023-06-23 17:44:02 +02:00
|
|
|
AutoRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: SharedLinkRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(
|
|
|
|
page: SharedLinkEditRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-06-23 17:44:02 +02:00
|
|
|
),
|
2023-11-06 17:46:26 +02:00
|
|
|
CustomRoute(
|
2024-01-15 18:50:33 +02:00
|
|
|
page: ActivitiesRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-11-06 17:46:26 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
|
|
|
durationInMilliseconds: 200,
|
|
|
|
),
|
2024-01-15 18:50:33 +02:00
|
|
|
CustomRoute(
|
|
|
|
page: MapLocationPickerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-12-05 21:34:37 +02:00
|
|
|
),
|
2024-01-15 18:50:33 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: BackupOptionsRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
2024-04-01 16:45:11 +02:00
|
|
|
CustomRoute(
|
|
|
|
page: SearchInputRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
transitionsBuilder: TransitionsBuilders.noTransition,
|
|
|
|
),
|
2024-01-15 18:50:33 +02:00
|
|
|
];
|
2022-02-03 18:06:44 +02:00
|
|
|
}
|
2022-07-13 14:23:48 +02:00
|
|
|
|
2023-04-03 23:43:46 +02:00
|
|
|
final appRouterProvider = Provider(
|
|
|
|
(ref) => AppRouter(
|
|
|
|
ref.watch(apiServiceProvider),
|
|
|
|
ref.watch(galleryPermissionNotifier.notifier),
|
|
|
|
),
|
|
|
|
);
|