Fix back arrow behavior for remote-only sign-in flow

It should lead back to the snackbar. Currently it cancels the whole
flow.

Bug: 280517963
Test: manual (see bug for recording)
Change-Id: Ibd4993dbca888c0c9f012963f54623cc426571ae
This commit is contained in:
Helen Qin
2023-05-03 18:52:28 +00:00
parent 40e35dfad3
commit 1d46965127
2 changed files with 12 additions and 4 deletions

View File

@@ -232,6 +232,14 @@ class CredentialSelectorViewModel(
)
}
fun getFlowOnBackToHybridSnackBarScreen() {
uiState = uiState.copy(
getCredentialUiState = uiState.getCredentialUiState?.copy(
currentScreenState = GetScreenState.REMOTE_ONLY
)
)
}
fun getFlowOnBackToPrimarySelectionScreen() {
uiState = uiState.copy(
getCredentialUiState = uiState.getCredentialUiState?.copy(

View File

@@ -121,9 +121,10 @@ fun GetCredentialScreen(
providerDisplayInfo = getCredentialUiState.providerDisplayInfo,
onEntrySelected = viewModel::getFlowOnEntrySelected,
onBackButtonClicked =
viewModel::getFlowOnBackToPrimarySelectionScreen,
if (getCredentialUiState.isNoAccount)
viewModel::getFlowOnBackToHybridSnackBarScreen
else viewModel::getFlowOnBackToPrimarySelectionScreen,
onCancel = viewModel::onUserCancel,
isNoAccount = getCredentialUiState.isNoAccount,
onLog = { viewModel.logUiEvent(it) },
)
viewModel.uiMetrics.log(GetCredentialEvent
@@ -327,7 +328,6 @@ fun AllSignInOptionCard(
onEntrySelected: (BaseEntry) -> Unit,
onBackButtonClicked: () -> Unit,
onCancel: () -> Unit,
isNoAccount: Boolean,
onLog: @Composable (UiEventEnum) -> Unit,
) {
val sortedUserNameToCredentialEntryList =
@@ -336,7 +336,7 @@ fun AllSignInOptionCard(
SheetContainerCard(topAppBar = {
MoreOptionTopAppBar(
text = stringResource(R.string.get_dialog_title_sign_in_options),
onNavigationIconClicked = if (isNoAccount) onCancel else onBackButtonClicked,
onNavigationIconClicked = onBackButtonClicked,
bottomPadding = 0.dp,
)
}) {