From ec063e9c27eca77dff404858ab924fbd56df522e Mon Sep 17 00:00:00 2001 From: stopflock Date: Sun, 31 Aug 2025 21:17:37 -0500 Subject: [PATCH] handle async browser login better --- .../auth_section.dart | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lib/screens/settings_screen_sections/auth_section.dart b/lib/screens/settings_screen_sections/auth_section.dart index f5fa50a..8eb1c2a 100644 --- a/lib/screens/settings_screen_sections/auth_section.dart +++ b/lib/screens/settings_screen_sections/auth_section.dart @@ -30,18 +30,20 @@ class AuthSection extends StatelessWidget { onTap: () async { if (appState.isLoggedIn) { await appState.logout(); + if (context.mounted) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(locService.t('auth.loggedOut')), + backgroundColor: Colors.grey, + ), + ); + } } else { + // Start login flow - the user will be redirected to browser await appState.forceLogin(); - } - if (context.mounted) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(appState.isLoggedIn - ? locService.t('auth.loggedInAs', params: [appState.username]) - : locService.t('auth.loggedOut')), - backgroundColor: appState.isLoggedIn ? Colors.green : Colors.grey, - ), - ); + + // Don't show immediate feedback - the UI will update automatically + // when the OAuth callback completes and notifyListeners() is called } }, ),