-
Notifications
You must be signed in to change notification settings - Fork 240
fix(auth): restore logged-in user on app resume #2856
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
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
roll SDK for new auth state watcher method
|
Visit the preview URL for this PR (updated for commit 606374d): https://walletrc--pull-2856-merge-xbp8qpkn.web.app (expires Mon, 14 Jul 2025 13:50:03 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc |
…into codex/check-if-user-is-signed-in-on-app-resume
…into codex/check-if-user-is-signed-in-on-app-resume
|
@takenagain, please test since you were originally handling this PR, and you were aware of some issues in the last version you committed. |
takenagain
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smk762
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Built and launched android app on Android 14 (API 34). Left to do some lawn repair, came back 15 mins later. Phone asleep, logged in to awaken, navigated to app - still functional. LTGM, thanks!
This pull request introduces enhancements to the app's lifecycle handling and authentication flow, ensuring that the user's authentication state is checked and restored during app lifecycle events. Key changes include adding a new
AuthLifecycleCheckRequestedevent, implementing its handling inAuthBloc, and integrating this check into the app lifecycle via_AnalyticsLifecycleHandlerState.Testing
Minimise the Android app and then reopen it after a few moments.
Enhancements to lifecycle handling:
lib/analytics/widgets/analytics_lifecycle_handler.dart: Added_checkAuthStatusmethod to check the user's authentication state during app lifecycle events (AppLifecycleState.resumedand after the first frame). This method dispatches theAuthLifecycleCheckRequestedevent to theAuthBloc. [1] [2] [3]Updates to authentication flow:
lib/bloc/auth_bloc/auth_bloc.dart: Added_onLifecycleCheckRequestedmethod to handle the newAuthLifecycleCheckRequestedevent. This method checks the current user viaKomodoDefiSdkand updates the authentication state if a user is logged in.lib/bloc/auth_bloc/auth_bloc_event.dart: Introduced theAuthLifecycleCheckRequestedevent to trigger authentication state checks during lifecycle changes.Integration with app initialization:
lib/main.dart: Modified theAuthBlocinitialization to dispatch theAuthLifecycleCheckRequestedevent immediately upon creation, ensuring the authentication state is checked at startup.Coins state update:
lib/bloc/coins_bloc/coins_bloc.dart: Enhanced theCoinsBlocto check for an existing user during initialization and emit aCoinsSessionStartedevent if the user is logged in.