Merge "[CredManUi] Show provider name in get flow." into udc-dev

This commit is contained in:
Helen Qin
2023-03-06 04:41:58 +00:00
committed by Android (Google) Code Review
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] --> <!-- 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> <string name="get_dialog_button_label_continue">Continue</string>
<!-- Separator for sign-in type and username in a sign-in entry. --> <!-- 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] --> <!-- 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> <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] --> <!-- Column heading for displaying sign-ins for a specific username. [CHAR LIMIT=80] -->

View File

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

View File

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

View File

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