gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 08/18: cleanup


From: gnunet
Subject: [taler-taler-ios] 08/18: cleanup
Date: Thu, 15 Feb 2024 07:02:08 +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 716cf1fe27ccf01acdb47e36e6a24b24407342b4
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sun Feb 11 22:37:11 2024 +0100

    cleanup
---
 TalerWallet1/Backend/WalletBackendRequest.swift    |  1 +
 TalerWallet1/Model/Transaction.swift               | 55 +++++++++++++++-------
 TalerWallet1/Views/Banking/ManualWithdraw.swift    |  2 +-
 .../Views/Transactions/ThreeAmountsV.swift         | 20 ++++----
 4 files changed, 49 insertions(+), 29 deletions(-)

diff --git a/TalerWallet1/Backend/WalletBackendRequest.swift 
b/TalerWallet1/Backend/WalletBackendRequest.swift
index 124e855..73dd9ec 100644
--- a/TalerWallet1/Backend/WalletBackendRequest.swift
+++ b/TalerWallet1/Backend/WalletBackendRequest.swift
@@ -31,6 +31,7 @@ struct ScopeInfo: Codable, Hashable {
         case auditor
     }
     var type: ScopeInfoType
+    var hasNoFees: Bool?        // only for "global". Regional have this field 
per Exchange
     var url: String?            // only for "exchange"
     var currency: String        // 3-char ISO 4217 code for global currency. 
Regional MUST be >= 4 letters
 
