@@ -10,6 +10,7 @@ import 'package:bb_mobile/features/exchange/ui/screens/exchange_landing_screen_v
1010import 'package:bb_mobile/features/exchange/ui/screens/exchange_support_login_screen.dart' ;
1111import 'package:bb_mobile/features/exchange_support_chat/ui/exchange_support_chat_router.dart' ;
1212import 'package:bb_mobile/features/settings/presentation/bloc/settings_cubit.dart' ;
13+ import 'package:bb_mobile/features/wallet/ui/wallet_router.dart' ;
1314import 'package:flutter/material.dart' ;
1415import 'package:flutter_bloc/flutter_bloc.dart' ;
1516import 'package:go_router/go_router.dart' ;
@@ -36,6 +37,11 @@ class ExchangeRouter {
3637 if (notLoggedIn) {
3738 return ExchangeRoute .exchangeLanding.path;
3839 }
40+ final isSuperuser =
41+ context.read <SettingsCubit >().state.isSuperuser ?? false ;
42+ if (Platform .isIOS && ! isSuperuser) {
43+ return WalletRoute .walletHome.path;
44+ }
3945 return null ;
4046 },
4147 pageBuilder: (context, state) {
@@ -52,7 +58,6 @@ class ExchangeRouter {
5258 return const ExchangeKycScreen ();
5359 },
5460 ),
55- ExchangeSupportChatRouter .route,
5661 ],
5762 ),
5863 GoRoute (
@@ -80,30 +85,41 @@ class ExchangeRouter {
8085 name: ExchangeRoute .exchangeLoginForSupport.name,
8186 path: ExchangeRoute .exchangeLoginForSupport.path,
8287 pageBuilder: (context, state) {
83- Widget screen;
84- if (Platform .isIOS) {
85- final isSuperuser =
86- context.read <SettingsCubit >().state.isSuperuser ?? false ;
87- screen = isSuperuser
88- ? const ExchangeLandingScreen ()
89- : const ExchangeSupportLoginScreen ();
90- } else {
91- screen = const ExchangeLandingScreen ();
92- }
93- return NoTransitionPage (key: state.pageKey, child: screen);
88+ return NoTransitionPage (
89+ key: state.pageKey,
90+ child: const ExchangeSupportLoginScreen (),
91+ );
9492 },
9593 ),
94+ ExchangeSupportChatRouter .route,
9695 GoRoute (
9796 name: ExchangeRoute .exchangeAuth.name,
9897 path: ExchangeRoute .exchangeAuth.path,
9998 pageBuilder: (context, state) {
99+ final fromSupport =
100+ state.uri.queryParameters['from' ] == 'support' ;
100101 return NoTransitionPage (
101102 key: state.pageKey,
102103 child: BlocListener <ExchangeCubit , ExchangeState >(
103104 listenWhen: (previous, current) =>
104105 previous.notLoggedIn && ! current.notLoggedIn,
105- listener: (context, state) {
106- // Redirect to home screen if the API key becomes valid
106+ listener: (context, exchangeState) {
107+ if (fromSupport) {
108+ final isIOSNonSuperuser = Platform .isIOS &&
109+ ! (context.read <SettingsCubit >().state.isSuperuser ?? false );
110+ context.goNamed (
111+ ExchangeSupportChatRoute .supportChat.name,
112+ queryParameters:
113+ isIOSNonSuperuser ? {} : {'from' : 'exchange' },
114+ );
115+ return ;
116+ }
117+ final isSuperuser =
118+ context.read <SettingsCubit >().state.isSuperuser ?? false ;
119+ if (Platform .isIOS && ! isSuperuser) {
120+ context.goNamed (WalletRoute .walletHome.name);
121+ return ;
122+ }
107123 context.goNamed (ExchangeRoute .exchangeHome.name);
108124 },
109125 child: const ExchangeAuthScreen (),
0 commit comments