taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 845937233505f3824b8abbdec4b2d73ecc2761d1
parent 2dd71007d3ed8d6e99f183ea3f891459b4911f07
Author: Marc Stibane <marc@taler.net>
Date:   Thu, 31 Aug 2023 20:57:06 +0200

Accessibility String for Payment Sounds

Diffstat:
MTalerWallet1/Views/Settings/SettingsItem.swift | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/TalerWallet1/Views/Settings/SettingsItem.swift b/TalerWallet1/Views/Settings/SettingsItem.swift @@ -62,24 +62,30 @@ struct SettingsSpeaker: View { var description: String? var action: (_ value: Int) -> Void = {value in } + func imageName(_ value: Int) -> (String, String) { + return (value == 0) ? ("speaker.slash", String(localized:"off", comment: "Accessibility String for Payment Sounds Off")) + : (value == 1) ? ("speaker.fill", String(localized:"Taler Sounds", comment: "Accessibility String for Payment Sounds")) + : ("speaker", String(localized:"Apple Sounds", comment: "Accessibility String for Payment Sounds")) + } var body: some View { VStack { - let image = (value == 0) ? "speaker.slash" - : (value == 1) ? "speaker.fill" - : "speaker" + let image = imageName(value) HStack { Text(name) .font(.title2) Text(" ") .font(.largeTitle) Spacer() - Image(systemName: image) + Image(systemName: image.0) .font(.largeTitle) + .accessibilityLabel(image.1) .onTapGesture { if value > 0 { value = -1 + Controller.shared.playSound(1) } else { value = value + 1 + Controller.shared.playSound(value) } } }