gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 25/40: Use BalancesPendingRowV


From: gnunet
Subject: [taler-taler-ios] 25/40: Use BalancesPendingRowV
Date: Mon, 22 Jul 2024 22:46:18 +0200

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 d45acb380ea57321ed9dccfc9f17a8b347d563c4
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Jul 20 05:54:50 2024 +0200

    Use BalancesPendingRowV
---
 .../Views/Balances/BalancesSectionView.swift       | 68 +++------------------
 TalerWallet1/Views/Overview/OverviewSectionV.swift | 70 +++-------------------
 2 files changed, 15 insertions(+), 123 deletions(-)

diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift 
b/TalerWallet1/Views/Balances/BalancesSectionView.swift
index e987633..fbe1e34 100644
--- a/TalerWallet1/Views/Balances/BalancesSectionView.swift
+++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -92,12 +92,13 @@ extension BalancesSectionView: View {
                                reloadOneAction: reloadOneAction,
                                   cameraAction: cameraAction)
             if pendingTransactions.count > 0 {
-                BalancesPendingRowView(symLog: symLog,
-                                        stack: stack.push(),
-                                      balance: balance,
-                          pendingTransactions: $pendingTransactions,
-                                reloadPending: reloadPending,
-                              reloadOneAction: reloadOneAction)
+                BalancesPendingRowV(//symLog: symLog,
+                                     stack: stack.push(),
+                              currencyInfo: currencyInfo,
+                                   balance: balance,
+                       pendingTransactions: $pendingTransactions,
+                             reloadPending: reloadPending,
+                           reloadOneAction: reloadOneAction)
                     .padding(.leading, ICONLEADING)
             }
             let showSpendingButton = DEMOCURRENCY == currency && 
!balance.available.isZero
@@ -180,61 +181,6 @@ extension BalancesSectionView: View {
     } // body
 } // BalancesSectionView
 // MARK: -
-fileprivate struct BalancesPendingRowView: View {
-    let symLog: SymLogV?
-    let stack: CallStack
-    let balance: Balance
-    @Binding var pendingTransactions: [Transaction]
-    let reloadPending: (_ stack: CallStack) async -> ()
-    let reloadOneAction: ((_ transactionId: String, _ viewHandles: Bool) async 
throws -> Transaction)
-
-    var body: some View {
-        let pendingIncoming = balance.pendingIncoming
-        let pendingOutgoing = balance.pendingOutgoing
-        let needsKYCin = balance.flags.contains(.incomingKyc)
-        let needsKYCout = balance.flags.contains(.outgoingKyc)
-        let shouldConfirm = balance.flags.contains(.incomingConfirmation)
-
-        NavigationLink {
-            //let _ = print("button: Pending Transactions: \(currency)")
-            LazyView {
-                TransactionsListView(stack: stack.push(),
-                                  navTitle: String(localized: "Pending", 
comment: "ViewTitle of TransactionList"),
-                                 scopeInfo: balance.scopeInfo,
-                              transactions: pendingTransactions,
-                           reloadAllAction: reloadPending,
-                           reloadOneAction: reloadOneAction)
-            }
-        } label: {
-            let needsKYC =  needsKYCin || needsKYCout
-            let needsKYCStr = String(localized: ". Needs K Y C", comment: 
"VoiceOver")
-            let needsConfStr = String(localized: ". Needs bank confirmation", 
comment: "VoiceOver")
-            VStack(spacing: 6) {
-                let hasIncoming = !pendingIncoming.isZero
-                if hasIncoming {
-                    PendingRowView(amount: pendingIncoming, incoming: true,
-                            shouldConfirm: shouldConfirm, needsKYC: needsKYCin)
-                }
-                let hasOutgoing = !pendingOutgoing.isZero
-                if hasOutgoing {
-                    PendingRowView(amount: pendingOutgoing, incoming: false,
-                            shouldConfirm: false, needsKYC: needsKYCout)
-                }
-                if !hasIncoming && !hasOutgoing {           // should never 
happen
-                    Text("Some pending transactions")
-                        .talerFont(.body)
-                }
-            }
-            .accessibilityElement(children: .combine)
-            .accessibilityValue(needsKYC && shouldConfirm ? needsKYCStr + 
needsConfStr :
-                                                 needsKYC ? needsKYCStr :
-                                            shouldConfirm ? needsConfStr
-                                                          : EMPTYSTRING)
-            .accessibilityHint(String(localized: "Will go to Pending 
transactions."))
-        } // NavLinkLabel
-    } // body
-} // BalancesPendingRowView
-
 fileprivate struct BalancesNavigationLinksView: View {
     let symLog: SymLogV?
     let stack: CallStack
diff --git a/TalerWallet1/Views/Overview/OverviewSectionV.swift 
b/TalerWallet1/Views/Overview/OverviewSectionV.swift
index 9a72fcd..a0fe23e 100644
--- a/TalerWallet1/Views/Overview/OverviewSectionV.swift
+++ b/TalerWallet1/Views/Overview/OverviewSectionV.swift
@@ -87,12 +87,13 @@ extension OverviewSectionV: View {
                                reloadAllAction: reloadCompleted,
                                reloadOneAction: reloadOneAction)
             if pendingTransactions.count > 0 {
-                CurrenciesPendingRowV(symLog: symLog,
-                                        stack: stack.push(),
-                                      balance: balance,
-                          pendingTransactions: $pendingTransactions,
-                                reloadPending: reloadPending,
-                              reloadOneAction: reloadOneAction)
+                BalancesPendingRowV(//symLog: symLog,
+                                    stack: stack.push(),
+                             currencyInfo: currencyInfo,
+                                  balance: balance,
+                      pendingTransactions: $pendingTransactions,
+                            reloadPending: reloadPending,
+                          reloadOneAction: reloadOneAction)
                     .padding(.leading, ICONLEADING)
             }
         } header: {
@@ -136,63 +137,8 @@ extension OverviewSectionV: View {
             }
         } // recent transactions
     } // body
-} // BalancesSectionView
+} // OverviewSectionV
 // MARK: -
