added content description to QR code icons

This commit is contained in:
David Kaspar 2024-12-18 23:23:57 +01:00
parent 4f4da12aa7
commit 9f1b5a3c1a
2 changed files with 8 additions and 4 deletions

View File

@ -128,8 +128,7 @@ fun DialogContentsPreview() {
ThemeComparisonRow {
DialogContents(
mockAccountViewModel(),
{},
)
) {}
}
}
@ -251,7 +250,7 @@ private fun DialogContents(
},
keyboardOptions =
KeyboardOptions(
autoCorrect = false,
autoCorrectEnabled = false,
keyboardType = KeyboardType.Password,
imeAction = ImeAction.Go,
),
@ -474,6 +473,7 @@ private fun encryptCopyNSec(
private fun QrCodeButtonBase(
accountViewModel: AccountViewModel,
isEnabled: Boolean = true,
contentDescription: Int,
onDialogShow: () -> String?,
) {
val context = LocalContext.current
@ -502,7 +502,7 @@ private fun QrCodeButtonBase(
) {
Icon(
painter = painterResource(R.drawable.ic_qrcode),
contentDescription = stringRes(id = R.string.show_npub_as_a_qr_code),
contentDescription = stringRes(id = contentDescription),
modifier = Modifier.size(24.dp),
tint = if (isEnabled) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.grayText,
)
@ -520,6 +520,7 @@ private fun QrCodeButtonBase(
private fun QrCodeButton(accountViewModel: AccountViewModel) {
QrCodeButtonBase(
accountViewModel = accountViewModel,
contentDescription = R.string.show_private_key_qr_code,
onDialogShow = {
accountViewModel.account.settings.keyPair.privKey
?.toNsec()
@ -535,6 +536,7 @@ private fun QrCodeButtonEncrypted(
QrCodeButtonBase(
accountViewModel = accountViewModel,
isEnabled = password.value.text.isNotBlank(),
contentDescription = R.string.show_encrypted_private_key_qr_code,
onDialogShow = {
accountViewModel.account.settings.keyPair.privKey
?.toHexKey()

View File

@ -153,6 +153,8 @@
<string name="lightning_address">Lightning Address</string>
<string name="copies_the_nsec_id_your_password_to_the_clipboard_for_backup">Copies the Nsec ID (your password) to the clipboard for backup</string>
<string name="copy_private_key_to_the_clipboard">Copy Secret Key to the Clipboard</string>
<string name="show_private_key_qr_code">Show private key QR code</string>
<string name="show_encrypted_private_key_qr_code">Show encrypted private key QR code</string>
<string name="copies_the_public_key_to_the_clipboard_for_sharing">Copies the public key to the clipboard for sharing</string>
<string name="copy_public_key_npub_to_the_clipboard">Copy Public Key (NPub) to the Clipboard</string>
<string name="send_a_direct_message">Send a Direct Message</string>