[CredManUi] Show provider name in get flow.

Also change the separator from " - " to "•" according to the spec.

Bug: 267814761
Test: manual (see screenshot in bug)
Change-Id: I26596afca23c9ab16bbf74b8da40b11a563bef83
This commit is contained in:
Helen Qin
2023-03-06 00:00:45 +00:00
parent 279661f072
commit d76e83d623
4 changed files with 19 additions and 10 deletions

View File

@@ -110,7 +110,7 @@
<!-- This is a label for a button that takes user to the next screen. [CHAR LIMIT=20] -->
<string name="get_dialog_button_label_continue">Continue</string>
<!-- Separator for sign-in type and username in a sign-in entry. -->
<string name="get_dialog_sign_in_type_username_separator" translatable="false">" - "</string>
<string name="get_dialog_sign_in_type_username_separator" translatable="false">" • "</string>
<!-- This text is followed by a list of one or more options. [CHAR LIMIT=80] -->
<string name="get_dialog_title_sign_in_options">Sign-in options</string>
<!-- Column heading for displaying sign-ins for a specific username. [CHAR LIMIT=80] -->

View File

@@ -149,7 +149,10 @@ class GetFlowUtils {
icon = providerIcon,
displayName = providerLabel,
credentialEntryList = getCredentialOptionInfoList(
it.providerFlattenedComponentName, it.credentialEntries, context
providerId = it.providerFlattenedComponentName,
providerLabel = providerLabel,
credentialEntries = it.credentialEntries,
context = context
),
authenticationEntryList = getAuthenticationEntryList(
it.providerFlattenedComponentName,
@@ -202,6 +205,7 @@ class GetFlowUtils {
*/
private fun getCredentialOptionInfoList(
providerId: String,
providerLabel: String,
credentialEntries: List<Entry>,
context: Context,
): List<CredentialEntryInfo> {
@@ -212,6 +216,7 @@ class GetFlowUtils {
is PasswordCredentialEntry -> {
result.add(CredentialEntryInfo(
providerId = providerId,
providerDisplayName = providerLabel,
entryKey = it.key,
entrySubkey = it.subkey,
pendingIntent = credentialEntry.pendingIntent,
@@ -227,6 +232,7 @@ class GetFlowUtils {
is PublicKeyCredentialEntry -> {
result.add(CredentialEntryInfo(
providerId = providerId,
providerDisplayName = providerLabel,
entryKey = it.key,
entrySubkey = it.subkey,
pendingIntent = credentialEntry.pendingIntent,
@@ -242,6 +248,7 @@ class GetFlowUtils {
is CustomCredentialEntry -> {
result.add(CredentialEntryInfo(
providerId = providerId,
providerDisplayName = providerLabel,
entryKey = it.key,
entrySubkey = it.subkey,
pendingIntent = credentialEntry.pendingIntent,

View File

@@ -415,14 +415,15 @@ fun CredentialEntryRow(
credentialEntryInfo.credentialType == CredentialType.PASSWORD) {
"••••••••••••"
} else {
if (TextUtils.isEmpty(credentialEntryInfo.displayName))
credentialEntryInfo.credentialTypeDisplayName
else
credentialEntryInfo.credentialTypeDisplayName +
stringResource(
R.string.get_dialog_sign_in_type_username_separator
) +
credentialEntryInfo.displayName
val itemsToDisplay = listOf(
credentialEntryInfo.displayName,
credentialEntryInfo.credentialTypeDisplayName,
credentialEntryInfo.providerDisplayName
).filterNot(TextUtils::isEmpty)
if (itemsToDisplay.isEmpty()) null
else itemsToDisplay.joinToString(
separator = stringResource(R.string.get_dialog_sign_in_type_username_separator)
)
},
)
}

View File

@@ -77,6 +77,7 @@ class CredentialEntryInfo(
val credentialType: CredentialType,
/** Localized type value of this credential used for display purpose. */
val credentialTypeDisplayName: String,
val providerDisplayName: String,
val userName: String,
val displayName: String?,
val icon: Drawable?,