From 436ae370bac286302bfa491ab8b0f0ad9a908550 Mon Sep 17 00:00:00 2001 From: Arnfried Griesert Date: Wed, 3 May 2023 04:42:05 +0000 Subject: [PATCH] Feature/4519 voice over texte secure textfield --- Riot/Assets/de.lproj/Bwi.strings | 4 ++++ Riot/Assets/en.lproj/Bwi.strings | 8 +++++++- .../SecretsRecoveryWithPassphraseViewController.swift | 4 +++- .../Modules/Common/Util/PasswordButtonModifier.swift | 1 + .../Modules/Common/Util/RoundedBorderTextField.swift | 1 - RiotSwiftUI/Modules/Common/Util/ThemableTextField.swift | 5 +++++ 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Riot/Assets/de.lproj/Bwi.strings b/Riot/Assets/de.lproj/Bwi.strings index 4f5569b08..448710eb4 100644 --- a/Riot/Assets/de.lproj/Bwi.strings +++ b/Riot/Assets/de.lproj/Bwi.strings @@ -612,3 +612,7 @@ // MARK: - Device Manager "user_session_verified_session_description" = "Du hast deine Sitzung durch Eingabe des Wiederherstellungsschlüssels oder durch die Verifizierung mit einem anderen Gerät bestätigt. Dies bedeutet, dass du alle Schlüssel zum Entschlüsseln deiner Nachrichten hast und anderen bestätigst, dieser Sitzung zu vertrauen."; "user_session_button_view_all" = "Alle anzeigen (%d)"; + +// MARK: - Voice Over +"textfield_reveal_secret" = "Texteingabe anzeigen"; +"textfield_hide_secret" = "Texteingabe verbergen"; diff --git a/Riot/Assets/en.lproj/Bwi.strings b/Riot/Assets/en.lproj/Bwi.strings index 1e01cb7b2..e0f66d722 100644 --- a/Riot/Assets/en.lproj/Bwi.strings +++ b/Riot/Assets/en.lproj/Bwi.strings @@ -198,7 +198,7 @@ "secure_key_backup_setup_intro_use_security_passphrase_title" = "Recovery Key"; "secure_key_backup_setup_intro_use_security_passphrase_info" = "Set up recovery key."; "key_backup_setup_passphrase_confirm_passphrase_title" = ""; -"key_backup_setup_passphrase_confirm_passphrase_placeholder" = "Recovery Key"; +"key_backup_setup_passphrase_confirm_passphrase_placeholder" = "Recovery Key"; "key_backup_setup_passphrase_confirm_passphrase_invalid" = "doesn’t match"; "key_backup_recover_invalid_passphrase_title" = "Incorrect Recovery Key"; "key_backup_recover_invalid_passphrase" = "Backup could not be decrypted with this phrase: please verify that you entered the correct recovery key."; @@ -459,6 +459,7 @@ "welcome_experience_title5" = "Get started today!"; "welcome_experience_description5" = "Next, you can find out whether your organization is already using BundesMessenger. If not, try to convince your boss to become part of the community!"; + "welcome_experience_start" = "Start now"; // MARK: - new login flow @@ -518,3 +519,8 @@ // MARK: - Device Manager "user_session_verified_session_description" = "You have confirmed your session by entering the recovery key or verifying with another device. This means that you have all the keys to decrypt your messages and are confirming to others to trust this session."; "user_session_button_view_all" = "View all (%d)"; + +// MARK: - Voice Over +"textfield_reveal_secret" = "reveal text input"; +"textfield_hide_secret" = "hide text input"; + diff --git a/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewController.swift b/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewController.swift index a59cdccf9..221c43ff2 100644 --- a/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewController.swift +++ b/Riot/Modules/Secrets/Recover/RecoverWithPassphrase/SecretsRecoveryWithPassphraseViewController.swift @@ -109,7 +109,7 @@ final class SecretsRecoveryWithPassphraseViewController: UIViewController { let visibilityImage = Asset.Images.revealPasswordButton.image.withRenderingMode(.alwaysTemplate) self.passphraseVisibilityButton.setImage(visibilityImage, for: .normal) - + self.passphraseVisibilityButton.accessibilityLabel = BWIL10n.textfieldRevealSecret let informationText: String switch self.viewModel.recoveryGoal { @@ -198,8 +198,10 @@ final class SecretsRecoveryWithPassphraseViewController: UIViewController { private func updateShowHidePassphraseButton() { if self.passphraseTextField.isSecureTextEntry { passphraseVisibilityButton.setImage(Asset.Images.revealPasswordButton.image, for: .normal) + passphraseVisibilityButton.accessibilityLabel = BWIL10n.textfieldRevealSecret } else { passphraseVisibilityButton.setImage(Asset.Images.hidePasswordButton.image, for: .normal) + passphraseVisibilityButton.accessibilityLabel = BWIL10n.textfieldHideSecret } } diff --git a/RiotSwiftUI/Modules/Common/Util/PasswordButtonModifier.swift b/RiotSwiftUI/Modules/Common/Util/PasswordButtonModifier.swift index 3b2710006..d91267615 100644 --- a/RiotSwiftUI/Modules/Common/Util/PasswordButtonModifier.swift +++ b/RiotSwiftUI/Modules/Common/Util/PasswordButtonModifier.swift @@ -46,6 +46,7 @@ struct PasswordButtonModifier: ViewModifier { .frame(width: iconSize, height: iconSize) .foregroundColor(theme.colors.secondaryContent) } + .accessibilityLabel(isSecureTextVisible ? BWIL10n.textfieldHideSecret : BWIL10n.textfieldRevealSecret) .padding(.top, alignment == .top ? 8 : 0) .padding(.bottom, alignment == .bottom ? 8 : 0) .padding(.trailing, 12) diff --git a/RiotSwiftUI/Modules/Common/Util/RoundedBorderTextField.swift b/RiotSwiftUI/Modules/Common/Util/RoundedBorderTextField.swift index 6c9cf43f4..6fc4381f4 100644 --- a/RiotSwiftUI/Modules/Common/Util/RoundedBorderTextField.swift +++ b/RiotSwiftUI/Modules/Common/Util/RoundedBorderTextField.swift @@ -78,7 +78,6 @@ struct RoundedBorderTextField: View { .frame(height: 30) .allowsHitTesting(isEnabled) .opacity(isEnabled ? 1 : 0.5) - .accessibilityLabel(text.isEmpty ? placeHolder : "") } .padding(EdgeInsets(top: 8, leading: 8, bottom: 8, trailing: text.isEmpty ? 8 : 0)) .background(RoundedRectangle(cornerRadius: 8).fill(theme.colors.background)) diff --git a/RiotSwiftUI/Modules/Common/Util/ThemableTextField.swift b/RiotSwiftUI/Modules/Common/Util/ThemableTextField.swift index a179d36ab..0af47c8cc 100644 --- a/RiotSwiftUI/Modules/Common/Util/ThemableTextField.swift +++ b/RiotSwiftUI/Modules/Common/Util/ThemableTextField.swift @@ -138,6 +138,11 @@ struct ThemableTextField: UIViewRepresentable { @objc func textFieldEditingChanged(sender: UITextField) { parent.replaceText(with: sender.text ?? "") + if let text = sender.text, !text.isEmpty { + sender.accessibilityLabel = text + } else { + sender.accessibilityLabel = sender.placeholder ?? "" + } } }