gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 10/16: Debugging


From: gnunet
Subject: [taler-taler-ios] 10/16: Debugging
Date: Thu, 29 Feb 2024 17:19:17 +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 d6e2f8425dd0f904c5af1302e862fcfa9703f676
Author: Marc Stibane <marc@taler.net>
AuthorDate: Thu Feb 29 13:58:42 2024 +0100

    Debugging
---
 TalerWallet1/Backend/WalletCore.swift              |  9 ++---
 TalerWallet1/Views/Balances/BalanceRowView.swift   | 15 +++++----
 TalerWallet1/Views/Balances/TwoRowButtons.swift    | 39 ++++++++++++----------
 TalerWallet1/Views/Banking/DepositAmountV.swift    |  2 +-
 TalerWallet1/Views/Banking/DepositIbanV.swift      |  2 +-
 TalerWallet1/Views/Banking/ExchangeRowView.swift   | 15 +++++----
 TalerWallet1/Views/Banking/ManualWithdraw.swift    |  2 +-
 TalerWallet1/Views/HelperViews/AmountInputV.swift  |  4 +--
 TalerWallet1/Views/HelperViews/Buttons.swift       |  4 +--
 TalerWallet1/Views/HelperViews/SelectDays.swift    |  9 +++--
 TalerWallet1/Views/HelperViews/SubjectInputV.swift |  2 +-
 TalerWallet1/Views/Peer2peer/P2PSubjectV.swift     |  2 +-
 TalerWallet1/Views/Peer2peer/RequestPayment.swift  |  2 +-
 13 files changed, 58 insertions(+), 49 deletions(-)

