Merge "[CredManUi] Add account name to the default provider dialog." into udc-dev
This commit is contained in:
@@ -67,9 +67,8 @@
|
||||
<string name="create_passkey_in_other_device_title">Create passkey in another device?</string>
|
||||
<!-- This appears as the title of the modal bottom sheet for users to confirm whether they should use the selected provider as default or not. [CHAR LIMIT=200] -->
|
||||
<string name="use_provider_for_all_title">Use <xliff:g id="providerInfoDisplayName" example="Google Password Manager">%1$s</xliff:g> for all your sign-ins?</string>
|
||||
<!-- TODO: Check the wording here. -->
|
||||
<!-- This appears as the description body of the modal bottom sheet for users to confirm whether they should use the selected provider as default or not. [CHAR LIMIT=200] -->
|
||||
<string name="use_provider_for_all_description">This password manager will store your passwords and passkeys to help you easily sign in</string>
|
||||
<!-- This appears as the description body of the modal bottom sheet for users to confirm whether they should use the selected provider as default or not. [CHAR LIMIT=300] -->
|
||||
<string name="use_provider_for_all_description">This password manager for <xliff:g id="username" example="becket@gmail.com">%1$s</xliff:g> will store your passwords and passkeys to help you easily sign in</string>
|
||||
<!-- This is a label for a button that sets this password manager as the default. [CHAR LIMIT=20] -->
|
||||
<string name="set_as_default">Set as default</string>
|
||||
<!-- This is a label for a button that makes this password manager be used just in this specific case. [CHAR LIMIT=20] -->
|
||||
|
||||
@@ -130,6 +130,11 @@ class CredentialSelectorViewModel(
|
||||
onInternalError()
|
||||
}
|
||||
|
||||
fun onIllegalUiState(errorMessage: String) {
|
||||
Log.w(Constants.LOG_TAG, errorMessage)
|
||||
onInternalError()
|
||||
}
|
||||
|
||||
private fun onInternalError() {
|
||||
Log.w(Constants.LOG_TAG, "UI closed due to illegal internal state")
|
||||
credManRepo.onParsingFailureCancel()
|
||||
|
||||
@@ -120,11 +120,20 @@ fun CreateCredentialScreen(
|
||||
viewModel::createFlowOnDisabledProvidersSelected,
|
||||
onRemoteEntrySelected = viewModel::createFlowOnEntrySelected,
|
||||
)
|
||||
CreateScreenState.MORE_OPTIONS_ROW_INTRO -> MoreOptionsRowIntroCard(
|
||||
providerInfo = createCredentialUiState.activeEntry?.activeProvider!!,
|
||||
onChangeDefaultSelected = viewModel::createFlowOnChangeDefaultSelected,
|
||||
onUseOnceSelected = viewModel::createFlowOnUseOnceSelected,
|
||||
)
|
||||
CreateScreenState.MORE_OPTIONS_ROW_INTRO -> {
|
||||
if (createCredentialUiState.activeEntry == null) {
|
||||
viewModel.onIllegalUiState("Expect active entry to be non-null" +
|
||||
" upon default provider dialog.")
|
||||
} else {
|
||||
MoreOptionsRowIntroCard(
|
||||
selectedEntry = createCredentialUiState.activeEntry,
|
||||
onIllegalScreenState = viewModel::onIllegalUiState,
|
||||
onChangeDefaultSelected =
|
||||
viewModel::createFlowOnChangeDefaultSelected,
|
||||
onUseOnceSelected = viewModel::createFlowOnUseOnceSelected,
|
||||
)
|
||||
}
|
||||
}
|
||||
CreateScreenState.EXTERNAL_ONLY_SELECTION -> ExternalOnlySelectionCard(
|
||||
requestDisplayInfo = createCredentialUiState.requestDisplayInfo,
|
||||
activeRemoteEntry =
|
||||
@@ -331,7 +340,7 @@ fun MoreOptionsSelectionCard(
|
||||
)
|
||||
}) {
|
||||
item { Divider(thickness = 8.dp, color = Color.Transparent) } // Top app bar has a 8dp
|
||||
// bottom padding already
|
||||
// bottom padding already
|
||||
item {
|
||||
CredentialContainerCard {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(2.dp)) {
|
||||
@@ -376,23 +385,31 @@ fun MoreOptionsSelectionCard(
|
||||
|
||||
@Composable
|
||||
fun MoreOptionsRowIntroCard(
|
||||
providerInfo: EnabledProviderInfo,
|
||||
selectedEntry: ActiveEntry,
|
||||
onIllegalScreenState: (String) -> Unit,
|
||||
onChangeDefaultSelected: () -> Unit,
|
||||
onUseOnceSelected: () -> Unit,
|
||||
) {
|
||||
val entryInfo = selectedEntry.activeEntryInfo
|
||||
if (entryInfo !is CreateOptionInfo) {
|
||||
onIllegalScreenState("Encountered unexpected type of entry during the default provider" +
|
||||
" dialog: ${entryInfo::class}")
|
||||
return
|
||||
}
|
||||
SheetContainerCard {
|
||||
item { HeadlineIcon(imageVector = Icons.Outlined.NewReleases) }
|
||||
item { Divider(thickness = 24.dp, color = Color.Transparent) }
|
||||
item {
|
||||
HeadlineText(
|
||||
text = stringResource(
|
||||
R.string.use_provider_for_all_title,
|
||||
providerInfo.displayName
|
||||
)
|
||||
R.string.use_provider_for_all_title, selectedEntry.activeProvider.displayName)
|
||||
)
|
||||
}
|
||||
item { Divider(thickness = 24.dp, color = Color.Transparent) }
|
||||
item { BodyMediumText(text = stringResource(R.string.use_provider_for_all_description)) }
|
||||
item {
|
||||
BodyMediumText(text = stringResource(
|
||||
R.string.use_provider_for_all_description, entryInfo.userProviderDisplayName))
|
||||
}
|
||||
item {
|
||||
CtaButtonRow(
|
||||
leftButton = {
|
||||
|
||||
@@ -69,7 +69,7 @@ class CreateOptionInfo(
|
||||
entrySubkey: String,
|
||||
pendingIntent: PendingIntent?,
|
||||
fillInIntent: Intent?,
|
||||
val userProviderDisplayName: String?,
|
||||
val userProviderDisplayName: String,
|
||||
val profileIcon: Drawable?,
|
||||
val passwordCount: Int?,
|
||||
val passkeyCount: Int?,
|
||||
|
||||
Reference in New Issue
Block a user