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

Commit 65b28fd0 authored by Helen Qin's avatar Helen Qin
Browse files

[CredManUi] Add account name to the default provider dialog.

Bug: 271340033
Test: manual (see bug for screenshot)
Change-Id: I53848977115d925e1f3af04d7f08953a7130763d
parent c2634f8d
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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] -->
+5 −0
Original line number Diff line number Diff line
@@ -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()
+28 −11
Original line number Diff line number Diff line
@@ -120,11 +120,20 @@ fun CreateCredentialScreen(
                            viewModel::createFlowOnDisabledProvidersSelected,
                            onRemoteEntrySelected = viewModel::createFlowOnEntrySelected,
                        )
                        CreateScreenState.MORE_OPTIONS_ROW_INTRO -> MoreOptionsRowIntroCard(
                            providerInfo = createCredentialUiState.activeEntry?.activeProvider!!,
                            onChangeDefaultSelected = viewModel::createFlowOnChangeDefaultSelected,
                        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 =
@@ -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 = {
+1 −1
Original line number Diff line number Diff line
@@ -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?,