[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] branch master updated (1a3d88d -> 05cf278)
From: |
gnunet |
Subject: |
[taler-taler-ios] branch master updated (1a3d88d -> 05cf278) |
Date: |
Fri, 22 Sep 2023 17:31:37 +0200 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a change to branch master
in repository taler-ios.
from 1a3d88d !!! Temporarily add back old cases to ExchangeTosStatus to be
able to run with older wallet-core version !!! Fixed missing cases - now
Exchanges can be shown again
new 5ec62a4 Xcode 14 doesn't know Swift 5.9
new 05cf278 Split view (too complex for Intel MacBook), add CallStack
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
TalerWallet1/Helper/Font+Taler.swift | 10 +-
.../Views/Balances/BalancesSectionView.swift | 167 ++++++++++++---------
.../Views/Transactions/TransactionsListView.swift | 8 +-
3 files changed, 106 insertions(+), 79 deletions(-)
diff --git a/TalerWallet1/Helper/Font+Taler.swift
b/TalerWallet1/Helper/Font+Taler.swift
index ef4e612..64e32c8 100644
--- a/TalerWallet1/Helper/Font+Taler.swift
+++ b/TalerWallet1/Helper/Font+Taler.swift
@@ -69,9 +69,9 @@ struct AccessibleFont {
var bold: Font
static var talerFont: Int {
if ProcessInfo.processInfo.environment["XCODE_RUNNING_FOR_PREVIEWS"]
== "1" {
- 3
+ return 3
} else {
- Controller.shared.talerFont
+ return Controller.shared.talerFont
}
}
@@ -255,6 +255,6 @@ struct ContentViewFonts: View {
}
}
-#Preview("Font View") {
- ContentViewFonts()
-}
+//#Preview("Font View") {
+// ContentViewFonts()
+//}
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift
b/TalerWallet1/Views/Balances/BalancesSectionView.swift
index 3bd555f..dfeffcd 100644
--- a/TalerWallet1/Views/Balances/BalancesSectionView.swift
+++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -14,7 +14,7 @@ import SymLog
/// optional: Pending Outgoing
/// optional: Suspended / Aborting / Aborted / Expired
-struct BalancesSectionView: View {
+struct BalancesSectionView {
private let symLog = SymLogV(0)
let stack: CallStack
let balance: Balance
@@ -35,51 +35,38 @@ struct BalancesSectionView: View {
return try await model.getTransactionByIdT(transactionId)
}
- func computePending(currency: String) -> (Amount, Amount) {
- var incoming = Amount(currency: currency, value: 0)
- var outgoing = Amount(currency: currency, value: 0)
- for transaction in pendingTransactions {
- let effective = transaction.common.amountEffective
- if currency == effective.currencyStr {
- do {
- if transaction.common.incoming() {
- incoming = try incoming + effective
- } else {
- outgoing = try outgoing + effective
- }
- } catch {
- // TODO: log error
- symLog.log(error.localizedDescription)
- }
- }
- }
- return (incoming, outgoing)
- }
-
@State private var sectionID = UUID()
@State private var shownSectionID = UUID() // guaranteed to be different
the first time
+ func reloadCompleted(_ stack: CallStack) async -> () {
+ let currency = balance.available.currencyStr
+ transactions = await model.transactionsT(stack.push(), currency:
currency)
+ completedTransactions = WalletModel.completedTransactions(transactions)
+// sectionID = UUID()
+ }
+
+ func reloadPending(_ stack: CallStack) async -> () {
+ let currency = balance.available.currencyStr
+ transactions = await model.transactionsT(stack.push(), currency:
currency)
+ pendingTransactions = WalletModel.pendingTransactions(transactions)
+// sectionID = UUID()
+ }
+
+ func reloadUncompleted(_ stack: CallStack) async -> () {
+ let currency = balance.available.currencyStr
+ transactions = await model.transactionsT(stack.push(), currency:
currency)
+ uncompletedTransactions =
WalletModel.uncompletedTransactions(transactions)
+// sectionID = UUID()
+ }
+}
+
+extension BalancesSectionView: View {
var body: some View {
#if DEBUG
let _ = Self._printChanges()
let _ = symLog.vlog() // just to get the # to compare it with
.onAppear & onDisappear
#endif
let currency = balance.available.currencyStr
- let reloadCompleted = {
- transactions = await model.transactionsT(stack.push(), currency:
currency)
- completedTransactions =
WalletModel.completedTransactions(transactions)
-// sectionID = UUID()
- }
- let reloadPending = {
- transactions = await model.transactionsT(stack.push(), currency:
currency)
- pendingTransactions = WalletModel.pendingTransactions(transactions)
-// sectionID = UUID()
- }
- let reloadUncompleted = {
- transactions = await model.transactionsT(stack.push(), currency:
currency)
- uncompletedTransactions =
WalletModel.uncompletedTransactions(transactions)
-// sectionID = UUID()
- }
Section {
if "KUDOS" == currency && !balance.available.isZero {
@@ -97,36 +84,12 @@ struct BalancesSectionView: View {
reloadOneAction: reloadOneAction)
let hasPending = pendingTransactions.count > 0
if hasPending {
- let (pendingIncoming, pendingOutgoing) =
computePending(currency: currency)
-
- NavigationLink {
-//let _ = print("button: Pending Transactions: \(currency)")
- LazyView {
- TransactionsListView(stack: stack.push(),
- navTitle: String(localized:
"Pending"),
- currency: currency,
- transactions: pendingTransactions,
- showUpDown: false,
- reloadAllAction: reloadPending,
- reloadOneAction: reloadOneAction)
- }
- } label: {
- VStack(spacing: 6) {
- var rows = 0
- if !pendingIncoming.isZero {
- PendingRowView(amount: pendingIncoming, incoming:
true)
- let _ = (rows+=1)
- }
- if !pendingOutgoing.isZero {
- PendingRowView(amount: pendingOutgoing, incoming:
false)
- let _ = (rows+=1)
- }
- if rows == 0 {
- Text("Some pending transactions")
- .accessibilityFont(.body)
- }
- }
- }
+ SectionPendingRowView(symLog: symLog,
+ stack: stack.push(),
+ currency: currency,
+ pendingTransactions: $pendingTransactions,
+ reloadPending: reloadPending,
+ reloadOneAction: reloadOneAction)
}
let hasUncompleted = uncompletedTransactions.count > 0
if hasUncompleted {
@@ -194,14 +157,78 @@ struct BalancesSectionView: View {
} // body
}
-fileprivate struct NavigationLinksView : View {
+fileprivate struct SectionPendingRowView: View {
+ let symLog: SymLogV?
+ let stack: CallStack
+ let currency: String
+ @Binding var pendingTransactions: [Transaction]
+ let reloadPending: (_ stack: CallStack) async -> ()
+ let reloadOneAction: ((_ transactionId: String) async throws ->
Transaction)
+
+ func computePending(currency: String) -> (Amount, Amount) {
+ var incoming = Amount(currency: currency, value: 0)
+ var outgoing = Amount(currency: currency, value: 0)
+ for transaction in pendingTransactions {
+ let effective = transaction.common.amountEffective
+ if currency == effective.currencyStr {
+ do {
+ if transaction.common.incoming() {
+ incoming = try incoming + effective
+ } else {
+ outgoing = try outgoing + effective
+ }
+ } catch {
+ // TODO: log error
+ symLog?.log(error.localizedDescription)
+ }
+ }
+ }
+ return (incoming, outgoing)
+ }
+
+ var body: some View {
+ let (pendingIncoming, pendingOutgoing) = computePending(currency:
currency)
+
+ NavigationLink {
+ //let _ = print("button: Pending Transactions: \(currency)")
+ LazyView {
+ TransactionsListView(stack: stack.push(),
+ navTitle: String(localized: "Pending"),
+ currency: currency,
+ transactions: pendingTransactions,
+ showUpDown: false,
+ reloadAllAction: reloadPending,
+ reloadOneAction: reloadOneAction)
+ }
+ } label: {
+ VStack(spacing: 6) {
+ var rows = 0
+ if !pendingIncoming.isZero {
+ PendingRowView(amount: pendingIncoming, incoming: true)
+ let _ = (rows+=1)
+ }
+ if !pendingOutgoing.isZero {
+ PendingRowView(amount: pendingOutgoing, incoming: false)
+ let _ = (rows+=1)
+ }
+ if rows == 0 {
+ Text("Some pending transactions")
+ .accessibilityFont(.body)
+ }
+ }
+ }
+
+ }
+}
+
+fileprivate struct NavigationLinksView: View {
let stack: CallStack
let balance: Balance
// let sectionCount: Int
@Binding var centsToTransfer: UInt64
@Binding var summary: String
@Binding var completedTransactions: [Transaction]
- let reloadAllAction: () async -> ()
+ let reloadAllAction: (_ stack: CallStack) async -> ()
let reloadOneAction: ((_ transactionId: String) async throws ->
Transaction)
@State private var buttonSelected: Int? = nil
@@ -248,7 +275,7 @@ fileprivate struct NavigationLinksView : View {
}
// MARK: -
#if false // model crashes
-fileprivate struct BindingViewContainer : View {
+fileprivate struct BindingViewContainer: View {
@State var centsToTransfer: UInt64 = 333
@State private var summary: String = "bla-bla"
diff --git a/TalerWallet1/Views/Transactions/TransactionsListView.swift
b/TalerWallet1/Views/Transactions/TransactionsListView.swift
index a0865a3..3548566 100644
--- a/TalerWallet1/Views/Transactions/TransactionsListView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionsListView.swift
@@ -14,7 +14,7 @@ struct TransactionsListView: View {
let currency: String
let transactions: [Transaction]
let showUpDown: Bool
- let reloadAllAction: () async -> ()
+ let reloadAllAction: (_ stack: CallStack) async -> ()
let reloadOneAction: ((_ transactionId: String) async throws ->
Transaction)
@State private var viewId = UUID()
@@ -39,7 +39,7 @@ struct TransactionsListView: View {
.listStyle(myListStyle.style).anyView
.refreshable {
symLog.log("refreshing")
- await reloadAllAction()
+ await reloadAllAction(stack.push())
}
.navigationBarItems(trailing: HStack {
if showUpDown {
@@ -64,7 +64,7 @@ struct TransactionsListView: View {
.navigationTitle(navTitle)
.task {
symLog.log(".task ")
- await reloadAllAction()
+ await reloadAllAction(stack.push())
}
.overlay {
if transactions.isEmpty {
@@ -83,7 +83,7 @@ struct TransactionsRowsView: View {
let stack: CallStack
let currency: String
let transactions: [Transaction]
-// let reloadAllAction: () async -> ()
+// let reloadAllAction: (_ stack: CallStack) async -> ()
let reloadOneAction: ((_ transactionId: String) async throws ->
Transaction)
@EnvironmentObject private var model: WalletModel
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (1a3d88d -> 05cf278),
gnunet <=