Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9788e980 authored by Helen Qin's avatar Helen Qin
Browse files

Allow credential providers to set an "origin" for affiliated credentials

Bug: 307645200
Test: see screenshots attached to bug
Change-Id: I20448ffd7cccf96418b57623a34491638de72778
parent 62fe64e4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@ private fun getCredentialOptionInfoList(
                    entryGroupId = credentialEntry.entryGroupId.toString(),
                    isDefaultIconPreferredAsSingleProvider =
                            credentialEntry.isDefaultIconPreferredAsSingleProvider,
                    affiliatedDomain = credentialEntry.affiliatedDomain?.toString(),
                )
                )
            }
@@ -165,6 +166,7 @@ private fun getCredentialOptionInfoList(
                    entryGroupId = credentialEntry.entryGroupId.toString(),
                    isDefaultIconPreferredAsSingleProvider =
                            credentialEntry.isDefaultIconPreferredAsSingleProvider,
                    affiliatedDomain = credentialEntry.affiliatedDomain?.toString(),
                )
                )
            }
@@ -191,6 +193,7 @@ private fun getCredentialOptionInfoList(
                    entryGroupId = credentialEntry.entryGroupId.toString(),
                    isDefaultIconPreferredAsSingleProvider =
                            credentialEntry.isDefaultIconPreferredAsSingleProvider,
                    affiliatedDomain = credentialEntry.affiliatedDomain?.toString(),
                )
                )
            }
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ class CredentialEntryInfo(
    val entryGroupId: String, // Used for deduplication, and displayed as the grouping title
                              // "For <value-of-entryGroupId>" on the more-option screen.
    val isDefaultIconPreferredAsSingleProvider: Boolean,
    val affiliatedDomain: String?,
) : EntryInfo(
    providerId,
    entryKey,
+9 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ fun Entry(
    isLockedAuthEntry: Boolean = false,
    enforceOneLine: Boolean = false,
    onTextLayout: (TextLayoutResult) -> Unit = {},
    /** Get flow only, if present, where be drawn as a line above the headline. */
    affiliatedDomainText: String? = null,
) {
    val iconPadding = Modifier.wrapContentSize().padding(
        // Horizontal padding should be 16dp, but the suggestion chip itself
@@ -102,6 +104,13 @@ fun Entry(
            ) {
                // Apply weight so that the trailing icon can always show.
                Column(modifier = Modifier.wrapContentHeight().fillMaxWidth().weight(1f)) {
                    if (!affiliatedDomainText.isNullOrBlank()) {
                        BodySmallText(
                            text = affiliatedDomainText,
                            enforceOneLine = enforceOneLine,
                            onTextLayout = onTextLayout,
                        )
                    }
                    SmallTitleText(
                        text = entryHeadlineText,
                        enforceOneLine = enforceOneLine,
+2 −0
Original line number Diff line number Diff line
@@ -376,6 +376,7 @@ fun PrimarySelectionCard(
}

internal const val MAX_ENTRY_FOR_PRIMARY_PAGE = 4

/** Draws the primary credential selection page, used starting from android V. */
@Composable
fun PrimarySelectionCardVImpl(
@@ -805,6 +806,7 @@ fun CredentialEntryRow(
        },
        enforceOneLine = enforceOneLine,
        onTextLayout = onTextLayout,
        affiliatedDomainText = credentialEntryInfo.affiliatedDomain,
    )
}

+1 −0
Original line number Diff line number Diff line
@@ -151,6 +151,7 @@ class GetCredScreenshotTest(emulationSpec: DeviceEmulationSpec) {
                                entryGroupId = "username",
                                isDefaultIconPreferredAsSingleProvider = false,
                                rawCredentialType = "unknown-type",
                                affiliatedDomain = null,
                        )
                ),
                authenticationEntryList = emptyList(),