diff --git a/TalerWallet1/Backend/WalletCore.swift 
b/TalerWallet1/Backend/WalletCore.swift
index d251897..7467fac 100644
--- a/TalerWallet1/Backend/WalletCore.swift
+++ b/TalerWallet1/Backend/WalletCore.swift
@@ -102,20 +102,21 @@ extension WalletCore {
         if let walletError = decoded.error {            // wallet-core sent an 
error message
             do {
                 let jsonData = try JSONEncoder().encode(walletError)
+                logger.error("wallet-core sent back an error for request 
\(requestId, privacy: .public)")
+                symLog.log("id:\(requestId)  \(walletError)")
+                // TODO: decode jsonData to WalletBackendResponseError - or 
HTTPError
+                completion(requestId, timeSent, jsonData, 
WalletCore.walletError())
             } catch {        // JSON encoding of response.result failed / 
should never happen
                 symLog.log(decoded)
                 logger.error("cannot encode wallet-core Error")
                 // TODO: show error alert
                 completion(requestId, timeSent, nil, 
WalletCore.parseFailureError())
             }
-            // TODO: decode jsonData to WalletBackendResponseError - or 
HTTPError
-            logger.error("wallet-core sent back an error for request 
\(requestId, privacy: .public)")
-//            completion(requestId, timeSent, nil, walletError)
-            completion(requestId, timeSent, nil, 
WalletCore.parseFailureError())
         } else {                                        // JSON decoding of 
error message failed
             completion(requestId, timeSent, nil, 
WalletCore.parseFailureError())
         }
     }
+
     private func handleResponse(_ decoded: ResponseOrNotification) throws {
         guard let requestId = decoded.id else {
             logger.error("didn't find requestId in response")
diff --git a/TalerWallet1/Views/Balances/BalanceRowView.swift 
b/TalerWallet1/Views/Balances/BalanceRowView.swift
index ac15ea2..ca0bd58 100644
--- a/TalerWallet1/Views/Balances/BalanceRowView.swift
+++ b/TalerWallet1/Views/Balances/BalanceRowView.swift
@@ -90,13 +90,14 @@ struct BalanceRowView: View {
 
             let sendTitle = minimalistic ? sendTitle0 : sendTitle1
             let requTitle = minimalistic ? requestTitle0 : requestTitle1
-            let twoRowButtons = TwoRowButtons(sendTitle: sendTitle,
-                                              recvTitle: requTitle,
-                                         fitsSideBySide: false,
-                                              lineLimit: 5,
-                                           sendDisabled: amount.isZero,
-                                             sendAction: sendAction,
-                                             recvAction: recvAction)
+            let twoRowButtons = TwoRowButtons(stack: stack.push(),
+                                          sendTitle: sendTitle,
+                                          recvTitle: requTitle,
+                                     fitsSideBySide: false,
+                                          lineLimit: 5,
+                                       sendDisabled: amount.isZero,
+                                         sendAction: sendAction,
+                                         recvAction: recvAction)
             if #available(iOS 16.0, *) {
                 ViewThatFits(in: .horizontal) {
                     HStack(spacing: HSPACING) {
diff --git a/TalerWallet1/Views/Balances/TwoRowButtons.swift 
b/TalerWallet1/Views/Balances/TwoRowButtons.swift
index f057936..d9c0713 100644
--- a/TalerWallet1/Views/Balances/TwoRowButtons.swift
+++ b/TalerWallet1/Views/Balances/TwoRowButtons.swift
@@ -6,6 +6,7 @@ import SwiftUI
 import taler_swift
 
 struct TwoRowButtons: View {
+    let stack: CallStack
     let sendTitle: String
     let recvTitle: String
     let fitsSideBySide: Bool
@@ -16,13 +17,14 @@ struct TwoRowButtons: View {
 
 //    @Environment(\.sizeCategory) var sizeCategory
     func makeCopy(fitsSideBySide: Bool) -> TwoRowButtons {
-        TwoRowButtons(sendTitle: sendTitle,
-                      recvTitle: recvTitle,
-                 fitsSideBySide: fitsSideBySide,
-                      lineLimit: lineLimit,
-                   sendDisabled: sendDisabled,
-                     sendAction: sendAction,
-                     recvAction: recvAction)
+        TwoRowButtons(stack: stack.push(),
+                  sendTitle: sendTitle,
+                  recvTitle: recvTitle,
+             fitsSideBySide: fitsSideBySide,
+                  lineLimit: lineLimit,
+               sendDisabled: sendDisabled,
+                 sendAction: sendAction,
+                 recvAction: recvAction)
     }
 
     var body: some View {
@@ -35,6 +37,7 @@ struct TwoRowButtons: View {
                 .disabled(sendDisabled)
                 .buttonStyle(TalerButtonStyle(type: .bordered,
                                             dimmed: false,
+                                          disabled: sendDisabled,
                                            aligned: .center))
             let recvButtonTitle = recvTitle.tabbed(oneLine: !fitsSideBySide)
             let recvVoiceOverTitle = recvTitle.tabbed(oneLine: true)
@@ -53,17 +56,19 @@ struct TwoRowButtons: View {
 struct TwoRowButtons_Previews: PreviewProvider {
     static var previews: some View {
         List {
-                TwoRowButtons(sendTitle: "Send " + TESTCURRENCY,
-                              recvTitle: "Request" + LONGCURRENCY,
-                          fitsSideBySide: false,
-                               lineLimit: 2, sendDisabled: true,
-                              sendAction: {}, recvAction: {})
+            TwoRowButtons(stack: CallStack("Preview"),
+                      sendTitle: "Send " + TESTCURRENCY,
+                      recvTitle: "Request " + LONGCURRENCY,
+                 fitsSideBySide: false,
+                      lineLimit: 2, sendDisabled: true,
+                     sendAction: {}, recvAction: {})
                 .listRowSeparator(.hidden)
-                TwoRowButtons(sendTitle: "Send" + DEMOCURRENCY,
-                              recvTitle: "Request" + DEMOCURRENCY,
-                          fitsSideBySide: true,
-                               lineLimit: 2, sendDisabled: true,
-                              sendAction: {}, recvAction: {})
+            TwoRowButtons(stack: CallStack("Preview"),
+                      sendTitle: "Send " + DEMOCURRENCY,
+                      recvTitle: "Request " + DEMOCURRENCY,
+                 fitsSideBySide: true,
+                      lineLimit: 2, sendDisabled: true,
+                     sendAction: {}, recvAction: {})
                 .listRowSeparator(.hidden)
         }
     }
diff --git a/TalerWallet1/Views/Banking/DepositAmountV.swift 
b/TalerWallet1/Views/Banking/DepositAmountV.swift
index 0635481..5358d0a 100644
--- a/TalerWallet1/Views/Banking/DepositAmountV.swift
+++ b/TalerWallet1/Views/Banking/DepositAmountV.swift
@@ -134,7 +134,7 @@ struct DepositAmountV: View {
                         }
                     }
                 }
-                .buttonStyle(TalerButtonStyle(type: .prominent))
+                .buttonStyle(TalerButtonStyle(type: .prominent, disabled: 
disabled || depositStarted))
                 .disabled(disabled || depositStarted)
                 .accessibilityHint(disabled ? "enabled when amount is 
non-zero, but not higher than your available amount" : EMPTYSTRING)
             }.padding(.horizontal) } // ScrollVStack
diff --git a/TalerWallet1/Views/Banking/DepositIbanV.swift 
b/TalerWallet1/Views/Banking/DepositIbanV.swift
index 3ce33c4..6b6fc9c 100644
--- a/TalerWallet1/Views/Banking/DepositIbanV.swift
+++ b/TalerWallet1/Views/Banking/DepositIbanV.swift
@@ -112,7 +112,7 @@ struct DepositIbanV: View {
             NavigationLink(destination: destination) {
                 Text(buttonTitle(amountToTransfer, currencyInfo))
             }
-                .buttonStyle(TalerButtonStyle(type: .prominent))
+            .buttonStyle(TalerButtonStyle(type: .prominent, disabled: 
disabled))
                 .disabled(disabled)
                 .accessibilityHint(disabled ? "enabled when account holder and 
IBAN are set" : EMPTYSTRING)
         }.padding(.horizontal) } // ScrollVStack
diff --git a/TalerWallet1/Views/Banking/ExchangeRowView.swift 
b/TalerWallet1/Views/Banking/ExchangeRowView.swift
index c147fae..3edc3e8 100644
--- a/TalerWallet1/Views/Banking/ExchangeRowView.swift
+++ b/TalerWallet1/Views/Banking/ExchangeRowView.swift
@@ -79,13 +79,14 @@ struct ExchangeRowView: View {
                      acceptAction: nil)         // pop back to here
         }
         let disableDeposit = false     // TODO: availableAmount.isZero
-        let twoRowButtons = TwoRowButtons(sendTitle: minimalistic ? 
depositTitle0 : depositTitle1,
-                                          recvTitle: minimalistic ? 
withdrawTitle0 : withdrawTitle1,
-                                     fitsSideBySide: false,
-                                          lineLimit: 5,
-                                       sendDisabled: disableDeposit,
-                                         sendAction: { selectAndUpdate(1) },
-                                         recvAction: { selectAndUpdate(2) })
+        let twoRowButtons = TwoRowButtons(stack: stack.push(),
+                                      sendTitle: minimalistic ? depositTitle0 
: depositTitle1,
+                                      recvTitle: minimalistic ? withdrawTitle0 
: withdrawTitle1,
+                                 fitsSideBySide: false,
+                                      lineLimit: 5,
+                                   sendDisabled: disableDeposit,
+                                     sendAction: { selectAndUpdate(1) },
+                                     recvAction: { selectAndUpdate(2) })
         Group {
             NavigationLink(destination: showToS) {
                 VStack(alignment: .leading) {
diff --git a/TalerWallet1/Views/Banking/ManualWithdraw.swift 
b/TalerWallet1/Views/Banking/ManualWithdraw.swift
index 5c7a3d4..b4a3efb 100644
--- a/TalerWallet1/Views/Banking/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Banking/ManualWithdraw.swift
@@ -76,7 +76,7 @@ struct ManualWithdraw: View {
                     NavigationLink(destination: destination) {
                         Text("Confirm Withdrawal")      // VIEW_WITHDRAW_ACCEPT
                     }
-                    .buttonStyle(TalerButtonStyle(type: .prominent))
+                    .buttonStyle(TalerButtonStyle(type: .prominent, disabled: 
disabled))
                     .disabled(disabled)
                     .padding(.top)
                 } else {
diff --git a/TalerWallet1/Views/HelperViews/AmountInputV.swift 
b/TalerWallet1/Views/HelperViews/AmountInputV.swift
index 80c4d98..2b542af 100644
--- a/TalerWallet1/Views/HelperViews/AmountInputV.swift
+++ b/TalerWallet1/Views/HelperViews/AmountInputV.swift
@@ -90,13 +90,13 @@ struct AmountInputV: View {
                     NavigationLink(destination: destination) {
                         Text("Next")
                     }
-                    .buttonStyle(TalerButtonStyle(type: .prominent))
+                    .buttonStyle(TalerButtonStyle(type: .prominent, disabled: 
disabled))
                     .disabled(disabled)
                 } else {
                     Button("Next") {
                         buttonAction()
                     }
-                        .buttonStyle(TalerButtonStyle(type: .prominent))
+                        .buttonStyle(TalerButtonStyle(type: .prominent, 
disabled: disabled))
                         .disabled(disabled)
                 }
             }
diff --git a/TalerWallet1/Views/HelperViews/Buttons.swift 
b/TalerWallet1/Views/HelperViews/Buttons.swift
index 6a01913..53530ca 100644
--- a/TalerWallet1/Views/HelperViews/Buttons.swift
+++ b/TalerWallet1/Views/HelperViews/Buttons.swift
@@ -92,9 +92,6 @@ struct ReloadButton : View  {
 }
 
 struct TalerButtonStyle: ButtonStyle {
-    @Environment(\.isEnabled) private var isEnabled: Bool
-    var disabled: Bool { !isEnabled }
-
     enum TalerButtonStyleType {
         case plain
         case balance
@@ -104,6 +101,7 @@ struct TalerButtonStyle: ButtonStyle {
     var type: TalerButtonStyleType = .plain
     var dimmed: Bool = false
     var narrow: Bool = false
+    var disabled: Bool = false
     var aligned: TextAlignment = .center
     var badge: String = EMPTYSTRING
 
diff --git a/TalerWallet1/Views/HelperViews/SelectDays.swift 
b/TalerWallet1/Views/HelperViews/SelectDays.swift
index 3e49a07..ba8383d 100644
--- a/TalerWallet1/Views/HelperViews/SelectDays.swift
+++ b/TalerWallet1/Views/HelperViews/SelectDays.swift
@@ -47,7 +47,8 @@ struct SelectDays: View {
                     } else {
                         Text("\(ONEDAY) Day", comment: "1 Day, might get 
plural (e.g. 2..3 Days), 4 letters max., abbreviate if longer")     // TODO: 
Plural
                     }
-                }.buttonStyle(TalerButtonStyle(type: (selected == ONEDAY) ? 
.prominent : .bordered, dimmed: true))
+                }.buttonStyle(TalerButtonStyle(type: (selected == ONEDAY) ? 
.prominent : .bordered,
+                                             dimmed: true, disabled: 
!isEnabled))
                     .accessibilityAddTraits(selected == ONEDAY ? .isSelected : 
[])
                     .disabled(!isEnabled)
 
@@ -57,7 +58,8 @@ struct SelectDays: View {
                     } else {
                         Text("\(SEVENDAYS) Days", comment: "7 Days, always 
plural (3..9), 4 letters max., abbreviate if longer")
                     }
-                }.buttonStyle(TalerButtonStyle(type: (selected == SEVENDAYS) ? 
.prominent : .bordered, dimmed: true))
+                }.buttonStyle(TalerButtonStyle(type: (selected == SEVENDAYS) ? 
.prominent : .bordered, dimmed: true,
+                                              disabled: !isEnabled || 
maxExpiration < SEVENDAYS))
                     .accessibilityAddTraits(selected == SEVENDAYS ? 
.isSelected : [])
                     .disabled(!isEnabled || maxExpiration < SEVENDAYS)
 
@@ -67,7 +69,8 @@ struct SelectDays: View {
                     } else {
                         Text("\(THIRTYDAYS) Days", comment: "30 Days, always 
plural (10..30), 4 letters max., abbreviate if longer")
                     }
-                }.buttonStyle(TalerButtonStyle(type: (selected == THIRTYDAYS) 
? .prominent : .bordered, dimmed: true))
+                }.buttonStyle(TalerButtonStyle(type: (selected == THIRTYDAYS) 
? .prominent : .bordered, dimmed: true,
+                                              disabled: !isEnabled || 
maxExpiration < THIRTYDAYS))
                     .accessibilityAddTraits(selected == THIRTYDAYS ? 
.isSelected : [])
                     .disabled(!isEnabled || maxExpiration < THIRTYDAYS)
             } // 3 buttons
diff --git a/TalerWallet1/Views/HelperViews/SubjectInputV.swift 
b/TalerWallet1/Views/HelperViews/SubjectInputV.swift
index 66c73f1..56135f8 100644
--- a/TalerWallet1/Views/HelperViews/SubjectInputV.swift
+++ b/TalerWallet1/Views/HelperViews/SubjectInputV.swift
@@ -112,7 +112,7 @@ struct SubjectInputV<TargetView: View>: View {
                 .padding(4)
 
             NavigationLink("Next", destination: targetView)
-                .buttonStyle(TalerButtonStyle(type: .prominent))
+                .buttonStyle(TalerButtonStyle(type: .prominent, disabled: 
disabled))
                 .disabled(disabled)
 //                .accessibility(sortPriority: 0)
         }.padding(.horizontal)
diff --git a/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift 
b/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift
index 4e601bb..6982490 100644
--- a/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift
+++ b/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift
@@ -118,7 +118,7 @@ struct P2PSubjectV: View {
                 }) {
                     Text(buttonTitle(amountToTransfer, currencyInfo))
                 }
-                .buttonStyle(TalerButtonStyle(type: .prominent))
+                .buttonStyle(TalerButtonStyle(type: .prominent, disabled: 
disabled))
                 .disabled(disabled)
                 .accessibilityHint(disabled ? "enabled when subject and 
expiration are set" : EMPTYSTRING)
         }.padding(.horizontal) } // ScrollVStack
diff --git a/TalerWallet1/Views/Peer2peer/RequestPayment.swift 
b/TalerWallet1/Views/Peer2peer/RequestPayment.swift
index b37109f..90a5bc8 100644
--- a/TalerWallet1/Views/Peer2peer/RequestPayment.swift
+++ b/TalerWallet1/Views/Peer2peer/RequestPayment.swift
@@ -85,7 +85,7 @@ struct RequestPayment: View {
                         currencyInfo: currencyInfo,
                      amountEffective: peerPullCheck?.amountEffective)
             NavigationLink(destination: inputDestination) { Text("Next") }
-                .buttonStyle(TalerButtonStyle(type: .prominent))
+                .buttonStyle(TalerButtonStyle(type: .prominent, disabled: 
disabled))
                 .disabled(disabled)
                 .background(NavigationLink(destination: shortcutDestination, 
isActive: $buttonSelected)
                             { EmptyView() }.frame(width: 0).opacity(0).hidden()

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