-fileprivate struct CurrenciesPendingRowV: View {
-    let symLog: SymLogV?
-    let stack: CallStack
-    let balance: Balance                            // this is the currency to 
be used
-    @Binding var pendingTransactions: [Transaction]
-    let reloadPending: (_ stack: CallStack) async -> ()
-    let reloadOneAction: ((_ transactionId: String, _ viewHandles: Bool) async 
throws -> Transaction)
-
-    var body: some View {
-        let pendingIncoming = balance.pendingIncoming
-        let pendingOutgoing = balance.pendingOutgoing
-        let needsKYCin = balance.flags.contains(.incomingKyc)
-        let needsKYCout = balance.flags.contains(.outgoingKyc)
-        let shouldConfirm = balance.flags.contains(.incomingConfirmation)
-
-        NavigationLink {
-            //let _ = print("button: Pending Transactions: \(currency)")
-            LazyView {
-                TransactionsListView(stack: stack.push(),
-                                  navTitle: String(localized: "Pending", 
comment: "ViewTitle of TransactionList"),
-                                 scopeInfo: balance.scopeInfo,
-                              transactions: pendingTransactions,
-                           reloadAllAction: reloadPending,
-                           reloadOneAction: reloadOneAction)
-            }
-        } label: {
-            let needsKYC =  needsKYCin || needsKYCout
-            let needsKYCStr = String(localized: ". Needs K Y C", comment: 
"VoiceOver")
-            let needsConfStr = String(localized: ". Needs bank authorization", 
comment: "VoiceOver")
-            VStack(spacing: 6) {
-                let hasIncoming = !pendingIncoming.isZero
-                if hasIncoming {
-                    PendingRowView(amount: pendingIncoming, incoming: true,
-                            shouldConfirm: shouldConfirm, needsKYC: needsKYCin)
-                }
-                let hasOutgoing = !pendingOutgoing.isZero
-                if hasOutgoing {
-                    PendingRowView(amount: pendingOutgoing, incoming: false,
-                            shouldConfirm: false, needsKYC: needsKYCout)
-                }
-                if !hasIncoming && !hasOutgoing {           // should never 
happen
-                    Text("Some pending transactions")
-                        .talerFont(.body)
-                }
-            }
-            .accessibilityElement(children: .combine)
-            .accessibilityValue(needsKYC && shouldConfirm ? needsKYCStr + 
needsConfStr :
-                                                 needsKYC ? needsKYCStr :
-                                            shouldConfirm ? needsConfStr
-                                                          : EMPTYSTRING)
-            .accessibilityHint(String(localized: "Will go to Pending 
transactions."))
-        } // NavLinkLabel
-    } // body
-} // CurrenciesPendingRowV
-
 fileprivate struct CurrenciesNavigationLinksV: View {
     let symLog: SymLogV?
     let stack: CallStack

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