Merge "Add the use provider for all your signins checking page"
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<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>
|
||||
@@ -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)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user