gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 22/25: Announce


From: gnunet
Subject: [taler-taler-ios] 22/25: Announce
Date: Mon, 06 Nov 2023 20:40:29 +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 a26ecb96bacc36952265bc40fd532e1535cdb427
Author: Marc Stibane <marc@taler.net>
AuthorDate: Mon Nov 6 20:01:39 2023 +0100

    Announce
---
 TalerWallet1/Controllers/DebugViewC.swift                | 12 ++++++++++++
 TalerWallet1/Views/Exchange/ExchangeListView.swift       |  4 +++-
 TalerWallet1/Views/HelperViews/View+fitsSideBySide.swift |  9 +++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

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
@@ -5,6 +5,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'

-- 
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]