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

View File

@@ -153,6 +153,8 @@
<string name="lightning_address">Lightning Address</string> <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="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="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="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="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> <string name="send_a_direct_message">Send a Direct Message</string>