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

[Code health] Design flaw in main startup flow #2934

Open
gino-m opened this issue Dec 16, 2024 · 1 comment
Open

[Code health] Design flaw in main startup flow #2934

gino-m opened this issue Dec 16, 2024 · 1 comment
Assignees
Labels
type: code health Improvements to readability or robustness of codebase

Comments

@gino-m
Copy link
Collaborator

gino-m commented Dec 16, 2024

Play services and login are tied to an event triggered by MainViewModel and handled by MainActivity. The MainActivity may not be active when this event is triggered, so it will sometimes miss the sign-in event, for example when the app is temporarily in the background (e.g., when Play services are being installed, and when started in the background while debugging from Android Studio).

The initialization flow "evolved" while we were still learning modern Android dev, rather than being thoughtfully designed. @shobhitagarwal1612 @scolsen @anandwana001, any ideas on how this should work in practice?

@gino-m gino-m added the type: code health Improvements to readability or robustness of codebase label Dec 16, 2024
@gino-m
Copy link
Collaborator Author

gino-m commented Dec 16, 2024

Some initial thoughts:

  • We could always check for Play services, ToS, and auth on resume of MainActivity instead of just in StartupFragment
  • In that case, MainUiState may not be correct - instead, Play services init and ToS could probably can be recast as StartupState or similar
  • Rather than receive auth changes as navigationRequest events, MainActivity should listen for the current state on app resume and redirect to the appropriate page iff the sign in Play->sign in->ToS flow isn't complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: code health Improvements to readability or robustness of codebase
Projects
Status: No status
Development

No branches or pull requests

1 participant