refactor: enhance navigation robustness by introducing popSafe and safePushNamedAndRemoveUntil methods and updating their usage.
This commit is contained in:
@@ -74,7 +74,9 @@ class _SessionListenerState extends State<SessionListener> {
|
||||
// Only show if not initial state (avoid showing on cold start)
|
||||
if (!_isInitialState) {
|
||||
debugPrint('[SessionListener] Session error: ${state.errorMessage}');
|
||||
_showSessionErrorDialog(state.errorMessage ?? 'Session error occurred');
|
||||
_showSessionErrorDialog(
|
||||
state.errorMessage ?? 'Session error occurred',
|
||||
);
|
||||
} else {
|
||||
_isInitialState = false;
|
||||
Modular.to.toClientGetStartedPage();
|
||||
@@ -126,7 +128,7 @@ class _SessionListenerState extends State<SessionListener> {
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
// User can retry by dismissing and continuing
|
||||
Modular.to.pop();
|
||||
Modular.to.popSafe();
|
||||
},
|
||||
child: const Text('Continue'),
|
||||
),
|
||||
|
||||
@@ -65,7 +65,6 @@ class _SessionListenerState extends State<SessionListener> {
|
||||
_sessionExpiredDialogShown = false;
|
||||
debugPrint('[SessionListener] Authenticated: ${state.userId}');
|
||||
|
||||
|
||||
// Navigate to the main app
|
||||
Modular.to.toStaffHome();
|
||||
break;
|
||||
@@ -75,7 +74,9 @@ class _SessionListenerState extends State<SessionListener> {
|
||||
// Only show if not initial state (avoid showing on cold start)
|
||||
if (!_isInitialState) {
|
||||
debugPrint('[SessionListener] Session error: ${state.errorMessage}');
|
||||
_showSessionErrorDialog(state.errorMessage ?? 'Session error occurred');
|
||||
_showSessionErrorDialog(
|
||||
state.errorMessage ?? 'Session error occurred',
|
||||
);
|
||||
} else {
|
||||
_isInitialState = false;
|
||||
Modular.to.toGetStartedPage();
|
||||
@@ -127,7 +128,7 @@ class _SessionListenerState extends State<SessionListener> {
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
// User can retry by dismissing and continuing
|
||||
Modular.to.pop();
|
||||
Modular.to.popSafe();
|
||||
},
|
||||
child: const Text('Continue'),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user