diff --git a/TalerWallet1/Model/Transaction.swift 
b/TalerWallet1/Model/Transaction.swift
index 31bd873..58b9f2c 100644
--- a/TalerWallet1/Model/Transaction.swift
+++ b/TalerWallet1/Model/Transaction.swift
@@ -228,6 +228,25 @@ struct TransactionCommon: Decodable, Sendable {
     var txActions: [TxAction]
     var kycUrl: String?
 
+    var isPending       : Bool { txState.major == .pending }
+    var isPendingReady  : Bool { isPending && txState.minor == .ready }
+    var isPendingKYC    : Bool { isPending && txState.minor == .kyc }
+    var isDone          : Bool { txState.major == .done }
+    var isAborting      : Bool { txState.major == .aborting }
+    var isAborted       : Bool { txState.major == .aborted }
+    var isSuspended     : Bool { txState.major == .suspended }
+    var isDialog        : Bool { txState.major == .dialog }
+    var isAbSuspended   : Bool { txState.major == .suspendedAborting }
+    var isFailed        : Bool { txState.major == .failed }
+    var isExpired       : Bool { txState.major == .expired }
+
+    var isAbortable     : Bool { txActions.contains(.abort) }
+    var isFailable      : Bool { txActions.contains(.fail) }
+    var isDeleteable    : Bool { txActions.contains(.delete) }
+    var isRetryable     : Bool { txActions.contains(.retry) }
+    var isResumable     : Bool { txActions.contains(.resume) }
+    var isSuspendable   : Bool { txActions.contains(.suspend) }
+
     func localizedType(_ type: TransactionType) -> String {
         switch type {
             case .dummy:          return String("")
@@ -514,24 +533,24 @@ enum Transaction: Decodable, Hashable, Identifiable, 
Sendable {
     var isP2pOutgoing: Bool { isSendCoins || isPayInvoice}
     var isP2pIncoming: Bool { isSendInvoice || isRcvCoins}
 
-    var isPending    : Bool { common.txState.major == .pending }
-    var isPendingReady : Bool { isPending && common.txState.minor == .ready }
-    var isPendingKYC   : Bool { isPending && common.txState.minor == .kyc }
-    var isDone       : Bool { common.txState.major == .done }
-    var isAborting   : Bool { common.txState.major == .aborting }
-    var isAborted    : Bool { common.txState.major == .aborted }
-    var isSuspended  : Bool { common.txState.major == .suspended }
-    var isDialog     : Bool { common.txState.major == .dialog }
-    var isAbSuspended: Bool { common.txState.major == .suspendedAborting }
-    var isFailed     : Bool { common.txState.major == .failed }
-    var isExpired    : Bool { common.txState.major == .expired }
-
-    var isAbortable  : Bool { common.txActions.contains(.abort) }
-    var isFailable   : Bool { common.txActions.contains(.fail) }
-    var isDeleteable : Bool { common.txActions.contains(.delete) }
-    var isRetryable  : Bool { common.txActions.contains(.retry) }
-    var isResumable  : Bool { common.txActions.contains(.resume) }
-    var isSuspendable: Bool { common.txActions.contains(.suspend) }
+    var isPending       : Bool { common.isPending }
+    var isPendingReady  : Bool { common.isPendingReady }
+    var isPendingKYC    : Bool { common.isPendingKYC }
+    var isDone          : Bool { common.isDone }
+    var isAborting      : Bool { common.isAborting }
+    var isAborted       : Bool { common.isAborted }
+    var isSuspended     : Bool { common.isSuspended }
+    var isDialog        : Bool { common.isDialog }
+    var isAbSuspended   : Bool { common.isAbSuspended }
+    var isFailed        : Bool { common.isFailed }
+    var isExpired       : Bool { common.isExpired }
+
+    var isAbortable     : Bool { common.isAbortable }
+    var isFailable      : Bool { common.isFailable }
+    var isDeleteable    : Bool { common.isDeleteable }
+    var isRetryable     : Bool { common.isRetryable }
+    var isResumable     : Bool { common.isResumable }
+    var isSuspendable   : Bool { common.isSuspendable }
 
     var shouldConfirm: Bool {
         switch self {
diff --git a/TalerWallet1/Views/Banking/ManualWithdraw.swift 
b/TalerWallet1/Views/Banking/ManualWithdraw.swift
index db25eee..d95e3ab 100644
--- a/TalerWallet1/Views/Banking/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Banking/ManualWithdraw.swift
@@ -6,7 +6,7 @@ import SwiftUI
 import taler_swift
 import SymLog
 
-// Will be called by either the user tapping "Withdraw Coins" in the exchange 
list
+// Will be called by either the user tapping "Withdraw Coins" in the exchanges 
list
 // or from WithdrawExchangeV after a withdraw-exchange QR was scanned
 struct ManualWithdraw: View {
     private let symLog = SymLogV(0)
diff --git a/TalerWallet1/Views/Transactions/ThreeAmountsV.swift 
b/TalerWallet1/Views/Transactions/ThreeAmountsV.swift
index c9665bc..50456ff 100644
--- a/TalerWallet1/Views/Transactions/ThreeAmountsV.swift
+++ b/TalerWallet1/Views/Transactions/ThreeAmountsV.swift
@@ -22,8 +22,8 @@ struct ThreeAmountsSheet: View {
         let effective = common.amountEffective
         let fee = common.fee()
         let incoming = common.incoming()
-        let pending = (common.txState.major == .pending)
-        let isDone = (common.txState.major == .done)
+        let pending = common.isPending
+        let isDone = common.isDone
         let incomplete = !(isDone || pending)
 
         let defaultBottomTitle  = incoming ? (pending ? String(localized: 
"Pending amount to obtain:")
@@ -53,10 +53,10 @@ struct ThreeAmountsV: View {
     var topTitle: String
     var topAbbrev: String
     var topAmount: Amount
-    var fee: Amount?
+    var fee: Amount?                        // nil = don't show fee line, zero 
= no fee for this tx
     var bottomTitle: String
     var bottomAbbrev: String
-    var bottomAmount: Amount?
+    var bottomAmount: Amount?               // nil = incomplete (aborted, 
timed out)
     let large: Bool
     let pending: Bool
     let incoming: Bool
@@ -111,13 +111,13 @@ struct ThreeAmountsV: View {
                     Text(minimalistic ? "Payment provider:" : "Using payment 
service provider:")
                         .multilineTextAlignment(.leading)
                         .talerFont(.body)
-                        Text(baseURL.trimURL())
+                    Text(baseURL.trimURL())
                         .frame(maxWidth: .infinity, alignment: .trailing)
-                            .multilineTextAlignment(.center)
-                            .talerFont(large ? .title3 : .body)
-//                          .fontWeight(large ? .medium : .regular)  // 
@available(iOS 16.0, *)
-                            .foregroundColor(labelColor)
-                    }
+                        .multilineTextAlignment(.center)
+                        .talerFont(large ? .title3 : .body)
+//                        .fontWeight(large ? .medium : .regular)  // 
@available(iOS 16.0, *)
+                        .foregroundColor(labelColor)
+                }
                 .padding(.top, 4)
                 .frame(maxWidth: .infinity, alignment: .leading)
                 .listRowSeparator(.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]