[WIP] Fix Play services install and sign in flow
Replaces ephemeral navigation requests with a "main UI state" which gets applied at start up. This patch resolves existing issues, but there are likely several race conditions lurking due to complexity of the startup/install flow. We should revisit the design on this flow to make it easier to understand and to avoid cancellation exceptions or duplicate side effects (https://github.com/google/ground-android/issues/2923).
Fixes #2919 by restore UI state on on resume. Fixes #2783
@shobhitagarwal1612 @anandwana001 This actually won't work - collecting the so-called "MainUiState" on resume will navigate the user away from their current screen in many cases (ToS, survey list, etc), since those screens are not represented in the UiState.
Filed https://github.com/google/ground-android/issues/2934 to track, moving back to Draft :/
Main is currently navigating to the wrong target on config change. Instead, allow each Fragment to maintain its own state and navigation actions by moving sign-in flow logic out of Main and into StartUp, SignIn and TermsOfService as follows:
- [ ]
StartUpwill direct to theHomeif already signed in,SignInif not. - [ ]
SignInwill direct toTermsOfServiceif available, otherwise toSurveySelector. - [ ]
TermsOfServicewill direct toHome. - [ ]
Mainwill navigate toSignInon sign-out.
Mainis currently navigating to the wrong target on config change. Instead, allow each Fragment to maintain its own state and navigation actions by moving sign-in flow logic out ofMainand intoStartUp,SignInandTermsOfServiceas follows:
- [ ]
StartUpwill direct to theHomeif already signed in,SignInif not.- [ ]
SignInwill direct toTermsOfServiceif available, otherwise toSurveySelector.- [ ]
TermsOfServicewill direct toHome.- [ ]
Mainwill navigate toSignInon sign-out.
@shobhitagarwal1612 @anandwana001 Do you want to want to pick these up?