gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-ios] 13/25: Accessibility


From: gnunet
Subject: [taler-taler-ios] 13/25: Accessibility
Date: Mon, 06 Nov 2023 20:40:20 +0100

This is an automated email from the git hooks/post-receive script.

marc-stibane pushed a commit to branch master
in repository taler-ios.

commit b4e57fd906e3f4723014cbcbe5dcc715d14d0406
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Nov 4 15:35:08 2023 +0100

    Accessibility
---
 TalerWallet1/Model/Transaction.swift               | 18 ++++----
 TalerWallet1/Views/HelperViews/CopyShare.swift     |  3 ++
 .../Views/HelperViews/LaunchAnimationView.swift    |  2 +-
 TalerWallet1/Views/Main/MainView.swift             |  3 ++
 TalerWallet1/Views/Settings/AboutView.swift        |  1 +
 TalerWallet1/Views/Settings/SettingsItem.swift     | 50 ++++++++++++++--------
 .../Views/Transactions/TransactionRowView.swift    |  2 +
 7 files changed, 52 insertions(+), 27 deletions(-)

diff --git a/TalerWallet1/Model/Transaction.swift 
b/TalerWallet1/Model/Transaction.swift
index 5c9f16e..ea1e599 100644
--- a/TalerWallet1/Model/Transaction.swift
+++ b/TalerWallet1/Model/Transaction.swift
@@ -73,17 +73,17 @@ enum TransactionMajorState: String, Codable {
     var localizedState: String {
         switch self {
             case .none:      return                   "none"
-            case .pending:   return String(localized: "Pending", comment: 
"TransactionMajorState")
-            case .done:      return String(localized: "Done", comment: 
"TransactionMajorState")
-            case .aborting:  return String(localized: "Aborting", comment: 
"TransactionMajorState")
-            case .aborted:   return String(localized: "Aborted", comment: 
"TransactionMajorState")
+            case .pending:   return String(localized: "MajorState.Pending", 
defaultValue: "Pending", comment: "TransactionMajorState")
+            case .done:      return String(localized: "MajorState.Done", 
defaultValue: "Done", comment: "TransactionMajorState")
+            case .aborting:  return String(localized: "MajorState.Aborting", 
defaultValue: "Aborting", comment: "TransactionMajorState")
+            case .aborted:   return String(localized: "MajorState.Aborted", 
defaultValue: "Aborted", comment: "TransactionMajorState")
             case .suspended: return                   "Suspended"
-            case .dialog:    return String(localized: "Dialog", comment: 
"TransactionMajorState")
+            case .dialog:    return String(localized: "MajorState.Dialog", 
defaultValue: "Dialog", comment: "TransactionMajorState")
             case .suspendedAborting: return           "AbortingSuspended"
-            case .failed:    return String(localized: "Failed", comment: 
"TransactionMajorState")
-            case .expired:   return String(localized: "Expired", comment: 
"TransactionMajorState")
-            case .deleted:   return String(localized: "Deleted", comment: 
"TransactionMajorState")
-            case .unknown:   return String(localized: "Unknown", comment: 
"TransactionMajorState")
+            case .failed:    return String(localized: "MajorState.Failed", 
defaultValue: "Failed", comment: "TransactionMajorState")
+            case .expired:   return String(localized: "MajorState.Expired", 
defaultValue: "Expired", comment: "TransactionMajorState")
+            case .deleted:   return String(localized: "MajorState.Deleted", 
defaultValue: "Deleted", comment: "TransactionMajorState")
+            case .unknown:   return String(localized: "MajorState.Unknown", 
defaultValue: "Unknown", comment: "TransactionMajorState")
         }
     }
 }
