From 6c008176c9fc9bfdfc465815b7dab03f22751e1d Mon Sep 17 00:00:00 2001 From: shenlong <139912620+shenlong-tanwen@users.noreply.github.com> Date: Tue, 14 May 2024 19:07:31 +0000 Subject: [PATCH] deps(mobile): update dependency auto_route to v8 (#9456) deps: update dependency auto_route to v8 Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com> --- .../lib/pages/backup/album_preview.page.dart | 2 +- .../backup/backup_album_selection.page.dart | 2 +- .../pages/backup/backup_controller.page.dart | 10 +- .../lib/pages/backup/backup_options.page.dart | 2 +- .../backup/failed_backup_status.page.dart | 2 +- ...additional_shared_user_selection.page.dart | 4 +- .../lib/pages/common/album_options.page.dart | 2 +- .../album_shared_user_selection.page.dart | 4 +- mobile/lib/pages/common/app_log.page.dart | 2 +- .../lib/pages/common/create_album.page.dart | 8 +- .../lib/pages/common/gallery_viewer.page.dart | 24 +- .../lib/pages/common/video_viewer.page.dart | 5 +- mobile/lib/pages/library/archive.page.dart | 2 +- mobile/lib/pages/library/favorite.page.dart | 2 +- mobile/lib/pages/library/trash.page.dart | 2 +- .../permission_onboarding.page.dart | 2 +- mobile/lib/pages/photos/memory.page.dart | 10 +- .../pages/search/all_motion_videos.page.dart | 2 +- mobile/lib/pages/search/all_people.page.dart | 2 +- mobile/lib/pages/search/all_places.page.dart | 2 +- mobile/lib/pages/search/all_videos.page.dart | 2 +- .../search/map/map_location_picker.page.dart | 2 +- .../lib/pages/search/person_result.page.dart | 2 +- .../lib/pages/search/recently_added.page.dart | 2 +- .../lib/pages/search/search_input.page.dart | 8 +- .../shared_link/shared_link_edit.page.dart | 4 +- mobile/lib/routing/router.dart | 59 ++- mobile/lib/routing/router.gr.dart | 436 ++++++++---------- .../widgets/album/album_viewer_appbar.dart | 2 +- .../asset_viewer/bottom_gallery_bar.dart | 10 +- .../asset_viewer/top_control_app_bar.dart | 2 +- .../lib/widgets/common/location_picker.dart | 2 +- mobile/lib/widgets/map/map_app_bar.dart | 2 +- .../widgets/memories/memory_bottom_info.dart | 2 +- mobile/pubspec.lock | 8 +- mobile/pubspec.yaml | 4 +- 36 files changed, 275 insertions(+), 363 deletions(-) diff --git a/mobile/lib/pages/backup/album_preview.page.dart b/mobile/lib/pages/backup/album_preview.page.dart index 7e1486208e..218127ff43 100644 --- a/mobile/lib/pages/backup/album_preview.page.dart +++ b/mobile/lib/pages/backup/album_preview.page.dart @@ -54,7 +54,7 @@ class AlbumPreviewPage extends HookConsumerWidget { ], ), leading: IconButton( - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_new_rounded), ), ), diff --git a/mobile/lib/pages/backup/backup_album_selection.page.dart b/mobile/lib/pages/backup/backup_album_selection.page.dart index 3890726fc1..ecfebd3cb7 100644 --- a/mobile/lib/pages/backup/backup_album_selection.page.dart +++ b/mobile/lib/pages/backup/backup_album_selection.page.dart @@ -191,7 +191,7 @@ class BackupAlbumSelectionPage extends HookConsumerWidget { return Scaffold( appBar: AppBar( leading: IconButton( - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded), ), title: const Text( diff --git a/mobile/lib/pages/backup/backup_controller.page.dart b/mobile/lib/pages/backup/backup_controller.page.dart index 4efa59f959..89384cf97a 100644 --- a/mobile/lib/pages/backup/backup_controller.page.dart +++ b/mobile/lib/pages/backup/backup_controller.page.dart @@ -7,16 +7,16 @@ import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:immich_mobile/extensions/build_context_extensions.dart'; +import 'package:immich_mobile/models/backup/backup_state.model.dart'; import 'package:immich_mobile/providers/album/album.provider.dart'; +import 'package:immich_mobile/providers/backup/backup.provider.dart'; import 'package:immich_mobile/providers/backup/error_backup_list.provider.dart'; import 'package:immich_mobile/providers/backup/ios_background_settings.provider.dart'; import 'package:immich_mobile/providers/backup/manual_upload.provider.dart'; -import 'package:immich_mobile/widgets/backup/current_backup_asset_info_box.dart'; -import 'package:immich_mobile/models/backup/backup_state.model.dart'; -import 'package:immich_mobile/providers/backup/backup.provider.dart'; -import 'package:immich_mobile/routing/router.dart'; import 'package:immich_mobile/providers/websocket.provider.dart'; +import 'package:immich_mobile/routing/router.dart'; import 'package:immich_mobile/widgets/backup/backup_info_card.dart'; +import 'package:immich_mobile/widgets/backup/current_backup_asset_info_box.dart'; @RoutePage() class BackupControllerPage extends HookConsumerWidget { @@ -260,7 +260,7 @@ class BackupControllerPage extends HookConsumerWidget { leading: IconButton( onPressed: () { ref.watch(websocketProvider.notifier).listenUploadEvent(); - context.popRoute(true); + context.maybePop(true); }, splashRadius: 24, icon: const Icon( diff --git a/mobile/lib/pages/backup/backup_options.page.dart b/mobile/lib/pages/backup/backup_options.page.dart index 9a639c844e..29822cab15 100644 --- a/mobile/lib/pages/backup/backup_options.page.dart +++ b/mobile/lib/pages/backup/backup_options.page.dart @@ -13,7 +13,7 @@ class BackupOptionsPage extends StatelessWidget { elevation: 0, title: const Text("backup_options_page_title").tr(), leading: IconButton( - onPressed: () => context.popRoute(true), + onPressed: () => context.maybePop(true), splashRadius: 24, icon: const Icon( Icons.arrow_back_ios_rounded, diff --git a/mobile/lib/pages/backup/failed_backup_status.page.dart b/mobile/lib/pages/backup/failed_backup_status.page.dart index b4e75e7ae0..1c6d3a7aad 100644 --- a/mobile/lib/pages/backup/failed_backup_status.page.dart +++ b/mobile/lib/pages/backup/failed_backup_status.page.dart @@ -23,7 +23,7 @@ class FailedBackupStatusPage extends HookConsumerWidget { ), leading: IconButton( onPressed: () { - context.popRoute(true); + context.maybePop(true); }, splashRadius: 24, icon: const Icon( diff --git a/mobile/lib/pages/common/album_additional_shared_user_selection.page.dart b/mobile/lib/pages/common/album_additional_shared_user_selection.page.dart index 33c4708dd2..ff5198de08 100644 --- a/mobile/lib/pages/common/album_additional_shared_user_selection.page.dart +++ b/mobile/lib/pages/common/album_additional_shared_user_selection.page.dart @@ -26,7 +26,7 @@ class AlbumAdditionalSharedUserSelectionPage extends HookConsumerWidget { final sharedUsersList = useState<Set<User>>({}); addNewUsersHandler() { - context.popRoute(sharedUsersList.value.map((e) => e.id).toList()); + context.maybePop(sharedUsersList.value.map((e) => e.id).toList()); } buildTileIcon(User user) { @@ -127,7 +127,7 @@ class AlbumAdditionalSharedUserSelectionPage extends HookConsumerWidget { leading: IconButton( icon: const Icon(Icons.close_rounded), onPressed: () { - context.popRoute(null); + context.maybePop(null); }, ), actions: [ diff --git a/mobile/lib/pages/common/album_options.page.dart b/mobile/lib/pages/common/album_options.page.dart index fe1cd2f777..1cc24af09c 100644 --- a/mobile/lib/pages/common/album_options.page.dart +++ b/mobile/lib/pages/common/album_options.page.dart @@ -184,7 +184,7 @@ class AlbumOptionsPage extends HookConsumerWidget { appBar: AppBar( leading: IconButton( icon: const Icon(Icons.arrow_back_ios_new_rounded), - onPressed: () => context.popRoute(null), + onPressed: () => context.maybePop(null), ), centerTitle: true, title: Text("translated_text_options".tr()), diff --git a/mobile/lib/pages/common/album_shared_user_selection.page.dart b/mobile/lib/pages/common/album_shared_user_selection.page.dart index 387894c063..d8cf4ecd27 100644 --- a/mobile/lib/pages/common/album_shared_user_selection.page.dart +++ b/mobile/lib/pages/common/album_shared_user_selection.page.dart @@ -36,7 +36,7 @@ class AlbumSharedUserSelectionPage extends HookConsumerWidget { await ref.watch(sharedAlbumProvider.notifier).getAllSharedAlbums(); // ref.watch(assetSelectionProvider.notifier).removeAll(); ref.watch(albumTitleProvider.notifier).clearAlbumTitle(); - context.popRoute(true); + context.maybePop(true); context .navigateTo(const TabControllerRoute(children: [SharingRoute()])); } @@ -152,7 +152,7 @@ class AlbumSharedUserSelectionPage extends HookConsumerWidget { leading: IconButton( icon: const Icon(Icons.close_rounded), onPressed: () async { - context.popRoute(); + context.maybePop(); }, ), actions: [ diff --git a/mobile/lib/pages/common/app_log.page.dart b/mobile/lib/pages/common/app_log.page.dart index 808933918c..58086cd8b9 100644 --- a/mobile/lib/pages/common/app_log.page.dart +++ b/mobile/lib/pages/common/app_log.page.dart @@ -105,7 +105,7 @@ class AppLogPage extends HookConsumerWidget { ], leading: IconButton( onPressed: () { - context.popRoute(); + context.maybePop(); }, icon: const Icon( Icons.arrow_back_ios_new_rounded, diff --git a/mobile/lib/pages/common/create_album.page.dart b/mobile/lib/pages/common/create_album.page.dart index 885d65b9f0..053057425e 100644 --- a/mobile/lib/pages/common/create_album.page.dart +++ b/mobile/lib/pages/common/create_album.page.dart @@ -3,16 +3,16 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:immich_mobile/entities/asset.entity.dart'; import 'package:immich_mobile/extensions/build_context_extensions.dart'; import 'package:immich_mobile/models/albums/asset_selection_page_result.model.dart'; import 'package:immich_mobile/providers/album/album.provider.dart'; import 'package:immich_mobile/providers/album/album_title.provider.dart'; +import 'package:immich_mobile/providers/asset.provider.dart'; +import 'package:immich_mobile/routing/router.dart'; import 'package:immich_mobile/widgets/album/album_action_outlined_button.dart'; import 'package:immich_mobile/widgets/album/album_title_text_field.dart'; import 'package:immich_mobile/widgets/album/shared_album_thumbnail_image.dart'; -import 'package:immich_mobile/routing/router.dart'; -import 'package:immich_mobile/entities/asset.entity.dart'; -import 'package:immich_mobile/providers/asset.provider.dart'; @RoutePage() // ignore: must_be_immutable @@ -216,7 +216,7 @@ class CreateAlbumPage extends HookConsumerWidget { leading: IconButton( onPressed: () { selectedAssets.value = {}; - context.popRoute(); + context.maybePop(); }, icon: const Icon(Icons.close_rounded), ), diff --git a/mobile/lib/pages/common/gallery_viewer.page.dart b/mobile/lib/pages/common/gallery_viewer.page.dart index 52ae695997..14fe8b02a4 100644 --- a/mobile/lib/pages/common/gallery_viewer.page.dart +++ b/mobile/lib/pages/common/gallery_viewer.page.dart @@ -2,32 +2,33 @@ import 'dart:async'; import 'dart:io'; import 'dart:math'; import 'dart:ui' as ui; + import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_hooks/flutter_hooks.dart' hide Store; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:immich_mobile/entities/asset.entity.dart'; import 'package:immich_mobile/extensions/build_context_extensions.dart'; -import 'package:immich_mobile/providers/image/immich_remote_image_provider.dart'; +import 'package:immich_mobile/pages/common/video_viewer.page.dart'; +import 'package:immich_mobile/providers/app_settings.provider.dart'; import 'package:immich_mobile/providers/asset_viewer/asset_stack.provider.dart'; import 'package:immich_mobile/providers/asset_viewer/current_asset.provider.dart'; import 'package:immich_mobile/providers/asset_viewer/show_controls.provider.dart'; import 'package:immich_mobile/providers/asset_viewer/video_player_value_provider.dart'; +import 'package:immich_mobile/providers/haptic_feedback.provider.dart'; +import 'package:immich_mobile/providers/image/immich_remote_image_provider.dart'; +import 'package:immich_mobile/services/app_settings.service.dart'; import 'package:immich_mobile/widgets/asset_viewer/advanced_bottom_sheet.dart'; import 'package:immich_mobile/widgets/asset_viewer/bottom_gallery_bar.dart'; import 'package:immich_mobile/widgets/asset_viewer/exif_sheet/exif_bottom_sheet.dart'; import 'package:immich_mobile/widgets/asset_viewer/gallery_app_bar.dart'; -import 'package:immich_mobile/providers/app_settings.provider.dart'; -import 'package:immich_mobile/pages/common/video_viewer.page.dart'; -import 'package:immich_mobile/services/app_settings.service.dart'; -import 'package:immich_mobile/providers/haptic_feedback.provider.dart'; import 'package:immich_mobile/widgets/common/immich_image.dart'; import 'package:immich_mobile/widgets/common/immich_thumbnail.dart'; import 'package:immich_mobile/widgets/photo_view/photo_view_gallery.dart'; import 'package:immich_mobile/widgets/photo_view/src/photo_view_computed_scale.dart'; import 'package:immich_mobile/widgets/photo_view/src/photo_view_scale_state.dart'; import 'package:immich_mobile/widgets/photo_view/src/utils/photo_view_hero_attributes.dart'; -import 'package:immich_mobile/entities/asset.entity.dart'; import 'package:isar/isar.dart'; import 'package:openapi/api.dart' show ThumbnailFormat; @@ -174,7 +175,7 @@ class GalleryViewerPage extends HookConsumerWidget { final ratio = d.dy / max(d.dx.abs(), 1); if (d.dy > sensitivity && ratio > ratioThreshold) { - context.popRoute(); + context.maybePop(); } else if (d.dy < -sensitivity && ratio < -ratioThreshold) { showInfo(); } @@ -261,12 +262,9 @@ class GalleryViewerPage extends HookConsumerWidget { } return PopScope( - canPop: false, - onPopInvoked: (_) { - // Change immersive mode back to normal "edgeToEdge" mode - SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); - context.pop(); - }, + // Change immersive mode back to normal "edgeToEdge" mode + onPopInvoked: (_) => + SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge), child: Scaffold( backgroundColor: Colors.black, body: Stack( diff --git a/mobile/lib/pages/common/video_viewer.page.dart b/mobile/lib/pages/common/video_viewer.page.dart index d52836de41..853f013f5d 100644 --- a/mobile/lib/pages/common/video_viewer.page.dart +++ b/mobile/lib/pages/common/video_viewer.page.dart @@ -1,18 +1,15 @@ -import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:immich_mobile/entities/asset.entity.dart'; import 'package:immich_mobile/providers/asset_viewer/show_controls.provider.dart'; import 'package:immich_mobile/providers/asset_viewer/video_player_controller_provider.dart'; import 'package:immich_mobile/providers/asset_viewer/video_player_controls_provider.dart'; import 'package:immich_mobile/providers/asset_viewer/video_player_value_provider.dart'; import 'package:immich_mobile/widgets/asset_viewer/video_player.dart'; -import 'package:immich_mobile/entities/asset.entity.dart'; import 'package:immich_mobile/widgets/common/delayed_loading_indicator.dart'; import 'package:wakelock_plus/wakelock_plus.dart'; -@RoutePage() -// ignore: must_be_immutable class VideoViewerPage extends HookConsumerWidget { final Asset asset; final bool isMotionVideo; diff --git a/mobile/lib/pages/library/archive.page.dart b/mobile/lib/pages/library/archive.page.dart index 9051a99d48..0082142113 100644 --- a/mobile/lib/pages/library/archive.page.dart +++ b/mobile/lib/pages/library/archive.page.dart @@ -17,7 +17,7 @@ class ArchivePage extends HookConsumerWidget { final count = archivedAssets.value?.totalAssets.toString() ?? "?"; return AppBar( leading: IconButton( - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded), ), centerTitle: true, diff --git a/mobile/lib/pages/library/favorite.page.dart b/mobile/lib/pages/library/favorite.page.dart index cc867525ac..7462dc8f21 100644 --- a/mobile/lib/pages/library/favorite.page.dart +++ b/mobile/lib/pages/library/favorite.page.dart @@ -15,7 +15,7 @@ class FavoritesPage extends HookConsumerWidget { AppBar buildAppBar() { return AppBar( leading: IconButton( - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded), ), centerTitle: true, diff --git a/mobile/lib/pages/library/trash.page.dart b/mobile/lib/pages/library/trash.page.dart index 931c1eef6b..3bba2f2dfe 100644 --- a/mobile/lib/pages/library/trash.page.dart +++ b/mobile/lib/pages/library/trash.page.dart @@ -143,7 +143,7 @@ class TrashPage extends HookConsumerWidget { return AppBar( leading: IconButton( onPressed: !selectionEnabledHook.value - ? () => context.popRoute() + ? () => context.maybePop() : () { selectionEnabledHook.value = false; selection.value = {}; diff --git a/mobile/lib/pages/onboarding/permission_onboarding.page.dart b/mobile/lib/pages/onboarding/permission_onboarding.page.dart index 8d2c049c50..e5408f2297 100644 --- a/mobile/lib/pages/onboarding/permission_onboarding.page.dart +++ b/mobile/lib/pages/onboarding/permission_onboarding.page.dart @@ -176,7 +176,7 @@ class PermissionOnboardingPage extends HookConsumerWidget { ), TextButton( child: const Text('permission_onboarding_back').tr(), - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), ), ], ), diff --git a/mobile/lib/pages/photos/memory.page.dart b/mobile/lib/pages/photos/memory.page.dart index daa291503c..3f86f5be08 100644 --- a/mobile/lib/pages/photos/memory.page.dart +++ b/mobile/lib/pages/photos/memory.page.dart @@ -3,14 +3,14 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:immich_mobile/entities/asset.entity.dart'; import 'package:immich_mobile/models/memories/memory.model.dart'; +import 'package:immich_mobile/providers/haptic_feedback.provider.dart'; +import 'package:immich_mobile/widgets/common/immich_image.dart'; import 'package:immich_mobile/widgets/memories/memory_bottom_info.dart'; import 'package:immich_mobile/widgets/memories/memory_card.dart'; import 'package:immich_mobile/widgets/memories/memory_epilogue.dart'; import 'package:immich_mobile/widgets/memories/memory_progress_indicator.dart'; -import 'package:immich_mobile/entities/asset.entity.dart'; -import 'package:immich_mobile/providers/haptic_feedback.provider.dart'; -import 'package:immich_mobile/widgets/common/immich_image.dart'; @RoutePage() class MemoryPage extends HookConsumerWidget { @@ -153,7 +153,7 @@ class MemoryPage extends HookConsumerWidget { final offset = notification.metrics.pixels; if (isEpiloguePage && (offset > notification.metrics.maxScrollExtent + 150)) { - context.popRoute(); + context.maybePop(); return true; } } @@ -256,7 +256,7 @@ class MemoryPage extends HookConsumerWidget { // auto_route doesn't invoke pop scope, so // turn off full screen mode here // https://github.com/Milad-Akarie/auto_route_library/issues/1799 - context.popRoute(); + context.maybePop(); SystemChrome.setEnabledSystemUIMode( SystemUiMode.edgeToEdge, ); diff --git a/mobile/lib/pages/search/all_motion_videos.page.dart b/mobile/lib/pages/search/all_motion_videos.page.dart index adccdc4e01..1c070a51c8 100644 --- a/mobile/lib/pages/search/all_motion_videos.page.dart +++ b/mobile/lib/pages/search/all_motion_videos.page.dart @@ -18,7 +18,7 @@ class AllMotionPhotosPage extends HookConsumerWidget { appBar: AppBar( title: const Text('motion_photos_page_title').tr(), leading: IconButton( - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded), ), ), diff --git a/mobile/lib/pages/search/all_people.page.dart b/mobile/lib/pages/search/all_people.page.dart index 8699eff1c1..e9e491ae1b 100644 --- a/mobile/lib/pages/search/all_people.page.dart +++ b/mobile/lib/pages/search/all_people.page.dart @@ -21,7 +21,7 @@ class AllPeoplePage extends HookConsumerWidget { 'all_people_page_title', ).tr(), leading: IconButton( - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded), ), ), diff --git a/mobile/lib/pages/search/all_places.page.dart b/mobile/lib/pages/search/all_places.page.dart index 4f848f3fa8..9d9f5e9e90 100644 --- a/mobile/lib/pages/search/all_places.page.dart +++ b/mobile/lib/pages/search/all_places.page.dart @@ -22,7 +22,7 @@ class AllPlacesPage extends HookConsumerWidget { 'curated_location_page_title', ).tr(), leading: IconButton( - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded), ), ), diff --git a/mobile/lib/pages/search/all_videos.page.dart b/mobile/lib/pages/search/all_videos.page.dart index add70261a2..e96e060255 100644 --- a/mobile/lib/pages/search/all_videos.page.dart +++ b/mobile/lib/pages/search/all_videos.page.dart @@ -15,7 +15,7 @@ class AllVideosPage extends HookConsumerWidget { appBar: AppBar( title: const Text('all_videos_page_title').tr(), leading: IconButton( - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded), ), ), diff --git a/mobile/lib/pages/search/map/map_location_picker.page.dart b/mobile/lib/pages/search/map/map_location_picker.page.dart index 47f4d3d0eb..db0c980c89 100644 --- a/mobile/lib/pages/search/map/map_location_picker.page.dart +++ b/mobile/lib/pages/search/map/map_location_picker.page.dart @@ -41,7 +41,7 @@ class MapLocationPickerPage extends HookConsumerWidget { } void onClose([LatLng? selected]) { - context.popRoute(selected); + context.maybePop(selected); } Future<void> getCurrentLocation() async { diff --git a/mobile/lib/pages/search/person_result.page.dart b/mobile/lib/pages/search/person_result.page.dart index ec3f0f31ef..1fec9a4a33 100644 --- a/mobile/lib/pages/search/person_result.page.dart +++ b/mobile/lib/pages/search/person_result.page.dart @@ -102,7 +102,7 @@ class PersonResultPage extends HookConsumerWidget { appBar: AppBar( title: Text(name.value), leading: IconButton( - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded), ), actions: [ diff --git a/mobile/lib/pages/search/recently_added.page.dart b/mobile/lib/pages/search/recently_added.page.dart index d52841c4f4..b79527e222 100644 --- a/mobile/lib/pages/search/recently_added.page.dart +++ b/mobile/lib/pages/search/recently_added.page.dart @@ -18,7 +18,7 @@ class RecentlyAddedPage extends HookConsumerWidget { appBar: AppBar( title: const Text('recently_added_page_title').tr(), leading: IconButton( - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded), ), ), diff --git a/mobile/lib/pages/search/search_input.page.dart b/mobile/lib/pages/search/search_input.page.dart index 3bf6c39189..e166777439 100644 --- a/mobile/lib/pages/search/search_input.page.dart +++ b/mobile/lib/pages/search/search_input.page.dart @@ -4,9 +4,11 @@ import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:immich_mobile/entities/asset.entity.dart'; import 'package:immich_mobile/extensions/build_context_extensions.dart'; import 'package:immich_mobile/models/search/search_filter.model.dart'; import 'package:immich_mobile/providers/search/paginated_search.provider.dart'; +import 'package:immich_mobile/widgets/asset_grid/multiselect_grid.dart'; import 'package:immich_mobile/widgets/search/search_filter/camera_picker.dart'; import 'package:immich_mobile/widgets/search/search_filter/display_option_picker.dart'; import 'package:immich_mobile/widgets/search/search_filter/filter_bottom_sheet_scaffold.dart'; @@ -15,8 +17,6 @@ import 'package:immich_mobile/widgets/search/search_filter/media_type_picker.dar import 'package:immich_mobile/widgets/search/search_filter/people_picker.dart'; import 'package:immich_mobile/widgets/search/search_filter/search_filter_chip.dart'; import 'package:immich_mobile/widgets/search/search_filter/search_filter_utils.dart'; -import 'package:immich_mobile/entities/asset.entity.dart'; -import 'package:immich_mobile/widgets/asset_grid/multiselect_grid.dart'; import 'package:openapi/api.dart'; @RoutePage() @@ -480,9 +480,7 @@ class SearchInputPage extends HookConsumerWidget { ], leading: IconButton( icon: const Icon(Icons.arrow_back_ios_new_rounded), - onPressed: () { - context.router.pop(); - }, + onPressed: () => context.router.maybePop(), ), title: TextField( controller: textSearchController, diff --git a/mobile/lib/pages/sharing/shared_link/shared_link_edit.page.dart b/mobile/lib/pages/sharing/shared_link/shared_link_edit.page.dart index 356bd5e945..6223e110e1 100644 --- a/mobile/lib/pages/sharing/shared_link/shared_link_edit.page.dart +++ b/mobile/lib/pages/sharing/shared_link/shared_link_edit.page.dart @@ -328,7 +328,7 @@ class SharedLinkEditPage extends HookConsumerWidget { alignment: Alignment.bottomRight, child: ElevatedButton( onPressed: () { - context.popRoute(); + context.maybePop(); }, child: const Text( "share_done", @@ -431,7 +431,7 @@ class SharedLinkEditPage extends HookConsumerWidget { changeExpiry: changeExpiry, ); ref.invalidate(sharedLinksStateProvider); - context.popRoute(); + context.maybePop(); } return Scaffold( diff --git a/mobile/lib/routing/router.dart b/mobile/lib/routing/router.dart index 98c0142452..f51f11230b 100644 --- a/mobile/lib/routing/router.dart +++ b/mobile/lib/routing/router.dart @@ -1,35 +1,32 @@ import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:immich_mobile/models/memories/memory.model.dart'; -import 'package:immich_mobile/models/search/search_filter.model.dart'; -import 'package:immich_mobile/pages/common/activities.page.dart'; -import 'package:immich_mobile/models/albums/asset_selection_page_result.model.dart'; -import 'package:immich_mobile/pages/common/album_options.page.dart'; -import 'package:immich_mobile/pages/common/album_viewer.page.dart'; -import 'package:immich_mobile/pages/common/album_asset_selection.page.dart'; -import 'package:immich_mobile/pages/common/create_album.page.dart'; -import 'package:immich_mobile/models/shared_link/shared_link.model.dart'; -import 'package:immich_mobile/pages/common/album_additional_shared_user_selection.page.dart'; -import 'package:immich_mobile/pages/common/album_shared_user_selection.page.dart'; -import 'package:immich_mobile/providers/gallery_permission.provider.dart'; -import 'package:immich_mobile/routing/auth_guard.dart'; -import 'package:immich_mobile/routing/custom_transition_builders.dart'; -import 'package:immich_mobile/routing/duplicate_guard.dart'; -import 'package:immich_mobile/routing/backup_permission_guard.dart'; -import 'package:immich_mobile/entities/asset.entity.dart'; import 'package:immich_mobile/entities/album.entity.dart'; +import 'package:immich_mobile/entities/asset.entity.dart'; import 'package:immich_mobile/entities/logger_message.entity.dart'; import 'package:immich_mobile/entities/user.entity.dart'; -import 'package:immich_mobile/providers/api.provider.dart'; -import 'package:immich_mobile/pages/common/app_log_detail.page.dart'; -import 'package:immich_mobile/pages/common/app_log.page.dart'; +import 'package:immich_mobile/models/albums/asset_selection_page_result.model.dart'; +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'; 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'; +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'; import 'package:immich_mobile/pages/common/gallery_viewer.page.dart'; +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'; import 'package:immich_mobile/pages/library/archive.page.dart'; import 'package:immich_mobile/pages/library/favorite.page.dart'; import 'package:immich_mobile/pages/library/library.page.dart'; @@ -43,21 +40,23 @@ 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_location_picker.page.dart'; import 'package:immich_mobile/pages/search/map/map.page.dart'; +import 'package:immich_mobile/pages/search/map/map_location_picker.page.dart'; 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_input.page.dart'; import 'package:immich_mobile/pages/search/search.page.dart'; -import 'package:immich_mobile/pages/common/settings.page.dart'; -import 'package:immich_mobile/pages/sharing/partner/partner_detail.page.dart'; +import 'package:immich_mobile/pages/search/search_input.page.dart'; import 'package:immich_mobile/pages/sharing/partner/partner.page.dart'; -import 'package:immich_mobile/pages/sharing/shared_link/shared_link_edit.page.dart'; +import 'package:immich_mobile/pages/sharing/partner/partner_detail.page.dart'; import 'package:immich_mobile/pages/sharing/shared_link/shared_link.page.dart'; +import 'package:immich_mobile/pages/sharing/shared_link/shared_link_edit.page.dart'; import 'package:immich_mobile/pages/sharing/sharing.page.dart'; -import 'package:immich_mobile/pages/common/splash_screen.page.dart'; -import 'package:immich_mobile/pages/common/tab_controller.page.dart'; -import 'package:immich_mobile/pages/common/video_viewer.page.dart'; +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'; import 'package:immich_mobile/services/api.service.dart'; import 'package:isar/isar.dart'; import 'package:maplibre_gl/maplibre_gl.dart'; @@ -120,10 +119,6 @@ class AppRouter extends _$AppRouter { guards: [_authGuard, _duplicateGuard], transitionsBuilder: CustomTransitionsBuilders.zoomedPage, ), - AutoRoute( - page: VideoViewerRoute.page, - guards: [_authGuard, _duplicateGuard], - ), AutoRoute( page: BackupControllerRoute.page, guards: [_authGuard, _duplicateGuard, _backupPermissionGuard], diff --git a/mobile/lib/routing/router.gr.dart b/mobile/lib/routing/router.gr.dart index 0c519eb2bc..806dd7f6ff 100644 --- a/mobile/lib/routing/router.gr.dart +++ b/mobile/lib/routing/router.gr.dart @@ -21,6 +21,29 @@ abstract class _$AppRouter extends RootStackRouter { child: const ActivitiesPage(), ); }, + AlbumAdditionalSharedUserSelectionRoute.name: (routeData) { + final args = + routeData.argsAs<AlbumAdditionalSharedUserSelectionRouteArgs>(); + return AutoRoutePage<List<String>?>( + routeData: routeData, + child: AlbumAdditionalSharedUserSelectionPage( + key: args.key, + album: args.album, + ), + ); + }, + AlbumAssetSelectionRoute.name: (routeData) { + final args = routeData.argsAs<AlbumAssetSelectionRouteArgs>(); + return AutoRoutePage<AssetSelectionPageResult?>( + routeData: routeData, + child: AlbumAssetSelectionPage( + key: args.key, + existingAssets: args.existingAssets, + canDeselect: args.canDeselect, + query: args.query, + ), + ); + }, AlbumOptionsRoute.name: (routeData) { final args = routeData.argsAs<AlbumOptionsRouteArgs>(); return AutoRoutePage<dynamic>( @@ -41,6 +64,16 @@ abstract class _$AppRouter extends RootStackRouter { ), ); }, + AlbumSharedUserSelectionRoute.name: (routeData) { + final args = routeData.argsAs<AlbumSharedUserSelectionRouteArgs>(); + return AutoRoutePage<List<String>>( + routeData: routeData, + child: AlbumSharedUserSelectionPage( + key: args.key, + assets: args.assets, + ), + ); + }, AlbumViewerRoute.name: (routeData) { final args = routeData.argsAs<AlbumViewerRouteArgs>(); return AutoRoutePage<dynamic>( @@ -97,18 +130,6 @@ abstract class _$AppRouter extends RootStackRouter { child: const ArchivePage(), ); }, - AlbumAssetSelectionRoute.name: (routeData) { - final args = routeData.argsAs<AssetSelectionRouteArgs>(); - return AutoRoutePage<AssetSelectionPageResult?>( - routeData: routeData, - child: AlbumAssetSelectionPage( - key: args.key, - existingAssets: args.existingAssets, - canDeselect: args.canDeselect, - query: args.query, - ), - ); - }, BackupAlbumSelectionRoute.name: (routeData) { return AutoRoutePage<dynamic>( routeData: routeData, @@ -170,12 +191,6 @@ abstract class _$AppRouter extends RootStackRouter { ), ); }, - PhotosRoute.name: (routeData) { - return AutoRoutePage<dynamic>( - routeData: routeData, - child: const PhotosPage(), - ); - }, LibraryRoute.name: (routeData) { return AutoRoutePage<dynamic>( routeData: routeData, @@ -249,6 +264,12 @@ abstract class _$AppRouter extends RootStackRouter { ), ); }, + PhotosRoute.name: (routeData) { + return AutoRoutePage<dynamic>( + routeData: routeData, + child: const PhotosPage(), + ); + }, RecentlyAddedRoute.name: (routeData) { return AutoRoutePage<dynamic>( routeData: routeData, @@ -272,26 +293,6 @@ abstract class _$AppRouter extends RootStackRouter { child: const SearchPage(), ); }, - AlbumAdditionalSharedUserSelectionRoute.name: (routeData) { - final args = routeData.argsAs<SelectAdditionalUserForSharingRouteArgs>(); - return AutoRoutePage<List<String>?>( - routeData: routeData, - child: AlbumAdditionalSharedUserSelectionPage( - key: args.key, - album: args.album, - ), - ); - }, - AlbumSharedUserSelectionRoute.name: (routeData) { - final args = routeData.argsAs<SelectUserForSharingRouteArgs>(); - return AutoRoutePage<List<String>>( - routeData: routeData, - child: AlbumSharedUserSelectionPage( - key: args.key, - assets: args.assets, - ), - ); - }, SettingsRoute.name: (routeData) { return AutoRoutePage<dynamic>( routeData: routeData, @@ -351,21 +352,6 @@ abstract class _$AppRouter extends RootStackRouter { child: const TrashPage(), ); }, - VideoViewerRoute.name: (routeData) { - final args = routeData.argsAs<VideoViewerRouteArgs>(); - return AutoRoutePage<dynamic>( - routeData: routeData, - child: VideoViewerPage( - key: args.key, - asset: args.asset, - isMotionVideo: args.isMotionVideo, - placeholder: args.placeholder, - showControls: args.showControls, - hideControlsTimer: args.hideControlsTimer, - showDownloadingIndicator: args.showDownloadingIndicator, - ), - ); - }, }; } @@ -383,6 +369,94 @@ class ActivitiesRoute extends PageRouteInfo<void> { static const PageInfo<void> page = PageInfo<void>(name); } +/// generated route for +/// [AlbumAdditionalSharedUserSelectionPage] +class AlbumAdditionalSharedUserSelectionRoute + extends PageRouteInfo<AlbumAdditionalSharedUserSelectionRouteArgs> { + AlbumAdditionalSharedUserSelectionRoute({ + Key? key, + required Album album, + List<PageRouteInfo>? children, + }) : super( + AlbumAdditionalSharedUserSelectionRoute.name, + args: AlbumAdditionalSharedUserSelectionRouteArgs( + key: key, + album: album, + ), + initialChildren: children, + ); + + static const String name = 'AlbumAdditionalSharedUserSelectionRoute'; + + static const PageInfo<AlbumAdditionalSharedUserSelectionRouteArgs> page = + PageInfo<AlbumAdditionalSharedUserSelectionRouteArgs>(name); +} + +class AlbumAdditionalSharedUserSelectionRouteArgs { + const AlbumAdditionalSharedUserSelectionRouteArgs({ + this.key, + required this.album, + }); + + final Key? key; + + final Album album; + + @override + String toString() { + return 'AlbumAdditionalSharedUserSelectionRouteArgs{key: $key, album: $album}'; + } +} + +/// generated route for +/// [AlbumAssetSelectionPage] +class AlbumAssetSelectionRoute + extends PageRouteInfo<AlbumAssetSelectionRouteArgs> { + AlbumAssetSelectionRoute({ + Key? key, + required Set<Asset> existingAssets, + bool canDeselect = false, + required QueryBuilder<Asset, Asset, QAfterSortBy>? query, + List<PageRouteInfo>? children, + }) : super( + AlbumAssetSelectionRoute.name, + args: AlbumAssetSelectionRouteArgs( + key: key, + existingAssets: existingAssets, + canDeselect: canDeselect, + query: query, + ), + initialChildren: children, + ); + + static const String name = 'AlbumAssetSelectionRoute'; + + static const PageInfo<AlbumAssetSelectionRouteArgs> page = + PageInfo<AlbumAssetSelectionRouteArgs>(name); +} + +class AlbumAssetSelectionRouteArgs { + const AlbumAssetSelectionRouteArgs({ + this.key, + required this.existingAssets, + this.canDeselect = false, + required this.query, + }); + + final Key? key; + + final Set<Asset> existingAssets; + + final bool canDeselect; + + final QueryBuilder<Asset, Asset, QAfterSortBy>? query; + + @override + String toString() { + return 'AlbumAssetSelectionRouteArgs{key: $key, existingAssets: $existingAssets, canDeselect: $canDeselect, query: $query}'; + } +} + /// generated route for /// [AlbumOptionsPage] class AlbumOptionsRoute extends PageRouteInfo<AlbumOptionsRouteArgs> { @@ -459,6 +533,45 @@ class AlbumPreviewRouteArgs { } } +/// generated route for +/// [AlbumSharedUserSelectionPage] +class AlbumSharedUserSelectionRoute + extends PageRouteInfo<AlbumSharedUserSelectionRouteArgs> { + AlbumSharedUserSelectionRoute({ + Key? key, + required Set<Asset> assets, + List<PageRouteInfo>? children, + }) : super( + AlbumSharedUserSelectionRoute.name, + args: AlbumSharedUserSelectionRouteArgs( + key: key, + assets: assets, + ), + initialChildren: children, + ); + + static const String name = 'AlbumSharedUserSelectionRoute'; + + static const PageInfo<AlbumSharedUserSelectionRouteArgs> page = + PageInfo<AlbumSharedUserSelectionRouteArgs>(name); +} + +class AlbumSharedUserSelectionRouteArgs { + const AlbumSharedUserSelectionRouteArgs({ + this.key, + required this.assets, + }); + + final Key? key; + + final Set<Asset> assets; + + @override + String toString() { + return 'AlbumSharedUserSelectionRouteArgs{key: $key, assets: $assets}'; + } +} + /// generated route for /// [AlbumViewerPage] class AlbumViewerRoute extends PageRouteInfo<AlbumViewerRouteArgs> { @@ -619,54 +732,6 @@ class ArchiveRoute extends PageRouteInfo<void> { static const PageInfo<void> page = PageInfo<void>(name); } -/// generated route for -/// [AlbumAssetSelectionPage] -class AlbumAssetSelectionRoute extends PageRouteInfo<AssetSelectionRouteArgs> { - AlbumAssetSelectionRoute({ - Key? key, - required Set<Asset> existingAssets, - bool canDeselect = false, - required QueryBuilder<Asset, Asset, QAfterSortBy>? query, - List<PageRouteInfo>? children, - }) : super( - AlbumAssetSelectionRoute.name, - args: AssetSelectionRouteArgs( - key: key, - existingAssets: existingAssets, - canDeselect: canDeselect, - query: query, - ), - initialChildren: children, - ); - - static const String name = 'AlbumAssetSelectionRoute'; - - static const PageInfo<AssetSelectionRouteArgs> page = - PageInfo<AssetSelectionRouteArgs>(name); -} - -class AssetSelectionRouteArgs { - const AssetSelectionRouteArgs({ - this.key, - required this.existingAssets, - this.canDeselect = false, - required this.query, - }); - - final Key? key; - - final Set<Asset> existingAssets; - - final bool canDeselect; - - final QueryBuilder<Asset, Asset, QAfterSortBy>? query; - - @override - String toString() { - return 'AssetSelectionRouteArgs{key: $key, existingAssets: $existingAssets, canDeselect: $canDeselect, query: $query}'; - } -} - /// generated route for /// [BackupAlbumSelectionPage] class BackupAlbumSelectionRoute extends PageRouteInfo<void> { @@ -852,20 +917,6 @@ class GalleryViewerRouteArgs { } } -/// generated route for -/// [PhotosPage] -class PhotosRoute extends PageRouteInfo<void> { - const PhotosRoute({List<PageRouteInfo>? children}) - : super( - PhotosRoute.name, - initialChildren: children, - ); - - static const String name = 'PhotosRoute'; - - static const PageInfo<void> page = PageInfo<void>(name); -} - /// generated route for /// [LibraryPage] class LibraryRoute extends PageRouteInfo<void> { @@ -1097,6 +1148,20 @@ class PersonResultRouteArgs { } } +/// generated route for +/// [PhotosPage] +class PhotosRoute extends PageRouteInfo<void> { + const PhotosRoute({List<PageRouteInfo>? children}) + : super( + PhotosRoute.name, + initialChildren: children, + ); + + static const String name = 'PhotosRoute'; + + static const PageInfo<void> page = PageInfo<void>(name); +} + /// generated route for /// [RecentlyAddedPage] class RecentlyAddedRoute extends PageRouteInfo<void> { @@ -1163,84 +1228,6 @@ class SearchRoute extends PageRouteInfo<void> { static const PageInfo<void> page = PageInfo<void>(name); } -/// generated route for -/// [AlbumAdditionalSharedUserSelectionPage] -class AlbumAdditionalSharedUserSelectionRoute - extends PageRouteInfo<SelectAdditionalUserForSharingRouteArgs> { - AlbumAdditionalSharedUserSelectionRoute({ - Key? key, - required Album album, - List<PageRouteInfo>? children, - }) : super( - AlbumAdditionalSharedUserSelectionRoute.name, - args: SelectAdditionalUserForSharingRouteArgs( - key: key, - album: album, - ), - initialChildren: children, - ); - - static const String name = 'AlbumAdditionalSharedUserSelectionRoute'; - - static const PageInfo<SelectAdditionalUserForSharingRouteArgs> page = - PageInfo<SelectAdditionalUserForSharingRouteArgs>(name); -} - -class SelectAdditionalUserForSharingRouteArgs { - const SelectAdditionalUserForSharingRouteArgs({ - this.key, - required this.album, - }); - - final Key? key; - - final Album album; - - @override - String toString() { - return 'SelectAdditionalUserForSharingRouteArgs{key: $key, album: $album}'; - } -} - -/// generated route for -/// [AlbumSharedUserSelectionPage] -class AlbumSharedUserSelectionRoute - extends PageRouteInfo<SelectUserForSharingRouteArgs> { - AlbumSharedUserSelectionRoute({ - Key? key, - required Set<Asset> assets, - List<PageRouteInfo>? children, - }) : super( - AlbumSharedUserSelectionRoute.name, - args: SelectUserForSharingRouteArgs( - key: key, - assets: assets, - ), - initialChildren: children, - ); - - static const String name = 'AlbumSharedUserSelectionRoute'; - - static const PageInfo<SelectUserForSharingRouteArgs> page = - PageInfo<SelectUserForSharingRouteArgs>(name); -} - -class SelectUserForSharingRouteArgs { - const SelectUserForSharingRouteArgs({ - this.key, - required this.assets, - }); - - final Key? key; - - final Set<Asset> assets; - - @override - String toString() { - return 'SelectUserForSharingRouteArgs{key: $key, assets: $assets}'; - } -} - /// generated route for /// [SettingsPage] class SettingsRoute extends PageRouteInfo<void> { @@ -1410,66 +1397,3 @@ class TrashRoute extends PageRouteInfo<void> { static const PageInfo<void> page = PageInfo<void>(name); } - -/// generated route for -/// [VideoViewerPage] -class VideoViewerRoute extends PageRouteInfo<VideoViewerRouteArgs> { - VideoViewerRoute({ - Key? key, - required Asset asset, - bool isMotionVideo = false, - Widget? placeholder, - bool showControls = true, - Duration hideControlsTimer = const Duration(seconds: 5), - bool showDownloadingIndicator = true, - List<PageRouteInfo>? children, - }) : super( - VideoViewerRoute.name, - args: VideoViewerRouteArgs( - key: key, - asset: asset, - isMotionVideo: isMotionVideo, - placeholder: placeholder, - showControls: showControls, - hideControlsTimer: hideControlsTimer, - showDownloadingIndicator: showDownloadingIndicator, - ), - initialChildren: children, - ); - - static const String name = 'VideoViewerRoute'; - - static const PageInfo<VideoViewerRouteArgs> page = - PageInfo<VideoViewerRouteArgs>(name); -} - -class VideoViewerRouteArgs { - const VideoViewerRouteArgs({ - this.key, - required this.asset, - this.isMotionVideo = false, - this.placeholder, - this.showControls = true, - this.hideControlsTimer = const Duration(seconds: 5), - this.showDownloadingIndicator = true, - }); - - final Key? key; - - final Asset asset; - - final bool isMotionVideo; - - final Widget? placeholder; - - final bool showControls; - - final Duration hideControlsTimer; - - final bool showDownloadingIndicator; - - @override - String toString() { - return 'VideoViewerRouteArgs{key: $key, asset: $asset, isMotionVideo: $isMotionVideo, placeholder: $placeholder, showControls: $showControls, hideControlsTimer: $hideControlsTimer, showDownloadingIndicator: $showDownloadingIndicator}'; - } -} diff --git a/mobile/lib/widgets/album/album_viewer_appbar.dart b/mobile/lib/widgets/album/album_viewer_appbar.dart index 5521f50e35..6fb58f8082 100644 --- a/mobile/lib/widgets/album/album_viewer_appbar.dart +++ b/mobile/lib/widgets/album/album_viewer_appbar.dart @@ -275,7 +275,7 @@ class AlbumViewerAppbar extends HookConsumerWidget ); } else { return IconButton( - onPressed: () async => await context.popRoute(), + onPressed: () async => await context.maybePop(), icon: const Icon(Icons.arrow_back_ios_rounded), splashRadius: 25, ); diff --git a/mobile/lib/widgets/asset_viewer/bottom_gallery_bar.dart b/mobile/lib/widgets/asset_viewer/bottom_gallery_bar.dart index 30b880bc8b..f9c63059b7 100644 --- a/mobile/lib/widgets/asset_viewer/bottom_gallery_bar.dart +++ b/mobile/lib/widgets/asset_viewer/bottom_gallery_bar.dart @@ -110,7 +110,7 @@ class BottomGalleryBar extends ConsumerWidget { if (isDeleted && isParent) { if (totalAssets == 1) { // Handle only one asset - context.popRoute(); + context.maybePop(); } else { // Go to next page otherwise controller.nextPage( @@ -181,7 +181,7 @@ class BottomGalleryBar extends ConsumerWidget { stackElements.elementAt(stackIndex), ); ctx.pop(); - context.popRoute(); + context.maybePop(); }, title: const Text( "viewer_stack_use_as_main_asset", @@ -208,7 +208,7 @@ class BottomGalleryBar extends ConsumerWidget { childrenToRemove: [asset], ); ctx.pop(); - context.popRoute(); + context.maybePop(); } else { await ref.read(assetStackServiceProvider).updateStack( asset, @@ -236,7 +236,7 @@ class BottomGalleryBar extends ConsumerWidget { childrenToRemove: stack, ); ctx.pop(); - context.popRoute(); + context.maybePop(); }, title: const Text( "viewer_unstack", @@ -267,7 +267,7 @@ class BottomGalleryBar extends ConsumerWidget { handleArchive() { ref.read(assetProvider.notifier).toggleArchive([asset]); if (isParent) { - context.popRoute(); + context.maybePop(); return; } removeAssetFromStack(); diff --git a/mobile/lib/widgets/asset_viewer/top_control_app_bar.dart b/mobile/lib/widgets/asset_viewer/top_control_app_bar.dart index 6406725b21..70fd5e3b89 100644 --- a/mobile/lib/widgets/asset_viewer/top_control_app_bar.dart +++ b/mobile/lib/widgets/asset_viewer/top_control_app_bar.dart @@ -161,7 +161,7 @@ class TopControlAppBar extends HookConsumerWidget { Widget buildBackButton() { return IconButton( onPressed: () { - context.popRoute(); + context.maybePop(); }, icon: Icon( Icons.arrow_back_ios_new_rounded, diff --git a/mobile/lib/widgets/common/location_picker.dart b/mobile/lib/widgets/common/location_picker.dart index 425bdb15bf..1fca268d63 100644 --- a/mobile/lib/widgets/common/location_picker.dart +++ b/mobile/lib/widgets/common/location_picker.dart @@ -79,7 +79,7 @@ class _LocationPicker extends HookWidget { ).tr(), ), TextButton( - onPressed: () => context.popRoute(latlng), + onPressed: () => context.maybePop(latlng), child: Text( "action_common_update", style: context.textTheme.bodyMedium?.copyWith( diff --git a/mobile/lib/widgets/map/map_app_bar.dart b/mobile/lib/widgets/map/map_app_bar.dart index b9d11b0996..42bc598915 100644 --- a/mobile/lib/widgets/map/map_app_bar.dart +++ b/mobile/lib/widgets/map/map_app_bar.dart @@ -50,7 +50,7 @@ class _NonSelectionRow extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ ElevatedButton( - onPressed: () => context.popRoute(), + onPressed: () => context.maybePop(), style: ElevatedButton.styleFrom( shape: const CircleBorder(), ), diff --git a/mobile/lib/widgets/memories/memory_bottom_info.dart b/mobile/lib/widgets/memories/memory_bottom_info.dart index 408bdc909a..84f4cb6c72 100644 --- a/mobile/lib/widgets/memories/memory_bottom_info.dart +++ b/mobile/lib/widgets/memories/memory_bottom_info.dart @@ -43,7 +43,7 @@ class MemoryBottomInfo extends StatelessWidget { MaterialButton( minWidth: 0, onPressed: () { - context.popRoute(); + context.maybePop(); scrollToDateNotifierProvider .scrollToDate(memory.assets[0].fileCreatedAt); }, diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock index 832347ee47..280d1d8e11 100644 --- a/mobile/pubspec.lock +++ b/mobile/pubspec.lock @@ -61,18 +61,18 @@ packages: dependency: "direct main" description: name: auto_route - sha256: "82f8df1d177416bc6b7a449127d0270ff1f0f633a91f2ceb7a85d4f07c3affa1" + sha256: "6cad3f408863ffff2b5757967c802b18415dac4acb1b40c5cdd45d0a26e5080f" url: "https://pub.dev" source: hosted - version: "7.8.4" + version: "8.1.3" auto_route_generator: dependency: "direct dev" description: name: auto_route_generator - sha256: "11067a3bcd643812518fe26c0c9ec073990286cabfd9d74b6da9ef9b913c4d22" + sha256: ba28133d3a3bf0a66772bcc98dade5843753cd9f1a8fb4802b842895515b67d3 url: "https://pub.dev" source: hosted - version: "7.3.2" + version: "8.0.0" boolean_selector: dependency: transitive description: diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml index faa78ef32a..a50feffedd 100644 --- a/mobile/pubspec.yaml +++ b/mobile/pubspec.yaml @@ -22,7 +22,7 @@ dependencies: cached_network_image: ^3.3.1 flutter_cache_manager: ^3.3.1 intl: ^0.18.0 - auto_route: ^7.8.4 + auto_route: ^8.0.2 fluttertoast: ^8.2.4 video_player: ^2.8.2 chewie: ^1.7.4 @@ -88,7 +88,7 @@ dev_dependencies: sdk: flutter flutter_lints: ^4.0.0 build_runner: ^2.4.8 - auto_route_generator: ^7.3.2 + auto_route_generator: ^8.0.0 flutter_launcher_icons: ^0.13.1 flutter_native_splash: ^2.3.9 isar_generator: ^3.1.0+1