Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! TW-1936: change from go to push wh…
Browse files Browse the repository at this point in the history
…en open sharing screen
  • Loading branch information
sherlockvn committed Sep 9, 2024
1 parent 4879dec commit eaf9e2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
9 changes: 0 additions & 9 deletions lib/config/go_routes/go_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -519,14 +518,6 @@ abstract class AppRoutes {
),
],
),
GoRoute(
path: '/share',
pageBuilder: (context, state) => defaultPageBuilder(
context,
const Share(),
),
redirect: loggedOutRedirect,
),
],
),
];
Expand Down
15 changes: 13 additions & 2 deletions lib/pages/chat_list/receive_sharing_intent_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,28 @@ mixin ReceiveSharingIntentMixin<T extends StatefulWidget> on State<T> {
}

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(),
),
);
}

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)) {
Expand Down

0 comments on commit eaf9e2f

Please sign in to comment.