diff --git a/TalerWallet1/Views/HelperViews/CopyShare.swift 
b/TalerWallet1/Views/HelperViews/CopyShare.swift
index c3825fd..078244a 100644
--- a/TalerWallet1/Views/HelperViews/CopyShare.swift
+++ b/TalerWallet1/Views/HelperViews/CopyShare.swift
@@ -23,11 +23,13 @@ struct CopyButton: View {
             if vertical {
                 VStack {
                     Image(systemName: "doc.on.doc")
+                        .accessibility(hidden: true)
                     Text("Copy", comment: "5 letters max, else abbreviate")
                 }
             } else {
                 HStack {
                     Image(systemName: "doc.on.doc")
+                        .accessibility(hidden: true)
                     Text("Copy", comment: "may be a bit longer")
                 }
             }
@@ -53,6 +55,7 @@ struct ShareButton: View {
         Button(action: shareAction) {
             HStack {
                 Image(systemName: "square.and.arrow.up")
+                    .accessibility(hidden: true)
                 Text("Share")
             }
         }
diff --git a/TalerWallet1/Views/HelperViews/LaunchAnimationView.swift 
b/TalerWallet1/Views/HelperViews/LaunchAnimationView.swift
index de4712d..afce36a 100644
--- a/TalerWallet1/Views/HelperViews/LaunchAnimationView.swift
+++ b/TalerWallet1/Views/HelperViews/LaunchAnimationView.swift
@@ -29,7 +29,7 @@ struct RotatingTaler: View {
             .scaledToFit()
             .frame(width: size, height: size)
             .rotationEffect(rotationDirection ? Angle(degrees: 0) : 
Angle(degrees: 900))
-            .accessibilityHidden(true)          // decorative logo
+            .accessibilityLabel("Taler Logo")       // decorative logo - with 
button function
             .onReceive(animationTimer) { timerValue in
                 if rotationEnabled {
                     withAnimation(.easeInOut(duration: 1.9)) {
diff --git a/TalerWallet1/Views/Main/MainView.swift 
b/TalerWallet1/Views/Main/MainView.swift
index 0edd3ef..128f214 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -178,6 +178,7 @@ extension MainView {
                 }.navigationViewStyle(.stack)
                 .tabItem {
                     Image(systemName: "chart.bar.xaxis")             // 
creditcard     system will automatically use filled variant
+                        .accessibilityLabel(balancesTitle)
                     if !iconOnly { Text(balancesTitle) }
                 }
                 .tag(Tab.balances)
@@ -190,6 +191,7 @@ extension MainView {
                 }.navigationViewStyle(.stack)
                 .tabItem {
                     Image(systemName: "building.columns")
+                        .accessibilityLabel(exchangesTitle)
                     if !iconOnly { Text(exchangesTitle) }
                 }
                 .tag(Tab.exchanges)
@@ -199,6 +201,7 @@ extension MainView {
                 }.navigationViewStyle(.stack)
                 .tabItem {
                     Image(systemName: "gear")                   // system will 
automatically use filled variant
+                        .accessibilityLabel(settingsTitle)
                     if !iconOnly { Text(settingsTitle) }
                 }
                 .tag(Tab.settings)
diff --git a/TalerWallet1/Views/Settings/AboutView.swift 
b/TalerWallet1/Views/Settings/AboutView.swift
index 8a388ac..8fcce24 100644
--- a/TalerWallet1/Views/Settings/AboutView.swift
+++ b/TalerWallet1/Views/Settings/AboutView.swift
@@ -35,6 +35,7 @@ struct AboutView: View {
                     HStack {
                         Spacer()
                         RotatingTaler(size: 100, rotationEnabled: 
$rotationEnabled)
+                            .accessibilityHint("will go to the taler.net 
website when long-pressed")
                             .onTapGesture(count: 2) {
                                 rotationEnabled.toggle()
                             }
diff --git a/TalerWallet1/Views/Settings/SettingsItem.swift 
b/TalerWallet1/Views/Settings/SettingsItem.swift
index 3524038..3368ec4 100644
--- a/TalerWallet1/Views/Settings/SettingsItem.swift
+++ b/TalerWallet1/Views/Settings/SettingsItem.swift
@@ -35,7 +35,8 @@ struct SettingsItem<Content: View>: View {
             content()
                 .accessibilityFont(.body)
         }.id(id1 == nil ? nil : id1! + "_H")
-        .padding([.bottom], 4)
+            .accessibilityElement(children: .combine)
+            .padding([.bottom], 4)
     }
 }
 // MARK: -
@@ -47,9 +48,16 @@ struct SettingsToggle: View {
     var action: () -> Void = {}
 
     var body: some View {
+        let accLabel: String = if let description {
+            name + ", " + description
+        } else {
+            name
+        }
         VStack {
             Toggle(name, isOn: $value.animation())
                 .id(id1)
+//                .accessibilityLabel(name)
+                .accessibility(sortPriority: 1)
                 .accessibilityFont(.title2)
                 .onChange(of: value) { value in
                     action()
@@ -59,9 +67,12 @@ struct SettingsToggle: View {
                 Text(desc)
                     .id(id1 == nil ? nil : id1! + "_T")
                     .frame(maxWidth: .infinity, alignment: .leading)
+                    .accessibility(sortPriority: 0)
                     .accessibilityFont(.caption)
             }
         }
+        .accessibilityElement(children: .combine)
+        .accessibilityLabel(accLabel)
         .padding([.bottom], 4)
         .id(id1 == nil ? nil : id1! + "_V")
     }
@@ -111,6 +122,7 @@ struct SettingsStyle: View {
 //                .frame(alignment: .trailing)
 //                .background(WalletColors().buttonBackColor(pressed: false, 
disabled: false))  TODO: RoundRect
         }
+        .accessibilityElement(children: .combine)
     }
 }
 // MARK: -
@@ -126,37 +138,41 @@ struct SettingsSpeaker: View {
                             : ("speaker", String(localized:"Apple Sounds", 
comment: "Accessibility String for Payment Sounds"))
     }
     var body: some View {
+        let image = imageName(value)
+        let accLabel = name + ", " + image.1
+        let accHint = description ?? ""
+
         VStack {
-            let image = imageName(value)
             HStack {
                 Text(name)
                     .accessibilityFont(.title2)
                 Text(verbatim: " ")
                     .accessibilityFont(.largeTitle)
                 Spacer()
-                Image(systemName: image.0)
-                    .accessibilityFont(.largeTitle)
-                    .accessibilityLabel(image.1)
-                    .onTapGesture {
-                        if value > 0 {
-                            value = -1
-                            Controller.shared.playSound(1)
-                        } else {
-                            value = value + 1
-                            Controller.shared.playSound(value)
-                        }
+                Button {
+                    if value > 0 {
+                        value = -1
+                        Controller.shared.playSound(1)
+                    } else {
+                        value = value + 1
+                        Controller.shared.playSound(value)
                     }
+                } label: {
+                    Image(systemName: image.0)
+                        .accessibilityFont(.largeTitle)
+                }
             }
-//                .onChange(of: value) { value in
-//                    action(value)
-//                }
 
             if let desc = description {
                 Text(desc)
                     .frame(maxWidth: .infinity, alignment: .leading)
                     .accessibilityFont(.caption)
             }
-        }.padding([.bottom], 4)
+        }
+        .accessibilityElement(children: .combine)
+        .accessibilityLabel(accLabel)
+        .accessibilityHint(accHint)
+        .padding([.bottom], 4)
     }
 }
 // MARK: -
diff --git a/TalerWallet1/Views/Transactions/TransactionRowView.swift 
b/TalerWallet1/Views/Transactions/TransactionRowView.swift
index 0c63c5c..9b6f897 100644
--- a/TalerWallet1/Views/Transactions/TransactionRowView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionRowView.swift
@@ -96,6 +96,8 @@ struct TransactionRowView: View {
                     TransactionRowContentV(centerTop: 
transaction.localizedType,
                                            centerBottom: dateString, 
isHorizontal: true, incoming: incoming, foreColor: foreColor)
                 }
+                    .accessibilityElement(children: .combine)
+                    .accessibilityHint("will go to detail view")
             }
         }
     }

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]