summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Stibane <marc@taler.net>2023-11-06 20:25:34 +0100
committerMarc Stibane <marc@taler.net>2023-11-06 20:25:34 +0100
commitd9f33be08939c82a56f51cb3a2ec43d82f3f9633 (patch)
tree0b4640d1a2ff7e2dcf6926bec81bedf5397c2ffc
parent63fa5d3c0d2db7bd39a2c0220745c962282dffed (diff)
downloadtaler-ios-d9f33be08939c82a56f51cb3a2ec43d82f3f9633.tar.gz
taler-ios-d9f33be08939c82a56f51cb3a2ec43d82f3f9633.tar.bz2
taler-ios-d9f33be08939c82a56f51cb3a2ec43d82f3f9633.zip
Accessibility: Contrast
-rw-r--r--TalerWallet1/Views/Balances/BalanceRowView.swift5
-rw-r--r--TalerWallet1/Views/Balances/BalancesSectionView.swift2
-rw-r--r--TalerWallet1/Views/HelperViews/AmountRowV.swift8
-rw-r--r--TalerWallet1/Views/HelperViews/BarGraph.swift2
-rw-r--r--TalerWallet1/Views/Settings/SettingsView.swift3
-rw-r--r--TalerWallet1/Views/Transactions/TransactionDetailView.swift5
6 files changed, 22 insertions, 3 deletions
diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift b/TalerWallet1/Views/Balances/BalanceRowView.swift
index a9b4b3a..2fb15ae 100644
--- a/TalerWallet1/Views/Balances/BalanceRowView.swift
+++ b/TalerWallet1/Views/Balances/BalanceRowView.swift
@@ -11,6 +11,8 @@ struct BalanceButton: View {
let rowAction: () -> Void
@AppStorage("iconOnly") var iconOnly: Bool = false
+ @Environment(\.colorSchemeContrast) private var colorSchemeContrast
+// @AppStorage("moreContrast") var moreContrast: Bool = false
var body: some View {
let balanceTitleStr = String(localized: "Balance:", comment: "Main view")
@@ -27,7 +29,8 @@ struct BalanceButton: View {
fitsHorizontal: fitsSideBySide, vertAlignment: .lastTextBaseline) {
Text(title)
.accessibilityFont(.title2)
- .foregroundColor(.secondary)
+ .foregroundColor(colorSchemeContrast == .increased ? .primary : .secondary)
+// .foregroundColor(moreContrast ? .primary : .secondary)
}
}
}
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift
index 7acdb48..d0a3718 100644
--- a/TalerWallet1/Views/Balances/BalancesSectionView.swift
+++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -22,6 +22,7 @@ struct BalancesSectionView {
@Binding var centsToTransfer: UInt64
@Binding var summary: String
+// @AppStorage("moreContrast") var moreContrast: Bool = false
@AppStorage("iconOnly") var iconOnly: Bool = false
@EnvironmentObject private var model: WalletModel
@EnvironmentObject private var controller: Controller
@@ -143,6 +144,7 @@ extension BalancesSectionView: View {
if !iconOnly {
Text("Recent transactions")
.accessibilityFont(.callout)
+// .foregroundColor(moreContrast ? .primary : .secondary)
}
}
}
diff --git a/TalerWallet1/Views/HelperViews/AmountRowV.swift b/TalerWallet1/Views/HelperViews/AmountRowV.swift
index 59b7c10..ac741f9 100644
--- a/TalerWallet1/Views/HelperViews/AmountRowV.swift
+++ b/TalerWallet1/Views/HelperViews/AmountRowV.swift
@@ -49,6 +49,8 @@ struct AmountRowV<Content: View>: View {
struct SectionWithAmountRow: View {
@Environment(\.sizeCategory) var sizeCategory
+ @Environment(\.colorSchemeContrast) private var colorSchemeContrast
+
var body: some View {
let testInfo = PreviewCurrencyInfo(TESTCURRENCY, digits: 0)
let demoInfo = PreviewCurrencyInfo(DEMOCURRENCY, digits: 2)
@@ -61,23 +63,27 @@ struct SectionWithAmountRow: View {
AmountRowV(amountStr: demoStr, amountColor: .primary, largeAmountFont: true,
fitsHorizontal: true, vertAlignment: .lastTextBaseline) {
Text(verbatim: "Balance")
+ .foregroundColor(colorSchemeContrast == .increased ? .primary : .secondary)
.accessibilityFont(.title2)
}
AmountRowV(amountStr: demoStr, amountColor: .primary, largeAmountFont: true,
fitsHorizontal: false, vertAlignment: .lastTextBaseline) {
Text(verbatim: "Balance")
+ .foregroundColor(colorSchemeContrast == .increased ? .primary : .secondary)
.accessibilityFont(.title2)
}
}
Section {
- AmountRowV(amountStr: testStr, amountColor: .secondary, largeAmountFont: false,
+ AmountRowV(amountStr: testStr, amountColor: .primary, largeAmountFont: false,
fitsHorizontal: true, vertAlignment: .lastTextBaseline) {
Text(verbatim: "Balance")
+ .foregroundColor(colorSchemeContrast == .increased ? .primary : .secondary)
.accessibilityFont(.title2)
}
AmountRowV(amountStr: testStr, amountColor: .secondary, largeAmountFont: false,
fitsHorizontal: false, vertAlignment: .lastTextBaseline) {
Text(verbatim: "Balance")
+ .foregroundColor(colorSchemeContrast == .increased ? .primary : .secondary)
.accessibilityFont(.title2)
}
}
diff --git a/TalerWallet1/Views/HelperViews/BarGraph.swift b/TalerWallet1/Views/HelperViews/BarGraph.swift
index dd66634..9eb61dc 100644
--- a/TalerWallet1/Views/HelperViews/BarGraph.swift
+++ b/TalerWallet1/Views/HelperViews/BarGraph.swift
@@ -12,6 +12,7 @@ struct BarGraphHeader: View {
let stack: CallStack
let currency: String
+// @AppStorage("moreContrast") var moreContrast: Bool = false
@EnvironmentObject private var model: WalletModel
@State private var completedTransactions: [Transaction] = []
@@ -19,6 +20,7 @@ struct BarGraphHeader: View {
HStack (alignment: .center, spacing: 10) {
Text(currency)
.accessibilityFont(.title2)
+// .foregroundColor(moreContrast ? .primary : .secondary)
BarGraph(transactions: $completedTransactions,
maxBars: MAXBARS, barHeight: 10) // TODO: barHeight relative to fontSize
}
diff --git a/TalerWallet1/Views/Settings/SettingsView.swift b/TalerWallet1/Views/Settings/SettingsView.swift
index 17d0186..40abcc2 100644
--- a/TalerWallet1/Views/Settings/SettingsView.swift
+++ b/TalerWallet1/Views/Settings/SettingsView.swift
@@ -28,6 +28,7 @@ struct SettingsView: View {
#else
@AppStorage("developerMode") var developerMode: Bool = false
#endif
+// @AppStorage("moreContrast") var moreContrast: Bool = false
@AppStorage("useHaptics") var useHaptics: Bool = true
@AppStorage("playSounds") var playSounds: Int = 1
@AppStorage("talerFont") var talerFont: Int = 0
@@ -101,6 +102,8 @@ struct SettingsView: View {
SettingsItem(name: aboutStr, id1: "about",
description: hideDescriptions ? nil : String(localized: "More info about this app...")) {}
}
+// SettingsToggle(name: String(localized: "More Contrast"), value: $moreContrast, id1: "contrast",
+// description: hideDescriptions ? nil : String(localized: "If you don't like grey"))
if controller.hapticCapability.supportsHaptics {
SettingsToggle(name: String(localized: "Haptics"), value: $useHaptics, id1: "haptics",
description: hideDescriptions ? nil : String(localized: "Vibration Feedback"))
diff --git a/TalerWallet1/Views/Transactions/TransactionDetailView.swift b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
index bae70f2..aca9ae8 100644
--- a/TalerWallet1/Views/Transactions/TransactionDetailView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
@@ -25,11 +25,13 @@ struct TransactionDetailView: View {
private let symLog = SymLogV(0)
let stack: CallStack
@AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
+// @AppStorage("moreContrast") var moreContrast: Bool = false
#if DEBUG
@AppStorage("developerMode") var developerMode: Bool = true
#else
@AppStorage("developerMode") var developerMode: Bool = false
#endif
+ @Environment(\.colorSchemeContrast) private var colorSchemeContrast
let transactionId: String
let reloadAction: ((_ transactionId: String) async throws -> Transaction)
@@ -80,7 +82,8 @@ struct TransactionDetailView: View {
Text(dateString)
.accessibilityFont(.body)
.accessibilityLabel(accessibilityDate)
- .foregroundColor(.secondary)
+ .foregroundColor(colorSchemeContrast == .increased ? .primary : .secondary)
+// .foregroundColor(moreContrast ? .primary : .secondary)
.listRowSeparator(.hidden)
HStack {
Text(verbatim: "|") // only reason for this leading-aligned text is to get a nice full length listRowSeparator