2022-02-03 17:06:44 +01: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';
|
2024-05-01 04:36:40 +02:00
|
|
|
import 'package:immich_mobile/entities/album.entity.dart';
|
2024-05-14 21:07:31 +02:00
|
|
|
import 'package:immich_mobile/entities/asset.entity.dart';
|
2024-05-01 04:36:40 +02:00
|
|
|
import 'package:immich_mobile/entities/logger_message.entity.dart';
|
|
|
|
import 'package:immich_mobile/entities/user.entity.dart';
|
2024-05-14 21:07:31 +02:00
|
|
|
import 'package:immich_mobile/models/memories/memory.model.dart';
|
|
|
|
import 'package:immich_mobile/models/search/search_filter.model.dart';
|
|
|
|
import 'package:immich_mobile/models/shared_link/shared_link.model.dart';
|
2024-05-05 20:14:49 +02:00
|
|
|
import 'package:immich_mobile/pages/backup/album_preview.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/backup/backup_album_selection.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/backup/backup_controller.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/backup/backup_options.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/backup/failed_backup_status.page.dart';
|
2024-10-10 10:44:14 +02:00
|
|
|
import 'package:immich_mobile/pages/albums/albums.page.dart';
|
2024-12-04 22:03:46 +01:00
|
|
|
import 'package:immich_mobile/pages/common/native_video_viewer.page.dart';
|
2024-10-10 10:44:14 +02:00
|
|
|
import 'package:immich_mobile/pages/library/local_albums.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/library/people/people_collection.page.dart';
|
2024-10-14 04:50:07 +02:00
|
|
|
import 'package:immich_mobile/pages/library/places/places_collection.page.dart';
|
2024-10-10 10:44:14 +02:00
|
|
|
import 'package:immich_mobile/pages/library/library.page.dart';
|
2024-05-14 21:07:31 +02:00
|
|
|
import 'package:immich_mobile/pages/common/activities.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/common/album_additional_shared_user_selection.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/common/album_asset_selection.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/common/album_options.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/common/album_shared_user_selection.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/common/album_viewer.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/common/app_log.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/common/app_log_detail.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/common/create_album.page.dart';
|
2024-05-05 20:14:49 +02:00
|
|
|
import 'package:immich_mobile/pages/common/gallery_viewer.page.dart';
|
2024-06-26 21:31:55 +02:00
|
|
|
import 'package:immich_mobile/pages/common/headers_settings.page.dart';
|
2024-05-14 21:07:31 +02:00
|
|
|
import 'package:immich_mobile/pages/common/settings.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/common/splash_screen.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/common/tab_controller.page.dart';
|
2024-07-28 22:41:14 +02:00
|
|
|
import 'package:immich_mobile/pages/editing/edit.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/editing/crop.page.dart';
|
2024-10-06 08:51:11 +02:00
|
|
|
import 'package:immich_mobile/pages/editing/filter.page.dart';
|
2024-05-05 20:14:49 +02:00
|
|
|
import 'package:immich_mobile/pages/library/archive.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/library/favorite.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/library/trash.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/login/change_password.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/login/login.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/onboarding/permission_onboarding.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/photos/memory.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/photos/photos.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/search/all_motion_videos.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/search/all_people.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/search/all_places.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/search/all_videos.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/search/map/map.page.dart';
|
2024-05-14 21:07:31 +02:00
|
|
|
import 'package:immich_mobile/pages/search/map/map_location_picker.page.dart';
|
2024-05-05 20:14:49 +02:00
|
|
|
import 'package:immich_mobile/pages/search/person_result.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/search/recently_added.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/search/search.page.dart';
|
2024-10-10 10:44:14 +02:00
|
|
|
import 'package:immich_mobile/pages/library/partner/partner.page.dart';
|
|
|
|
import 'package:immich_mobile/pages/library/partner/partner_detail.page.dart';
|
|
|
|
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-14 21:07:31 +02: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/backup_permission_guard.dart';
|
|
|
|
import 'package:immich_mobile/routing/custom_transition_builders.dart';
|
|
|
|
import 'package:immich_mobile/routing/duplicate_guard.dart';
|
2024-05-02 22:59:14 +02:00
|
|
|
import 'package:immich_mobile/services/api.service.dart';
|
2024-06-27 06:15:26 +02:00
|
|
|
import 'package:immich_mobile/widgets/asset_grid/asset_grid_data_structure.dart';
|
2023-10-22 04:38:07 +02:00
|
|
|
import 'package:isar/isar.dart';
|
2024-01-15 16:26:13 +01:00
|
|
|
import 'package:maplibre_gl/maplibre_gl.dart';
|
2022-02-03 17:06:44 +01:00
|
|
|
|
|
|
|
part 'router.gr.dart';
|
|
|
|
|
2024-01-15 17:50:33 +01:00
|
|
|
@AutoRouterConfig(replaceInRouteName: 'Page,Route')
|
2024-08-06 19:50:20 +02:00
|
|
|
class AppRouter extends RootStackRouter {
|
2024-01-15 17:50:33 +01:00
|
|
|
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 17:50:33 +01:00
|
|
|
page: PermissionOnboardingRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-02-24 17:51:35 +01:00
|
|
|
),
|
2024-01-15 17:50:33 +01:00
|
|
|
AutoRoute(page: LoginRoute.page, guards: [_duplicateGuard]),
|
|
|
|
AutoRoute(page: ChangePasswordRoute.page),
|
2024-10-14 04:50:07 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: SearchRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
maintainState: false,
|
|
|
|
),
|
2022-06-21 01:10:23 +02:00
|
|
|
CustomRoute(
|
2024-01-15 17:50:33 +01:00
|
|
|
page: TabControllerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2022-02-27 19:43:29 +01:00
|
|
|
children: [
|
2024-05-05 20:14:49 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: PhotosRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
2024-01-15 17:50:33 +01:00
|
|
|
AutoRoute(
|
2024-10-14 04:50:07 +02:00
|
|
|
page: SearchRoute.page,
|
2024-01-15 17:50:33 +01:00
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2024-10-10 10:44:14 +02:00
|
|
|
maintainState: false,
|
2024-01-15 17:50:33 +01:00
|
|
|
),
|
|
|
|
AutoRoute(
|
2024-10-10 10:44:14 +02:00
|
|
|
page: LibraryRoute.page,
|
2024-01-15 17:50:33 +01:00
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(
|
2024-10-10 10:44:14 +02:00
|
|
|
page: AlbumsRoute.page,
|
2024-01-15 17:50:33 +01:00
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
2022-02-27 19:43:29 +01:00
|
|
|
],
|
2022-06-21 01:10:23 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.fadeIn,
|
2022-02-27 19:43:29 +01:00
|
|
|
),
|
2023-12-05 16:45:04 +01:00
|
|
|
CustomRoute(
|
2024-01-15 17:50:33 +01:00
|
|
|
page: GalleryViewerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-12-05 16:45:04 +01:00
|
|
|
transitionsBuilder: CustomTransitionsBuilders.zoomedPage,
|
2023-04-03 23:43:46 +02:00
|
|
|
),
|
2024-01-15 17:50:33 +01:00
|
|
|
AutoRoute(
|
|
|
|
page: BackupControllerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard, _backupPermissionGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(
|
2024-05-01 05:14:33 +02:00
|
|
|
page: AllPlacesRoute.page,
|
2024-01-15 17:50:33 +01:00
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
|
|
|
AutoRoute(
|
|
|
|
page: CreateAlbumRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
2024-07-28 22:41:14 +02:00
|
|
|
AutoRoute(page: EditImageRoute.page),
|
|
|
|
AutoRoute(page: CropImageRoute.page),
|
2024-10-06 08:51:11 +02:00
|
|
|
AutoRoute(page: FilterImageRoute.page),
|
2024-10-10 10:44:14 +02:00
|
|
|
CustomRoute(
|
|
|
|
page: FavoritesRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
|
|
|
),
|
2024-01-15 17:50:33 +01:00
|
|
|
AutoRoute(page: AllVideosRoute.page, guards: [_authGuard, _duplicateGuard]),
|
|
|
|
AutoRoute(
|
|
|
|
page: AllMotionPhotosRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-11-14 21:30:27 +01:00
|
|
|
),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
2024-01-15 17:50:33 +01:00
|
|
|
page: RecentlyAddedRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-04-03 23:43:46 +02:00
|
|
|
),
|
2024-01-15 17:50:33 +01:00
|
|
|
CustomRoute(
|
2024-05-05 20:14:49 +02:00
|
|
|
page: AlbumAssetSelectionRoute.page,
|
2024-01-15 17:50:33 +01:00
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2022-04-24 04:08:45 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
2024-01-15 17:50:33 +01:00
|
|
|
CustomRoute(
|
2024-05-05 20:14:49 +02:00
|
|
|
page: AlbumSharedUserSelectionRoute.page,
|
2024-01-15 17:50:33 +01:00
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2022-04-24 04:08:45 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
2024-01-15 17:50:33 +01:00
|
|
|
AutoRoute(
|
|
|
|
page: AlbumViewerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
|
|
|
CustomRoute(
|
2024-05-05 20:14:49 +02:00
|
|
|
page: AlbumAdditionalSharedUserSelectionRoute.page,
|
2024-01-15 17:50:33 +01:00
|
|
|
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 17:50:33 +01: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 17:50:33 +01:00
|
|
|
page: FailedBackupStatusRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2022-07-06 23:12:55 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideBottom,
|
|
|
|
),
|
2024-01-15 17:50:33 +01:00
|
|
|
AutoRoute(page: SettingsRoute.page, guards: [_duplicateGuard]),
|
2024-03-12 15:56:08 +01:00
|
|
|
AutoRoute(page: SettingsSubRoute.page, guards: [_duplicateGuard]),
|
2024-01-15 17:50:33 +01:00
|
|
|
AutoRoute(page: AppLogRoute.page, guards: [_duplicateGuard]),
|
|
|
|
AutoRoute(page: AppLogDetailRoute.page, guards: [_duplicateGuard]),
|
2024-10-10 10:44:14 +02:00
|
|
|
CustomRoute(
|
|
|
|
page: ArchiveRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
|
|
|
),
|
|
|
|
CustomRoute(
|
|
|
|
page: PartnerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
|
|
|
),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
2024-01-15 17:50:33 +01:00
|
|
|
page: PartnerDetailRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-02-24 17:51:35 +01:00
|
|
|
),
|
2023-04-03 23:43:46 +02:00
|
|
|
AutoRoute(
|
2024-01-15 17:50:33 +01:00
|
|
|
page: PersonResultRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-04-03 23:43:46 +02:00
|
|
|
),
|
2024-01-15 17:50:33 +01: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 17:50:33 +01:00
|
|
|
page: AlbumOptionsRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-04-17 07:02:07 +02:00
|
|
|
),
|
2024-10-10 10:44:14 +02:00
|
|
|
CustomRoute(
|
|
|
|
page: TrashRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
|
|
|
),
|
|
|
|
CustomRoute(
|
2024-01-15 17:50:33 +01:00
|
|
|
page: SharedLinkRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2024-10-10 10:44:14 +02:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
2024-01-15 17:50:33 +01:00
|
|
|
),
|
|
|
|
AutoRoute(
|
|
|
|
page: SharedLinkEditRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-06-23 17:44:02 +02:00
|
|
|
),
|
2023-11-06 16:46:26 +01:00
|
|
|
CustomRoute(
|
2024-01-15 17:50:33 +01:00
|
|
|
page: ActivitiesRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-11-06 16:46:26 +01:00
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
|
|
|
durationInMilliseconds: 200,
|
|
|
|
),
|
2024-01-15 17:50:33 +01:00
|
|
|
CustomRoute(
|
|
|
|
page: MapLocationPickerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
2023-12-05 20:34:37 +01:00
|
|
|
),
|
2024-01-15 17:50:33 +01:00
|
|
|
AutoRoute(
|
|
|
|
page: BackupOptionsRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
2024-06-26 21:31:55 +02:00
|
|
|
AutoRoute(
|
|
|
|
page: HeaderSettingsRoute.page,
|
|
|
|
guards: [_duplicateGuard],
|
|
|
|
),
|
2024-10-10 10:44:14 +02:00
|
|
|
CustomRoute(
|
|
|
|
page: PeopleCollectionRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
|
|
|
),
|
|
|
|
CustomRoute(
|
|
|
|
page: AlbumsRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
|
|
|
),
|
|
|
|
CustomRoute(
|
|
|
|
page: LocalAlbumsRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
|
|
|
),
|
|
|
|
CustomRoute(
|
|
|
|
page: PlacesCollectionRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
transitionsBuilder: TransitionsBuilders.slideLeft,
|
|
|
|
),
|
2024-12-04 22:03:46 +01:00
|
|
|
AutoRoute(
|
|
|
|
page: NativeVideoViewerRoute.page,
|
|
|
|
guards: [_authGuard, _duplicateGuard],
|
|
|
|
),
|
2024-01-15 17:50:33 +01:00
|
|
|
];
|
2022-02-03 17:06:44 +01: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),
|
|
|
|
),
|
|
|
|
);
|