-
Notifications
You must be signed in to change notification settings - Fork 665
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
Support 2fa in LinkActivityViewModel #10040
Conversation
Diffuse output:
APK
|
d42b115
to
ede5b96
Compare
val linkAccount = linkAccountManager.linkAccount.value | ||
val accountStatus = linkAccountManager.accountStatus.first() | ||
when (accountStatus) { | ||
AccountStatus.Verified, | ||
AccountStatus.SignedOut, | ||
AccountStatus.Error -> { | ||
_linkScreenState.value = ScreenState.Link | ||
} | ||
AccountStatus.NeedsVerification, | ||
AccountStatus.VerificationStarted -> { | ||
if (linkAccount != null && startWithVerificationDialog) { | ||
_linkScreenState.value = ScreenState.VerificationDialog(linkAccount) | ||
} else { | ||
_linkScreenState.value = ScreenState.Link | ||
} | ||
} | ||
} |
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.
This will determine whether we render the 2fa dialog or the default link flow
fun linkScreenScreenCreated() { | ||
viewModelScope.launch { | ||
navigateToLinkScreen() | ||
} | ||
} |
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.
This will be called from the UI when the default link flow is presented. It will navigate to the correct screen. Navigating early causes issues when the nav graph isn't registered yet. This is an example from the proof of concept PR
d280b57
to
d382fea
Compare
.build() | ||
.viewModel | ||
} | ||
} | ||
} | ||
} | ||
|
||
internal sealed interface ScreenState { | ||
data class VerificationDialog(val linkAccount: LinkAccount) : ScreenState | ||
data object Link : ScreenState |
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.
it might be useful to call Link
here something like FullScreen
instead. Since this is all Link, the current naming is a bit vague.
No need to address now -- feedback for a future improvement here
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.
I agree. I'll update when I add the remaining components
Clean up vm use false as default test values Fix tests
d382fea
to
a71ae1e
Compare
Summary
Updates to LinkActivityViewModel with states that render [loading, verification, fullscreen] flows
Motivation
JIRA
Testing
Screen Recording
Screen.Recording.2025-01-30.at.6.49.15.PM.mov
Changelog