diff --git a/lib/config/go_routes/go_router.dart b/lib/config/go_routes/go_router.dart index 808467d4c1..b38bdec6e1 100644 --- a/lib/config/go_routes/go_router.dart +++ b/lib/config/go_routes/go_router.dart @@ -17,7 +17,6 @@ import 'package:fluffychat/pages/login/on_auth_redirect.dart'; import 'package:fluffychat/pages/new_group/new_group_chat_info.dart'; import 'package:fluffychat/pages/settings_dashboard/settings_app_language/settings_app_language.dart'; import 'package:fluffychat/pages/settings_dashboard/settings_profile/settings_profile.dart'; -import 'package:fluffychat/pages/share/share.dart'; import 'package:fluffychat/pages/story/story_page.dart'; import 'package:fluffychat/pages/twake_welcome/twake_welcome.dart'; import 'package:fluffychat/presentation/model/chat/chat_router_input_argument.dart'; @@ -519,14 +518,6 @@ abstract class AppRoutes { ), ], ), - GoRoute( - path: '/share', - pageBuilder: (context, state) => defaultPageBuilder( - context, - const Share(), - ), - redirect: loggedOutRedirect, - ), ], ), ]; diff --git a/lib/pages/chat_list/receive_sharing_intent_mixin.dart b/lib/pages/chat_list/receive_sharing_intent_mixin.dart index bf258b1f6a..838da4d041 100644 --- a/lib/pages/chat_list/receive_sharing_intent_mixin.dart +++ b/lib/pages/chat_list/receive_sharing_intent_mixin.dart @@ -40,10 +40,13 @@ mixin ReceiveSharingIntentMixin on State { } void openSharePage() { - if (TwakeApp.router.routeInformationProvider.value.uri.path - .startsWith('/rooms/')) { + if (isCurrentPageIsNotRooms()) { + return; + } + if (isCurrentPageIsInRooms()) { TwakeApp.router.go('/rooms'); } + Navigator.of(TwakeApp.routerKey.currentContext!).push( MaterialPageRoute( builder: (context) => const Share(), @@ -51,6 +54,14 @@ mixin ReceiveSharingIntentMixin on State { ); } + bool isCurrentPageIsInRooms() => + TwakeApp.router.routeInformationProvider.value.uri.path + .startsWith('/rooms/'); + + bool isCurrentPageIsNotRooms() => + !TwakeApp.router.routeInformationProvider.value.uri.path + .startsWith('/rooms'); + void _processIncomingSharedText(String? text) { if (text == null) return; if (_intentOpenApp(text)) {