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

Commit f1451fc3 authored by Qinmei Du's avatar Qinmei Du
Browse files

Add the use provider for all your signins checking page

screencast: https://screencast.googleplex.com/cast/NTI0MDk5NDYxNTI2MzIzMnwzMDcxYTc0Zi0xZA

Test: deployed locally

Bug: 253157211
Change-Id: Ie3e1eb33fdb51b0b4483bb0b1e1c6168975fee92
parent 1f0e116d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
<resources>
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
  <string name="app_name">CredentialManager</string>
  <string name="string_cancel">Cancel</string>
  <string name="string_continue">Continue</string>
@@ -12,4 +13,7 @@
  <string name="choose_create_option_title">Create a passkey at</string>
  <string name="choose_sign_in_title">Use saved sign in</string>
  <string name="create_passkey_at">Create passkey at</string>
  <string name="use_provider_for_all_title">Use <xliff:g id="providerInfoName">%1$s</xliff:g> for all your sign-ins?</string>
  <string name="set_as_default">Set as default</string>
  <string name="use_once">Use once</string>
</resources>
 No newline at end of file
+29 −0
Original line number Diff line number Diff line
@@ -83,6 +83,8 @@ fun CreatePasskeyScreen(
            onOptionSelected = {viewModel.onMoreOptionsRowSelected(it)}
          )
        CreateScreenState.MORE_OPTIONS_ROW_INTRO -> MoreOptionsRowIntroCard(
          providerInfo = uiState.selectedProvider!!,
          onDefaultOrNotSelected = {viewModel.onDefaultOrNotSelected(it)}
        )
      }
    },
@@ -282,10 +284,37 @@ fun MoreOptionsSelectionCard(
@ExperimentalMaterialApi
@Composable
fun MoreOptionsRowIntroCard(
  providerInfo: ProviderInfo,
  onDefaultOrNotSelected: (String) -> Unit,
) {
  Card(
    backgroundColor = lightBackgroundColor,
  ) {
    Column() {
      Text(
        text = stringResource(R.string.use_provider_for_all_title, providerInfo.name),
        style = Typography.subtitle1,
        modifier = Modifier.padding(all = 24.dp).align(alignment = Alignment.CenterHorizontally)
      )
      Row(
        horizontalArrangement = Arrangement.SpaceBetween,
        modifier = Modifier.fillMaxWidth().padding(horizontal = 24.dp)
      ) {
        CancelButton(
          stringResource(R.string.use_once),
          onclick = { onDefaultOrNotSelected(providerInfo.name) }
        )
        ConfirmButton(
          stringResource(R.string.set_as_default),
          onclick = { onDefaultOrNotSelected(providerInfo.name) }
        )
      }
      Divider(
        thickness = 18.dp,
        color = Color.Transparent,
        modifier = Modifier.padding(bottom = 40.dp)
      )
    }
  }
}

+8 −0
Original line number Diff line number Diff line
@@ -112,4 +112,12 @@ class CreatePasskeyViewModel(
    CredentialManagerRepo.getInstance().onCancel()
    dialogResult.value = DialogResult(ResultState.CANCELED)
  }

  fun onDefaultOrNotSelected(providerName: String) {
    uiState = uiState.copy(
      currentScreenState = CreateScreenState.CREATION_OPTION_SELECTION,
      selectedProvider = getProviderInfoByName(providerName)
    )
    // TODO: implement the if choose as default or not logic later
  }
}