From 94781bc1a92943a9df6b8ecc014fba477bd33c94 Mon Sep 17 00:00:00 2001 From: Patrick Honkonen <1883101+SaintPatrck@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:19:41 -0400 Subject: [PATCH] [PM-9407] Create reusable overwrite passkey confirmation dialog (#3541) --- ...ardenOverwritePasskeyConfirmationDialog.kt | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenOverwritePasskeyConfirmationDialog.kt diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenOverwritePasskeyConfirmationDialog.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenOverwritePasskeyConfirmationDialog.kt new file mode 100644 index 000000000..47ccfe065 --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/dialog/BitwardenOverwritePasskeyConfirmationDialog.kt @@ -0,0 +1,29 @@ +package com.x8bit.bitwarden.ui.platform.components.dialog + +import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource +import com.x8bit.bitwarden.R + +/** + * A reusable dialog for confirming whether or not the user wants to overwrite an existing FIDO 2 + * credential. + * + * @param onConfirmClick A callback for when the overwrite confirmation button is clicked. + * @param onDismissRequest A callback for when the dialog is requesting dismissal. + */ +@Suppress("MaxLineLength") +@Composable +fun BitwardenOverwritePasskeyConfirmationDialog( + onConfirmClick: () -> Unit, + onDismissRequest: () -> Unit, +) { + BitwardenTwoButtonDialog( + title = stringResource(id = R.string.overwrite_passkey), + message = stringResource(id = R.string.this_item_already_contains_a_passkey_are_you_sure_you_want_to_overwrite_the_current_passkey), + confirmButtonText = stringResource(id = R.string.ok), + dismissButtonText = stringResource(id = R.string.cancel), + onConfirmClick = onConfirmClick, + onDismissClick = onDismissRequest, + onDismissRequest = onDismissRequest, + ) +}