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';
|
2022-11-27 22:34:19 +02:00
|
|
|
import 'package:immich_mobile/modules/album/models/asset_selection_page_result.model.dart';
|
|
|
|
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';
|
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';
|
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-03-23 17:08:14 +02:00
|
|
|
import 'package:immich_mobile/modules/search/views/curated_location_page.dart';
|
|
|
|
import 'package:immich_mobile/modules/search/views/curated_object_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-02-24 18:51:35 +02:00
|
|
|
import 'package:immich_mobile/routing/duplicate_guard.dart';
|
2023-02-28 18:22:18 +02:00
|
|
|
import 'package:immich_mobile/routing/gallery_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';
|
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';
|
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';
|
2022-05-06 14:22:23 +02:00
|
|
|
import 'package:photo_manager/photo_manager.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-02-28 18:22:18 +02:00
|
|
|
AutoRoute(page: PermissionOnboardingPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-02-24 18:51:35 +02:00
|
|
|
AutoRoute(page: LoginPage,
|
|
|
|
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-02-28 18:22:18 +02:00
|
|
|
guards: [AuthGuard, DuplicateGuard, GalleryPermissionGuard],
|
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]),
|
|
|
|
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-02-28 18:22:18 +02:00
|
|
|
AutoRoute(page: GalleryViewerPage, guards: [AuthGuard, DuplicateGuard, GalleryPermissionGuard]),
|
2023-02-24 18:51:35 +02:00
|
|
|
AutoRoute(page: VideoViewerPage, guards: [AuthGuard, DuplicateGuard]),
|
|
|
|
AutoRoute(page: BackupControllerPage, guards: [AuthGuard, DuplicateGuard]),
|
|
|
|
AutoRoute(page: SearchResultPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-03-23 17:08:14 +02:00
|
|
|
AutoRoute(page: CuratedLocationPage, guards: [AuthGuard, DuplicateGuard]),
|
|
|
|
AutoRoute(page: CuratedObjectPage, guards: [AuthGuard, DuplicateGuard]),
|
2023-02-24 18:51:35 +02:00
|
|
|
AutoRoute(page: CreateAlbumPage, guards: [AuthGuard, DuplicateGuard]),
|
|
|
|
AutoRoute(page: FavoritesPage, 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-02-24 18:51:35 +02:00
|
|
|
AutoRoute(page: BackupAlbumSelectionPage, guards: [AuthGuard, DuplicateGuard]),
|
|
|
|
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-02-24 18:51:35 +02:00
|
|
|
AutoRoute(page: SettingsPage,
|
|
|
|
guards: [
|
|
|
|
AuthGuard,
|
|
|
|
DuplicateGuard,
|
|
|
|
],
|
|
|
|
),
|
2022-11-27 22:34:19 +02:00
|
|
|
CustomRoute(
|
|
|
|
page: AppLogPage,
|
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
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(
|
|
|
|
this._apiService,
|
|
|
|
GalleryPermissionNotifier galleryPermissionNotifier,
|
|
|
|
) : super(
|
2023-02-24 18:51:35 +02:00
|
|
|
authGuard: AuthGuard(_apiService),
|
|
|
|
duplicateGuard: DuplicateGuard(),
|
2023-02-28 18:22:18 +02:00
|
|
|
galleryPermissionGuard: GalleryPermissionGuard(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
|
|
|
|
|
|
|
final appRouterProvider =
|
2023-02-28 18:22:18 +02:00
|
|
|
Provider((ref) => AppRouter(ref.watch(apiServiceProvider), ref.watch(galleryPermissionNotifier.notifier)));
|