[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 172/204: a11y for tabBar
From: |
gnunet |
Subject: |
[taler-taler-ios] 172/204: a11y for tabBar |
Date: |
Thu, 05 Dec 2024 23:52: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 8339b5a3a65ebf53ff0d23a68393a274e3e0fc49
Author: Marc Stibane <marc@taler.net>
AuthorDate: Tue Nov 26 08:43:59 2024 +0100
a11y for tabBar
---
TalerWallet1/Views/Main/MainView.swift | 57 ++++++++++++++++++++++------------
1 file changed, 37 insertions(+), 20 deletions(-)
diff --git a/TalerWallet1/Views/Main/MainView.swift
b/TalerWallet1/Views/Main/MainView.swift
index 3b9d500..d1515bc 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -152,20 +152,12 @@ struct MainView: View {
} // body
}
// MARK: - TabBar
-enum Tab: String, Hashable, CaseIterable {
- case balances
+enum Tab: Int, Hashable, CaseIterable {
+ case balances = 0
case actions
-// case overview
case settings
- var index: Int {
- switch self {
- case .balances: return 0
- case .actions: return 1
-// case .overview: return 1
- case .settings: return 2
- }
- }
+// var index: Int { self.rawValue }
var title: String {
switch self {
@@ -188,6 +180,23 @@ enum Tab: String, Hashable, CaseIterable {
}
}
+ var a11y: String {
+ switch self {
+ case .balances: return BALANCES //
"chart.bar.xaxis"
+ case .actions: return "bolt"
+ case .settings: return SETTINGS // "gear"
+ }
+ }
+
+ var label: Label<Text, Image> {
+ Label(self)
+ }
+}
+
+extension Label where Title == Text, Icon == Image {
+ init(_ tab: Tab) {
+ self.init(EMPTYSTRING, systemImage: tab.a11y)
+ }
}
// MARK: - Content
@@ -264,8 +273,6 @@ extension MainView {
switch tappedTab {
case .balances:
ViewState.shared.popToRootView(nil)
-// case .exchanges:
-// ViewState2.shared.popToRootView(nil)
default:
break
}
@@ -287,6 +294,7 @@ extension MainView {
private static func className() -> String {"\(self)"}
private static var name: String { Self.className() }
+
var body: some View {
#if PRINT_CHANGES
// "@self" marks that the view value itself has changed, and
"@identity" marks that the
@@ -344,6 +352,12 @@ extension MainView {
NavLink(7, $navModel.actionSelected) { depositDest }
NavLink(8, $navModel.actionSelected) { manualWithdrawDest }
}
+ let a11yBalanceTab = Label(Tab.balances).labelStyle(.titleOnly)
+ .accessibilityLabel(Tab.balances.title)
// "Balances"
+ let a11yActionsTab = Label(Tab.actions).labelStyle(.titleOnly)
+ .accessibilityLabel(Tab.actions.title)
// "Actions"
+ let a11ySettingsTab = Label(Tab.settings).labelStyle(.titleOnly)
+ .accessibilityLabel(Tab.settings.title)
// "Settings"
ZStack(alignment: .bottom) {
TabView(selection: tabSelection()) {
NavigationView {
@@ -354,23 +368,26 @@ extension MainView {
.navigationTitle(balancesTitle)
.background(balanceActions)
}.id(viewState.rootViewId) // any change to
rootViewId triggers popToRootView behaviour
- .navigationViewStyle(.stack)
- .tag(Tab.balances)
+ .navigationViewStyle(.stack)
+ .tag(Tab.balances)
+ .tabItem { a11yBalanceTab }
- EmptyView().tag(Tab.actions)
+ Color.clear
+ .tag(Tab.actions)
+ .tabItem { a11yActionsTab }
NavigationView {
SettingsView(stack: stack.push(),
navTitle: settingsTitle)
.background(settingsActions)
}.id(viewState2.rootViewId) // any change to
rootViewId triggers popToRootView behaviour
- .navigationViewStyle(.stack)
- .tag(Tab.settings)
+ .navigationViewStyle(.stack)
+ .tag(Tab.settings)
+ .tabItem { a11ySettingsTab }
} // TabView
-// .ignoresSafeArea(.keyboard, edges: .bottom)
-// .padding(.bottom, 10)
tabBarView
.ignoresSafeArea(.keyboard, edges: .bottom)
+ .accessibilityHidden(true) // for a11y we use
the original tabBar, not our custom one
} // ZStack
.frame(maxWidth: .infinity, maxHeight: .infinity)
.onNotification(.SendAction) { triggerAction(1) }
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 162/204: KnownBankAccounts, (continued)
- [taler-taler-ios] 162/204: KnownBankAccounts, gnunet, 2024/12/05
- [taler-taler-ios] 159/204: getTransactionById, gnunet, 2024/12/05
- [taler-taler-ios] 178/204: remove etag, gnunet, 2024/12/05
- [taler-taler-ios] 148/204: dismiss only if done, gnunet, 2024/12/05
- [taler-taler-ios] 146/204: smaller tx icon in lists, gnunet, 2024/12/05
- [taler-taler-ios] 156/204: fix button position, gnunet, 2024/12/05
- [taler-taler-ios] 168/204: wording, gnunet, 2024/12/05
- [taler-taler-ios] 170/204: cleanup, gnunet, 2024/12/05
- [taler-taler-ios] 169/204: debug, gnunet, 2024/12/05
- [taler-taler-ios] 138/204: recvDisabled, gnunet, 2024/12/05
- [taler-taler-ios] 172/204: a11y for tabBar,
gnunet <=
- [taler-taler-ios] 173/204: update after +, gnunet, 2024/12/05
- [taler-taler-ios] 174/204: only in debug mode, gnunet, 2024/12/05
- [taler-taler-ios] 176/204: cleanup, comments, gnunet, 2024/12/05
- [taler-taler-ios] 179/204: Bump version to 0.13.8 (0.13.13), gnunet, 2024/12/05
- [taler-taler-ios] 180/204: Comparable, gnunet, 2024/12/05
- [taler-taler-ios] 181/204: don't update if same data, gnunet, 2024/12/05
- [taler-taler-ios] 188/204: regional exchange baseURL, gnunet, 2024/12/05
- [taler-taler-ios] 182/204: L10N helper, gnunet, 2024/12/05
- [taler-taler-ios] 184/204: don't add to knownBankAccounts, gnunet, 2024/12/05
- [taler-taler-ios] 190/204: timeToPay w.i.p., gnunet, 2024/12/05