Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mobile): random logout #8739

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions mobile/lib/shared/views/splash_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class SplashScreenPage extends HookConsumerWidget {
void performLoggingIn() async {
bool isSuccess = false;
bool deviceIsOffline = false;

if (accessToken != null && serverUrl != null) {
try {
// Resolve API server endpoint from user provided serverUrl
Expand All @@ -50,15 +51,11 @@ class SplashScreenPage extends HookConsumerWidget {
offlineLogin: deviceIsOffline,
);
} catch (error, stackTrace) {
ref.read(authenticationProvider.notifier).logout();

log.severe(
'Cannot set success login info',
error,
stackTrace,
);

context.pushRoute(const LoginRoute());
}
}

Expand All @@ -76,6 +73,11 @@ class SplashScreenPage extends HookConsumerWidget {
}
context.replaceRoute(const TabControllerRoute());
} else {
log.severe(
'Unable to login through offline or online methods - logging out completely',
);

ref.read(authenticationProvider.notifier).logout();
// User was unable to login through either offline or online methods
context.replaceRoute(const LoginRoute());
}
Expand Down
Loading