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-05 21:34:37 +02:00
|
|
|
import 'package:immich_mobile/modules/map/ui/map_location_picker.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';
|
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-03-03 00:44:24 +02:00
|
|
|
import 'package:immich_mobile/modules/search/views/search_result_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';
|
2023-12-05 21:34:37 +02:00
|
|
|
import 'package:photo_manager/photo_manager.dart' hide LatLng;
|
|
|
|
import 'package:latlong2/latlong.dart';
|
2022-02-03 18:06:44 +02:00
|
|
|
|
|
|
|
part 'router.gr.dart';
|
|
|
|
|
|
|
|
@MaterialAutoRouter(
|
|
|
|
replaceInRouteName: 'Page,Route',
|
|
|
|
routes: <AutoRoute>[
|
2022-06-21 01:10:23 +02:00
|
|
|
AutoRoute(page: SplashScreenPage, initial: true),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: PermissionOnboardingPage,
|
|
|
|
guards: [AuthGuard, DuplicateGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(
|
|
|
|
page: LoginPage,
|
2023-02-24 18:51:35 +02:00
|
|
|
guards: [
|
|
|
|
DuplicateGuard,
|
|
|
|
],
|
|
|
|
),
|
2022-06-27 22:13:07 +02:00
|
|
|
AutoRoute(page: ChangePasswordPage),
|
2022-06-21 01:10:23 +02:00
|
|
|
CustomRoute(
|
2022-02-27 20:43:29 +02:00
|
|
|
page: TabControllerPage,
|
2023-11-14 22:30:27 +02:00
|
|
|
guards: [AuthGuard, DuplicateGuard],
|
2022-02-27 20:43:29 +02:00
|
|
|
children: [
|
2023-02-24 18:51:35 +02:00
|
|
|
AutoRoute(page: HomePage, guards: [AuthGuard, DuplicateGuard]),
|
|
|
|
AutoRoute(page: SearchPage, guards: [AuthGuard, DuplicateGuard]),
|
|
|
|
AutoRoute(page: SharingPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-08-19 00:52:40 +02:00
|
|
|
AutoRoute(page: LibraryPage, 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(
|
2023-04-03 23:43:46 +02:00
|
|
|
page: GalleryViewerPage,
|
2023-11-14 22:30:27 +02:00
|
|
|
guards: [AuthGuard, DuplicateGuard],
|
2023-12-05 17:45:04 +02:00
|
|
|
transitionsBuilder: CustomTransitionsBuilders.zoomedPage,
|
2023-04-03 23:43:46 +02:00
|
|
|
),
|
2023-02-24 18:51:35 +02:00
|
|
|
AutoRoute(page: VideoViewerPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-11-14 22:30:27 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: BackupControllerPage,
|
|
|
|
guards: [AuthGuard, DuplicateGuard, BackupPermissionGuard],
|
|
|
|
),
|
2023-02-24 18:51:35 +02:00
|
|
|
AutoRoute(page: SearchResultPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-03-23 17:08:14 +02:00
|
|
|
AutoRoute(page: CuratedLocationPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-02-24 18:51:35 +02:00
|
|
|
AutoRoute(page: CreateAlbumPage, guards: [AuthGuard, DuplicateGuard]),
|
|
|
|
AutoRoute(page: FavoritesPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-03-25 05:44:53 +02:00
|
|
|
AutoRoute(page: AllVideosPage, guards: [AuthGuard, DuplicateGuard]),
|
|
|
|
AutoRoute(page: AllMotionPhotosPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: RecentlyAddedPage,
|
|
|
|
guards: [AuthGuard, DuplicateGuard],
|
|
|
|
),
|
2022-04-24 04:08:45 +02:00
|
|
|
CustomRoute<AssetSelectionPageResult?>(
|
|
|
|
page: AssetSelectionPage,
|
2023-02-24 18:51:35 +02:00
|
|
|
guards: [AuthGuard, DuplicateGuard],
|
2022-04-24 04:08:45 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
|
|
|
CustomRoute<List<String>>(
|
|
|
|
page: SelectUserForSharingPage,
|
2023-02-24 18:51:35 +02:00
|
|
|
guards: [AuthGuard, DuplicateGuard],
|
2022-04-24 04:08:45 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
2023-02-24 18:51:35 +02:00
|
|
|
AutoRoute(page: AlbumViewerPage, guards: [AuthGuard, DuplicateGuard]),
|
2022-04-24 04:08:45 +02:00
|
|
|
CustomRoute<List<String>?>(
|
|
|
|
page: SelectAdditionalUserForSharingPage,
|
2023-02-24 18:51:35 +02:00
|
|
|
guards: [AuthGuard, DuplicateGuard],
|
2022-04-24 04:08:45 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: BackupAlbumSelectionPage,
|
|
|
|
guards: [AuthGuard, DuplicateGuard],
|
|
|
|
),
|
2023-02-24 18:51:35 +02:00
|
|
|
AutoRoute(page: AlbumPreviewPage, guards: [AuthGuard, DuplicateGuard]),
|
2022-07-06 23:12:55 +02:00
|
|
|
CustomRoute(
|
|
|
|
page: FailedBackupStatusPage,
|
2023-02-24 18:51:35 +02:00
|
|
|
guards: [AuthGuard, DuplicateGuard],
|
2022-07-06 23:12:55 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: SettingsPage,
|
2023-02-24 18:51:35 +02:00
|
|
|
guards: [
|
|
|
|
DuplicateGuard,
|
|
|
|
],
|
|
|
|
),
|
2023-10-30 19:17:34 +02:00
|
|
|
AutoRoute(page: AppLogPage, guards: [DuplicateGuard]),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: AppLogDetailPage,
|
|
|
|
),
|
2023-04-17 07:02:07 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: ArchivePage,
|
|
|
|
guards: [
|
|
|
|
AuthGuard,
|
|
|
|
DuplicateGuard,
|
|
|
|
],
|
|
|
|
),
|
2023-05-25 05:52:43 +02:00
|
|
|
AutoRoute(page: PartnerPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-06-23 17:44:02 +02:00
|
|
|
AutoRoute(page: PartnerDetailPage, guards: [AuthGuard, DuplicateGuard]),
|
|
|
|
AutoRoute(
|
|
|
|
page: PersonResultPage,
|
|
|
|
guards: [
|
|
|
|
AuthGuard,
|
|
|
|
DuplicateGuard,
|
|
|
|
],
|
|
|
|
),
|
|
|
|
AutoRoute(page: AllPeoplePage, guards: [AuthGuard, DuplicateGuard]),
|
2023-06-27 23:00:20 +02:00
|
|
|
AutoRoute(page: MemoryPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-08-27 07:07:35 +02:00
|
|
|
AutoRoute(page: MapPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-08-18 06:26:12 +02:00
|
|
|
AutoRoute(page: AlbumOptionsPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-10-06 09:01:14 +02:00
|
|
|
AutoRoute(page: TrashPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-10-22 17:05:10 +02:00
|
|
|
AutoRoute(page: SharedLinkPage, guards: [AuthGuard, DuplicateGuard]),
|
|
|
|
AutoRoute(page: SharedLinkEditPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-11-06 17:46:26 +02:00
|
|
|
CustomRoute(
|
|
|
|
page: ActivitiesPage,
|
|
|
|
guards: [AuthGuard, DuplicateGuard],
|
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
|
|
|
durationInMilliseconds: 200,
|
|
|
|
),
|
2023-12-05 21:34:37 +02:00
|
|
|
CustomRoute<LatLng?>(
|
|
|
|
page: MapLocationPickerPage,
|
|
|
|
guards: [AuthGuard, DuplicateGuard],
|
|
|
|
),
|
2022-02-03 18:06:44 +02:00
|
|
|
],
|
|
|
|
)
|
|
|
|
class AppRouter extends _$AppRouter {
|
2022-08-03 22:36:12 +02:00
|
|
|
// ignore: unused_field
|
2022-07-13 14:23:48 +02:00
|
|
|
final ApiService _apiService;
|
2022-08-03 07:04:34 +02:00
|
|
|
|
2023-02-28 18:22:18 +02:00
|
|
|
AppRouter(
|
2023-04-03 23:43:46 +02:00
|
|
|
this._apiService,
|
2023-02-28 18:22:18 +02:00
|
|
|
GalleryPermissionNotifier galleryPermissionNotifier,
|
2023-04-03 23:43:46 +02:00
|
|
|
) : super(
|
|
|
|
authGuard: AuthGuard(_apiService),
|
2023-02-24 18:51:35 +02:00
|
|
|
duplicateGuard: DuplicateGuard(),
|
2023-11-14 22:30:27 +02:00
|
|
|
backupPermissionGuard:
|
|
|
|
BackupPermissionGuard(galleryPermissionNotifier),
|
2023-02-24 18:51:35 +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),
|
|
|
|
),
|
|
|
|
);
|