summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Stibane <marc@taler.net>2023-11-06 20:01:39 +0100
committerMarc Stibane <marc@taler.net>2023-11-06 20:01:39 +0100
commita26ecb96bacc36952265bc40fd532e1535cdb427 (patch)
tree8b3207d8f9f7ae9c104b135717dbb117d3b691e5
parent0fcd73c0d2a2788138e92b18ae2fc128620e3d6b (diff)
downloadtaler-ios-a26ecb96bacc36952265bc40fd532e1535cdb427.tar.gz
taler-ios-a26ecb96bacc36952265bc40fd532e1535cdb427.tar.bz2
taler-ios-a26ecb96bacc36952265bc40fd532e1535cdb427.zip
Announce
-rw-r--r--TalerWallet1/Controllers/DebugViewC.swift12
-rw-r--r--TalerWallet1/Views/Exchange/ExchangeListView.swift4
-rw-r--r--TalerWallet1/Views/HelperViews/View+fitsSideBySide.swift9
3 files changed, 24 insertions, 1 deletions
diff --git a/TalerWallet1/Controllers/DebugViewC.swift b/TalerWallet1/Controllers/DebugViewC.swift
index 9680f8f..50cbdca 100644
--- a/TalerWallet1/Controllers/DebugViewC.swift
+++ b/TalerWallet1/Controllers/DebugViewC.swift
@@ -127,6 +127,10 @@ struct DebugViewV: View {
.foregroundColor(.red)
.font(.system(size: 11)) // no accessibilityFont
.monospacedDigit()
+ .id("viewID")
+ .accessibilityLabel(Text("View.ID.", comment: "AccessibilityLabel"))
+ .accessibilityValue(viewIDString)
+ .accessibilityHint("Shows which view you currently are on.")
Spacer()
}
.edgesIgnoringSafeArea(.top)
@@ -146,13 +150,21 @@ class DebugViewC: ObservableObject {
@Published var viewID: Int = 0
@Published var sheetID: Int = 0
+ func announce(this: String) {
+ if UIAccessibility.isVoiceOverRunning {
+ UIAccessibility.post(notification: .screenChanged, argument: this)
+ }
+ }
+
@MainActor func setViewID(_ newID: Int, stack: CallStack) -> Void {
if developerMode {
if viewID == 0 {
logger.log("switching ON, \(newID, privacy: .public)")
viewID = newID // publish ON
+ announce(this: "Current view is: \(newID).")
} else if viewID != newID {
logger.log("switching from \(self.viewID, privacy: .public) to \(newID, privacy: .public)")
+ announce(this: "View switched from \(self.viewID) to \(newID).")
viewID = newID // publish new viewID
} else {
logger.log("\(newID, privacy: .public) stays")
diff --git a/TalerWallet1/Views/Exchange/ExchangeListView.swift b/TalerWallet1/Views/Exchange/ExchangeListView.swift
index a809168..cc1d987 100644
--- a/TalerWallet1/Views/Exchange/ExchangeListView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeListView.swift
@@ -26,6 +26,7 @@ struct ExchangeListView: View {
do {
try await model.addExchange(url: exchange)
symLog.log("added: \(exchange)")
+ announce(this: "added: \(exchange)")
} catch { // TODO: error handling - couldn't add exchangeURL
symLog.log("error: \(error)")
}
@@ -50,9 +51,10 @@ struct ExchangeListView: View {
.navigationBarItems(leading: hamburger, trailing: plusButton)
.alert(addTitleStr, isPresented: $showAlert) {
TextField("Exchange address", text: $newExchange)
+// .textFieldStyle(.roundedBorder) Yikes: when adding style the alert will stop showing the textfield! Don't do this.
Button(addButtonStr) {
addExchange(newExchange)
- }.buttonStyle(.borderedProminent)
+ }
Button("Cancel", role: .cancel) { }
} message: {
Text("Please enter the exchange URL")
diff --git a/TalerWallet1/Views/HelperViews/View+fitsSideBySide.swift b/TalerWallet1/Views/HelperViews/View+fitsSideBySide.swift
index a76011c..fa4ca83 100644
--- a/TalerWallet1/Views/HelperViews/View+fitsSideBySide.swift
+++ b/TalerWallet1/Views/HelperViews/View+fitsSideBySide.swift
@@ -6,6 +6,15 @@ import SwiftUI
import UIKit
extension View {
+ @MainActor
+ public func announce(this: String) {
+ if UIAccessibility.isVoiceOverRunning {
+ UIAccessibility.post(notification: .screenChanged, argument: this)
+ }
+ }
+}
+
+extension View {
/// if sameSize then this searches for the longest title
/// returns true if any of the strings in 'titles' wouldn't fit in a view 1/'numViews' of the size of 'width', with 'spacing'
/// if !sameSize then all titles are added with spacing