[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 24/28: more CallStack debugging
From: |
gnunet |
Subject: |
[taler-taler-ios] 24/28: more CallStack debugging |
Date: |
Tue, 19 Sep 2023 03:44:43 +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 f1ee0e8d8c542c64b2f8eba2a3626c6018e6ee1b
Author: Marc Stibane <marc@taler.net>
AuthorDate: Tue Sep 19 01:55:50 2023 +0200
more CallStack debugging
---
TalerWallet1/Helper/CallStack.swift | 8 +--
TalerWallet1/Model/Model+Transactions.swift | 6 +-
TalerWallet1/Views/Balances/BalancesListView.swift | 22 +++---
.../Views/Balances/BalancesSectionView.swift | 84 ++++++++++++----------
TalerWallet1/Views/Exchange/ExchangeListView.swift | 13 ++--
.../Views/Exchange/ExchangeSectionView.swift | 14 ++--
TalerWallet1/Views/Exchange/ManualWithdraw.swift | 15 ++--
.../Views/Exchange/ManualWithdrawDone.swift | 25 ++++---
TalerWallet1/Views/Main/MainView.swift | 13 ++--
TalerWallet1/Views/Payment/PayTemplateView.swift | 1 +
TalerWallet1/Views/Payment/PaymentView.swift | 3 +-
TalerWallet1/Views/Peer2peer/PaymentPurpose.swift | 9 ++-
TalerWallet1/Views/Peer2peer/RequestPayment.swift | 12 ++--
TalerWallet1/Views/Peer2peer/SendAmount.swift | 19 ++---
TalerWallet1/Views/Peer2peer/SendDone.swift | 29 ++++----
TalerWallet1/Views/Peer2peer/SendPurpose.swift | 9 ++-
.../Views/Sheets/P2P_Sheets/P2pAcceptDone.swift | 24 ++++---
.../Views/Sheets/P2P_Sheets/P2pPayURIView.swift | 6 +-
.../Sheets/P2P_Sheets/P2pReceiveURIView.swift | 6 +-
TalerWallet1/Views/Sheets/QRSheet.swift | 3 +-
TalerWallet1/Views/Sheets/URLSheet.swift | 11 +--
.../Views/Transactions/TransactionDetailView.swift | 1 +
.../Views/Transactions/TransactionsListView.swift | 22 +++---
.../WithdrawAcceptDone.swift | 25 ++++---
.../WithdrawBankIntegrated/WithdrawURIView.swift | 5 +-
25 files changed, 226 insertions(+), 159 deletions(-)
diff --git a/TalerWallet1/Helper/CallStack.swift
b/TalerWallet1/Helper/CallStack.swift
index 8eb3352..fb5d0ec 100644
--- a/TalerWallet1/Helper/CallStack.swift
+++ b/TalerWallet1/Helper/CallStack.swift
@@ -39,10 +39,10 @@ extension CallStackItem: Equatable {
struct CallStack {
- private var storage = [CallStackItem]()
- func peek() -> CallStackItem? { storage.first }
+ private var stack = [CallStackItem]()
+ func peek() -> CallStackItem? { stack.first }
func push(item: CallStackItem) -> CallStack {
- return CallStack(storage: [item] + storage)
+ return CallStack(stack: [item] + stack)
}
}
@@ -60,7 +60,7 @@ extension CallStack {
filePath: String = #file,
line: UInt = #line) {
let item = CallStackItem(file: filePath2Name(filePath) + ":\(line)",
function: funcName, message: message)
- self.storage = [item]
+ self.stack = [item]
}
#else
init(_ message: String = "") {
diff --git a/TalerWallet1/Model/Model+Transactions.swift
b/TalerWallet1/Model/Model+Transactions.swift
index 0795255..f3fb35b 100644
--- a/TalerWallet1/Model/Model+Transactions.swift
+++ b/TalerWallet1/Model/Model+Transactions.swift
@@ -108,7 +108,7 @@ struct ResumeTransaction: WalletBackendFormattedRequest {
// MARK: -
extension WalletModel {
/// ask wallet-core for its list of transactions filtered by searchString
- func transactionsT(currency: String? = nil, searchString: String? = nil)
+ func transactionsT(_ stack: CallStack, currency: String? = nil,
searchString: String? = nil)
async -> [Transaction] { // might
be called from a background thread itself
do {
let request = GetTransactions(currency: currency, search:
searchString)
@@ -119,9 +119,9 @@ extension WalletModel {
}
}
/// fetch transactions from Wallet-Core. No networking involved
- @MainActor func transactionsMA(currency: String? = nil, searchString:
String? = nil)
+ @MainActor func transactionsMA(_ stack: CallStack, currency: String? =
nil, searchString: String? = nil)
async -> [Transaction] { // M for MainActor
- return await transactionsT(currency: currency, searchString:
searchString)
+ return await transactionsT(stack.push(), currency: currency,
searchString: searchString)
}
/// abort the specified transaction from Wallet-Core. No networking
involved
diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift
b/TalerWallet1/Views/Balances/BalancesListView.swift
index 75d1ce8..f1b091e 100644
--- a/TalerWallet1/Views/Balances/BalancesListView.swift
+++ b/TalerWallet1/Views/Balances/BalancesListView.swift
@@ -9,9 +9,9 @@ import AVFoundation
/// This view shows the list of balances / currencies, each in its own section
struct BalancesListView: View {
- private let symLog = SymLogV(0)
- let navTitle: String
+ private let symLog = SymLogV()
let stack: CallStack
+ let navTitle: String
let hamburgerAction: () -> Void
@EnvironmentObject private var model: WalletModel
@@ -71,10 +71,11 @@ struct BalancesListView: View {
}
/// runs on MainActor if called in some Task {}
+ @discardableResult
private func reloadAction(_ stack: CallStack) async -> Int {
let reloaded = await model.balancesM(stack.push())
let count = reloaded.count
- balances = reloaded
+ balances = reloaded // redraw
return count
}
@@ -93,8 +94,8 @@ struct BalancesListView: View {
if balances.isEmpty {
WalletEmptyView()
.refreshable { // already async
- symLog.log("refreshing")
- let count = await reloadAction(stack.push())
+ symLog.log("empty refreshing")
+ let count = await reloadAction(stack.push("empty
refreshing"))
if count > 0 {
// postNotificationM(.BalanceReloaded)
NotificationCenter.default.post(name:
.BalanceReloaded, object: nil)
@@ -111,12 +112,12 @@ struct BalancesListView: View {
DebugViewC.shared.setViewID(VIEW_BALANCES)
}
.sheet(isPresented: $showQRScanner) {
- let sheet = AnyView(QRSheet())
+ let sheet = AnyView(QRSheet(stack: stack.push()))
Sheet(sheetView: sheet)
} // sheet
.task {
symLog.log(".task getBalances")
- _ = await reloadAction(stack.push(".task getBalances"))
+ await reloadAction(stack.push(".task"))
} // task
}
}
@@ -129,6 +130,7 @@ extension BalancesListView {
@Binding var balances: [Balance]
@Binding var centsToTransfer: UInt64
@Binding var summary: String
+// @discardableResult
var reloadAction: (_ stack: CallStack) async -> Int
@State private var isActive = true
@@ -150,7 +152,7 @@ extension BalancesListView {
}
.refreshable { // already async
symLog?.log("refreshing")
- let count = await reloadAction(stack.push())
+ let count = await reloadAction(stack.push("refreshing"))
if count > 0 {
// postNotificationM(.BalanceReloaded)
NotificationCenter.default.post(name:
.BalanceReloaded, object: nil)
@@ -163,7 +165,7 @@ extension BalancesListView {
if shouldReload {
shouldReload = false
symLog?.log(".onAppear ==> shouldReload was true,
reloading now")
- Task { await reloadAction(stack.push()) } // runs on
MainActor
+ Task { await reloadAction(stack.push("shouldReload")) } //
runs on MainActor
}
}
.onDisappear() {
@@ -174,7 +176,7 @@ extension BalancesListView {
// doesn't need to be received on main thread because we just
reload in a background task anyway
if isActive {
symLog?.log(".onNotification(.BalanceChange) ==> reload")
- Task { await reloadAction(stack.push()) }
+ Task { await reloadAction(stack.push(".BalanceChange")) }
} else {
symLog?.log(".onNotification(.BalanceChange) ==> reload
postponed, shouldReload = true")
shouldReload = true
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift
b/TalerWallet1/Views/Balances/BalancesSectionView.swift
index b2788bc..3bd555f 100644
--- a/TalerWallet1/Views/Balances/BalancesSectionView.swift
+++ b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -66,17 +66,17 @@ struct BalancesSectionView: View {
#endif
let currency = balance.available.currencyStr
let reloadCompleted = {
- transactions = await model.transactionsT(currency: currency)
+ transactions = await model.transactionsT(stack.push(), currency:
currency)
completedTransactions =
WalletModel.completedTransactions(transactions)
// sectionID = UUID()
}
let reloadPending = {
- transactions = await model.transactionsT(currency: currency)
+ transactions = await model.transactionsT(stack.push(), currency:
currency)
pendingTransactions = WalletModel.pendingTransactions(transactions)
// sectionID = UUID()
}
let reloadUncompleted = {
- transactions = await model.transactionsT(currency: currency)
+ transactions = await model.transactionsT(stack.push(), currency:
currency)
uncompletedTransactions =
WalletModel.uncompletedTransactions(transactions)
// sectionID = UUID()
}
@@ -87,13 +87,14 @@ struct BalancesSectionView: View {
.accessibilityFont(.body)
.multilineTextAlignment(.leading)
}
- NavigationLinksView(balance: balance,
- centsToTransfer: $centsToTransfer,
- summary: $summary,
-// buttonSelected: $buttonSelected,
- completedTransactions: $completedTransactions,
- reloadAllAction: reloadCompleted,
- reloadOneAction: reloadOneAction)
+ NavigationLinksView(stack: stack.push(),
+ balance: balance,
+ centsToTransfer: $centsToTransfer,
+ summary: $summary,
+// buttonSelected: $buttonSelected,
+ completedTransactions: $completedTransactions,
+ reloadAllAction: reloadCompleted,
+ reloadOneAction: reloadOneAction)
let hasPending = pendingTransactions.count > 0
if hasPending {
let (pendingIncoming, pendingOutgoing) =
computePending(currency: currency)
@@ -101,11 +102,13 @@ struct BalancesSectionView: View {
NavigationLink {
//let _ = print("button: Pending Transactions: \(currency)")
LazyView {
- TransactionsListView(navTitle: String(localized:
"Pending"), currency: currency,
- transactions: pendingTransactions,
- showUpDown: false,
- reloadAllAction: reloadPending,
- reloadOneAction: reloadOneAction)
+ TransactionsListView(stack: stack.push(),
+ navTitle: String(localized:
"Pending"),
+ currency: currency,
+ transactions: pendingTransactions,
+ showUpDown: false,
+ reloadAllAction: reloadPending,
+ reloadOneAction: reloadOneAction)
}
} label: {
VStack(spacing: 6) {
@@ -130,12 +133,13 @@ struct BalancesSectionView: View {
NavigationLink {
//let _ = print("button: Uncompleted Transactions: \(currency)")
LazyView {
- TransactionsListView(navTitle: String(localized:
"Uncompleted"),
- currency: currency,
- transactions: uncompletedTransactions,
- showUpDown: false,
- reloadAllAction: reloadUncompleted,
- reloadOneAction: reloadOneAction)
+ TransactionsListView(stack: stack.push(),
+ navTitle: String(localized:
"Uncompleted"),
+ currency: currency,
+ transactions: uncompletedTransactions,
+ showUpDown: false,
+ reloadAllAction: reloadUncompleted,
+ reloadOneAction: reloadOneAction)
}
} label: {
UncompletedRowView(uncompletedTransactions:
$uncompletedTransactions)
@@ -151,8 +155,8 @@ struct BalancesSectionView: View {
}.id(sectionID)
.task {
// if shownSectionID != sectionID {
- symLog.log("task for BalancesSectionView \(sectionID) - reload
Transactions")
- let response = await model.transactionsT(currency: currency)
+ symLog.log("task for \(sectionID) - reload Transactions")
+ let response = await model.transactionsT(stack.push("task for
\(sectionID) - reload Transactions"), currency: currency)
transactions = response
pendingTransactions = WalletModel.pendingTransactions(response)
uncompletedTransactions =
WalletModel.uncompletedTransactions(response)
@@ -178,9 +182,10 @@ struct BalancesSectionView: View {
let slice = sortedTransactions.prefix(3)
let threeTransactions = Array(slice)
TransactionsRowsView(symLog: symLog,
- currency: currency,
- transactions: threeTransactions,
- reloadOneAction: reloadOneAction)
+ stack: stack.push(),
+ currency: currency,
+ transactions: threeTransactions,
+ reloadOneAction: reloadOneAction)
} header: {
Text("Recent transactions")
.accessibilityFont(.callout)
@@ -190,6 +195,7 @@ struct BalancesSectionView: View {
}
fileprivate struct NavigationLinksView : View {
+ let stack: CallStack
let balance: Balance
// let sectionCount: Int
@Binding var centsToTransfer: UInt64
@@ -204,25 +210,29 @@ fileprivate struct NavigationLinksView : View {
let currency = balance.available.currencyStr
HStack(spacing: 0) {
NavigationLink(destination: LazyView {
- SendAmount(amountAvailable: balance.available,
- centsToTransfer: $centsToTransfer,
- summary: $summary)
+ SendAmount(stack: stack.push(),
+ amountAvailable: balance.available,
+ centsToTransfer: $centsToTransfer,
+ summary: $summary)
}, tag: 1, selection: $buttonSelected
) { EmptyView() }.frame(width: 0).opacity(0).hidden() //
SendAmount
NavigationLink(destination: LazyView {
- RequestPayment(scopeInfo: balance.scopeInfo,
- centsToTransfer: $centsToTransfer,
- summary: $summary)
+ RequestPayment(stack: stack.push(),
+ scopeInfo: balance.scopeInfo,
+ centsToTransfer: $centsToTransfer,
+ summary: $summary)
}, tag: 2, selection: $buttonSelected
) { EmptyView() }.frame(width: 0).opacity(0).hidden() //
RequestPayment
NavigationLink(destination: LazyView {
- TransactionsListView(navTitle: String(localized:
"Transactions"), currency: currency,
- transactions: completedTransactions,
- showUpDown: true,
- reloadAllAction: reloadAllAction,
- reloadOneAction: reloadOneAction)
+ TransactionsListView(stack: stack.push(),
+ navTitle: String(localized: "Transactions"),
+ currency: currency,
+ transactions: completedTransactions,
+ showUpDown: true,
+ reloadAllAction: reloadAllAction,
+ reloadOneAction: reloadOneAction)
}, tag: 3, selection: $buttonSelected
) { EmptyView() }.frame(width: 0).opacity(0).hidden() //
TransactionsListView
diff --git a/TalerWallet1/Views/Exchange/ExchangeListView.swift
b/TalerWallet1/Views/Exchange/ExchangeListView.swift
index efb2024..3d1a1f2 100644
--- a/TalerWallet1/Views/Exchange/ExchangeListView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeListView.swift
@@ -9,6 +9,7 @@ import SymLog
/// This view shows the list of exchanges
struct ExchangeListView: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let navTitle: String
var hamburgerAction: () -> Void
@@ -50,9 +51,10 @@ struct ExchangeListView: View {
//Text("Exchanges...")
Content(symLog: symLog,
- exchanges: $exchanges,
- centsToTransfer: $centsToTransfer,
- reloadAction: reloadAction)
+ stack: stack.push(),
+ exchanges: $exchanges,
+ centsToTransfer: $centsToTransfer,
+ reloadAction: reloadAction)
.navigationTitle(navTitle)
.navigationBarItems(leading: HamburgerButton(action: hamburgerAction),
trailing: PlusButton(action: plusAction)
@@ -84,6 +86,7 @@ struct ExchangeListView: View {
extension ExchangeListView {
struct Content: View {
let symLog: SymLogV?
+ let stack: CallStack
@AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
@Binding var exchanges: [Exchange]
@Binding var centsToTransfer: UInt64
@@ -110,7 +113,9 @@ extension ExchangeListView {
let sortedDict = dict.sorted{ $0.key < $1.key}
Group { // necessary for .backslide transition (bug in SwiftUI)
List(sortedDict, id: \.key) { key, value in
- ExchangeSectionView(currency: key, exchanges: value,
centsToTransfer: $centsToTransfer)
+ ExchangeSectionView(stack: stack.push(),
+ currency: key, exchanges: value,
+ centsToTransfer: $centsToTransfer)
}
.refreshable {
symLog?.log("refreshing")
diff --git a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
index 1ab1f36..a87ea0b 100644
--- a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
@@ -6,6 +6,7 @@ import SwiftUI
import taler_swift
struct ExchangeRowView: View {
+ let stack: CallStack
let exchange: Exchange
let currency: String
@Binding var centsToTransfer: UInt64
@@ -23,8 +24,9 @@ struct ExchangeRowView: View {
}, tag: 1, selection: $buttonSelected
) { EmptyView() }.frame(width: 0).opacity(0)
NavigationLink(destination: LazyView {
- ManualWithdraw(exchange: exchange,
- centsToTransfer: $centsToTransfer)
+ ManualWithdraw(stack: stack.push(),
+ exchange: exchange,
+ centsToTransfer: $centsToTransfer)
}, tag: 2, selection: $buttonSelected
) { EmptyView() }.frame(width: 0).opacity(0)
}.listRowSeparator(.hidden)
@@ -47,6 +49,7 @@ struct ExchangeRowView: View {
/// currency
/// [Deposit Coins] [Withdraw Coins]
struct ExchangeSectionView: View {
+ let stack: CallStack
let currency: String
let exchanges: [Exchange]
@@ -59,7 +62,10 @@ struct ExchangeSectionView: View {
#endif
Section {
ForEach(exchanges) { exchange in
- ExchangeRowView(exchange: exchange, currency: currency,
centsToTransfer: $centsToTransfer)
+ ExchangeRowView(stack: stack.push(),
+ exchange: exchange,
+ currency: currency,
+ centsToTransfer: $centsToTransfer)
}
.accessibilityElement(children: .combine)
} header: {
@@ -88,7 +94,7 @@ struct ExchangeRow_Container : View {
exchangeEntryStatus: .ephemeral,
exchangeUpdateStatus: .ready,
ageRestrictionOptions: [])
- ExchangeSectionView(currency: LONGCURRENCY, exchanges: [exchange1,
exchange2],
+ ExchangeSectionView(stack: CallStack("Preview"), currency:
LONGCURRENCY, exchanges: [exchange1, exchange2],
centsToTransfer: $centsToTransfer)
}
}
diff --git a/TalerWallet1/Views/Exchange/ManualWithdraw.swift
b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
index c118d27..5e45416 100644
--- a/TalerWallet1/Views/Exchange/ManualWithdraw.swift
+++ b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
@@ -9,6 +9,7 @@ import SymLog
// Will be called by the user tapping "Withdraw Coins" in the exchange list
struct ManualWithdraw: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let exchange: Exchange
@Binding var centsToTransfer: UInt64
@@ -51,9 +52,10 @@ struct ManualWithdraw: View {
// :
selectedAge
//let _ = print(selectedAge, restrictAge)
NavigationLink(destination: LazyView {
- ManualWithdrawDone(exchange: exchange,
- centsToTransfer: centsToTransfer)
-// restrictAge: restrictAge)
+ ManualWithdrawDone(stack: stack.push(),
+ exchange: exchange,
+ centsToTransfer: centsToTransfer)
+// restrictAge: restrictAge)
}) {
Text("Confirm Withdrawal") //
VIEW_WITHDRAW_ACCEPT
}.buttonStyle(TalerButtonStyle(type: .prominent))
@@ -105,9 +107,10 @@ struct ManualWithdraw_Container : View {
exchangeEntryStatus: .preset,
exchangeUpdateStatus: .initial,
ageRestrictionOptions: [])
- ManualWithdraw(exchange: exchange,
- centsToTransfer: $centsToTransfer,
- withdrawalAmountDetails: details)
+ ManualWithdraw(stack: CallStack("Preview"),
+ exchange: exchange,
+ centsToTransfer: $centsToTransfer,
+ withdrawalAmountDetails: details)
}
}
diff --git a/TalerWallet1/Views/Exchange/ManualWithdrawDone.swift
b/TalerWallet1/Views/Exchange/ManualWithdrawDone.swift
index 1de6913..df5b3b1 100644
--- a/TalerWallet1/Views/Exchange/ManualWithdrawDone.swift
+++ b/TalerWallet1/Views/Exchange/ManualWithdrawDone.swift
@@ -8,6 +8,7 @@ import SymLog
struct ManualWithdrawDone: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let navTitle = String(localized: "Wire Transfer")
let exchange: Exchange
@@ -30,15 +31,16 @@ struct ManualWithdrawDone: View {
#endif
Group {
if let transactionId {
- TransactionDetailView(transactionId: transactionId,
- reloadAction: reloadOneAction,
- navTitle: navTitle,
- doneAction:
ViewState.shared.popToRootView,
- abortAction: nil,
- deleteAction: nil,
- failAction: nil,
- suspendAction: nil,
- resumeAction: nil)
+ TransactionDetailView(stack: stack.push(),
+ transactionId: transactionId,
+ reloadAction: reloadOneAction,
+ navTitle: navTitle,
+ doneAction: ViewState.shared.popToRootView,
+ abortAction: nil,
+ deleteAction: nil,
+ failAction: nil,
+ suspendAction: nil,
+ resumeAction: nil)
.navigationBarBackButtonHidden(true)
.interactiveDismissDisabled() // can only use "Done"
button to dismiss
// .navigationTitle(navTitle)
@@ -75,8 +77,9 @@ struct ManualWithdrawDone_Container : View {
exchangeEntryStatus: .preset,
exchangeUpdateStatus: .initial,
ageRestrictionOptions: [])
- ManualWithdrawDone(exchange: exchange,
- centsToTransfer: centsToTransfer)
+ ManualWithdrawDone(stack: CallStack("Preview"),
+ exchange: exchange,
+ centsToTransfer: centsToTransfer)
}
}
diff --git a/TalerWallet1/Views/Main/MainView.swift
b/TalerWallet1/Views/Main/MainView.swift
index 55d72f9..7743cf9 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -60,7 +60,7 @@ struct MainView: View {
urlToOpen = url // raise sheet
}
.sheet(item: $urlToOpen, onDismiss: sheetDismissed) { url in
- let sheet = AnyView(URLSheet(urlToOpen: url))
+ let sheet = AnyView(URLSheet(stack: stack.push(), urlToOpen: url))
Sheet(sheetView: sheet)
}
} // body
@@ -84,14 +84,15 @@ extension MainView {
var views: [SidebarItem] {[
SidebarItem(name: balances,
sysImage: "creditcard.fill", // TODO: Wallet Icon
- view: AnyView(BalancesListView(navTitle: balances,
- stack: stack.push(),
- hamburgerAction:
hamburgerAction)
+ view: AnyView(BalancesListView(stack:
stack.push(balances),
+ navTitle: balances,
+ hamburgerAction: hamburgerAction)
)),
SidebarItem(name: exchanges,
sysImage: "building.columns",
- view: AnyView(ExchangeListView(navTitle: exchanges,
- hamburgerAction:
hamburgerAction)
+ view: AnyView(ExchangeListView(stack:
stack.push(exchanges),
+ navTitle: exchanges,
+ hamburgerAction: hamburgerAction)
)),
SidebarItem(name: settings, // TODO: "About"?
sysImage: "gearshape.fill",
diff --git a/TalerWallet1/Views/Payment/PayTemplateView.swift
b/TalerWallet1/Views/Payment/PayTemplateView.swift
index 356801a..ea6c73a 100644
--- a/TalerWallet1/Views/Payment/PayTemplateView.swift
+++ b/TalerWallet1/Views/Payment/PayTemplateView.swift
@@ -10,6 +10,7 @@ import SymLog
// both from the shop's website. We show the payment details
struct PayTemplateView: View {
private let symLog = SymLogV()
+ let stack: CallStack
let navTitle = String(localized: "Confirm Payment", comment:"pay merchant")
@EnvironmentObject private var controller: Controller
diff --git a/TalerWallet1/Views/Payment/PaymentView.swift
b/TalerWallet1/Views/Payment/PaymentView.swift
index 5211d02..b50d970 100644
--- a/TalerWallet1/Views/Payment/PaymentView.swift
+++ b/TalerWallet1/Views/Payment/PaymentView.swift
@@ -10,6 +10,7 @@ import SymLog
// both from the shop's website. We show the payment details
struct PaymentView: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let navTitle = String(localized: "Confirm Payment", comment:"pay merchant")
@EnvironmentObject private var controller: Controller
@@ -154,6 +155,6 @@ struct PaymentURIView_Previews: PreviewProvider {
)
let url = URL(string: "taler://pay/some_amount")!
- PaymentView(url: url, preparePayResult: details)
+ PaymentView(stack: CallStack("Preview"), url: url, preparePayResult:
details)
}
}
diff --git a/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift
b/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift
index c04a26f..577ecc5 100644
--- a/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift
+++ b/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift
@@ -8,6 +8,7 @@ import SymLog
struct PaymentPurpose: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let scopeInfo: ScopeInfo
let centsToTransfer: UInt64
@@ -65,9 +66,11 @@ struct PaymentPurpose: View {
let disabled = (expireDays == 0) || (summary.count < 1)
NavigationLink(destination: LazyView {
- SendDone(amountToSend: nil,
- amountToReceive: amount,
- summary: summary, expireDays: expireDays)
+ SendDone(stack: stack.push(),
+ amountToSend: nil,
+ amountToReceive: amount,
+ summary: summary,
+ expireDays: expireDays)
}) {
Text("Request \(label) \(scopeInfo.currency)")
// .accessibilityFont(buttonFont)
diff --git a/TalerWallet1/Views/Peer2peer/RequestPayment.swift
b/TalerWallet1/Views/Peer2peer/RequestPayment.swift
index 17687d4..3460039 100644
--- a/TalerWallet1/Views/Peer2peer/RequestPayment.swift
+++ b/TalerWallet1/Views/Peer2peer/RequestPayment.swift
@@ -9,6 +9,7 @@ import SymLog
// Called when tapping "Request Payment" in the balances list
struct RequestPayment: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
var scopeInfo: ScopeInfo
@Binding var centsToTransfer: UInt64
@@ -40,11 +41,12 @@ struct RequestPayment: View {
let disabled = (centsToTransfer == 0) || someCoins.invalid ||
someCoins.tooMany
NavigationLink(destination: LazyView {
- PaymentPurpose(scopeInfo: scopeInfo,
- centsToTransfer: centsToTransfer,
- fee: someCoins.fee,
- summary: $summary,
- expireDays: $expireDays)
+ PaymentPurpose(stack: stack.push(),
+ scopeInfo: scopeInfo,
+ centsToTransfer: centsToTransfer,
+ fee: someCoins.fee,
+ summary: $summary,
+ expireDays: $expireDays)
// { deactivateAction() }
}) {
let amount = Amount.amountFromCents(currency,
centsToTransfer)
diff --git a/TalerWallet1/Views/Peer2peer/SendAmount.swift
b/TalerWallet1/Views/Peer2peer/SendAmount.swift
index 080d16e..a7475cd 100644
--- a/TalerWallet1/Views/Peer2peer/SendAmount.swift
+++ b/TalerWallet1/Views/Peer2peer/SendAmount.swift
@@ -9,6 +9,7 @@ import SymLog
// Called when tapping "Send Coins" in the balances list
struct SendAmount: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let amountAvailable: Amount // TODO: GetMaxPeerPushAmount
@Binding var centsToTransfer: UInt64
@@ -56,11 +57,12 @@ struct SendAmount: View {
let disabled = centsToTransfer == 0 // TODO: check
amountAvailable
NavigationLink(destination: LazyView {
- SendPurpose(amountAvailable: amountAvailable,
- centsToTransfer: centsToTransfer,
- fee: fee,
- summary: $summary,
- expireDays: $expireDays)
+ SendPurpose(stack: stack.push(),
+ amountAvailable: amountAvailable,
+ centsToTransfer: centsToTransfer,
+ fee: fee,
+ summary: $summary,
+ expireDays: $expireDays)
}) {
Text("Next")
} .buttonStyle(TalerButtonStyle(type: .prominent))
@@ -103,9 +105,10 @@ struct SendAmount_Container : View {
var body: some View {
let amount = Amount(currency: LONGCURRENCY, integer: 10, fraction: 0)
- SendAmount(amountAvailable: amount,
- centsToTransfer: $centsToTransfer,
- summary: $summary)
+ SendAmount(stack: CallStack("Preview"),
+ amountAvailable: amount,
+ centsToTransfer: $centsToTransfer,
+ summary: $summary)
}
}
diff --git a/TalerWallet1/Views/Peer2peer/SendDone.swift
b/TalerWallet1/Views/Peer2peer/SendDone.swift
index 9c69565..5cfe04d 100644
--- a/TalerWallet1/Views/Peer2peer/SendDone.swift
+++ b/TalerWallet1/Views/Peer2peer/SendDone.swift
@@ -9,6 +9,7 @@ import SymLog
// Called when initiating a P2P transaction: Send coins or Send
Request(Invoice)
struct SendDone: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let navTitle = String(localized: "P2P Ready")
#if DEBUG
@AppStorage("developerMode") var developerMode: Bool = true
@@ -37,15 +38,16 @@ struct SendDone: View {
#endif
VStack {
if let transactionId {
- TransactionDetailView(transactionId: transactionId,
- reloadAction: reloadOneAction,
- navTitle: navTitle,
- doneAction:
ViewState.shared.popToRootView,
- abortAction: nil,
- deleteAction: nil,
- failAction: nil,
- suspendAction: nil,
- resumeAction: nil)
+ TransactionDetailView(stack: stack.push(),
+ transactionId: transactionId,
+ reloadAction: reloadOneAction,
+ navTitle: navTitle,
+ doneAction: ViewState.shared.popToRootView,
+ abortAction: nil,
+ deleteAction: nil,
+ failAction: nil,
+ suspendAction: nil,
+ resumeAction: nil)
.navigationBarBackButtonHidden(true)
.interactiveDismissDisabled() // can only use "Done"
button to dismiss
.navigationTitle(navTitle)
@@ -86,10 +88,11 @@ struct SendDone: View {
struct SendNow_Previews: PreviewProvider {
static var previews: some View {
Group {
- SendDone(amountToSend: try! Amount(fromString: LONGCURRENCY +
":4.8"),
- amountToReceive: nil,
- summary: "some purpose",
- expireDays: 0)
+ SendDone(stack: CallStack("Preview"),
+ amountToSend: try! Amount(fromString: LONGCURRENCY + ":4.8"),
+ amountToReceive: nil,
+ summary: "some purpose",
+ expireDays: 0)
}
}
}
diff --git a/TalerWallet1/Views/Peer2peer/SendPurpose.swift
b/TalerWallet1/Views/Peer2peer/SendPurpose.swift
index a568981..3117450 100644
--- a/TalerWallet1/Views/Peer2peer/SendPurpose.swift
+++ b/TalerWallet1/Views/Peer2peer/SendPurpose.swift
@@ -8,6 +8,7 @@ import SymLog
struct SendPurpose: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
@FocusState private var isFocused: Bool
let amountAvailable: Amount
@@ -82,9 +83,11 @@ struct SendPurpose: View {
let disabled = (expireDays == 0) || (summary.count < 1) //
TODO: check amountAvailable
NavigationLink(destination: LazyView {
- SendDone(amountToSend: amount,
- amountToReceive: nil,
- summary: summary, expireDays: expireDays)
+ SendDone(stack: stack.push(),
+ amountToSend: amount,
+ amountToReceive: nil,
+ summary: summary,
+ expireDays: expireDays)
}) {
Text("Send \(value) \(amountAvailable.currencyStr) now",
comment: "first is value, second currencyString") // TODO: currency formatter
}
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift
b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift
index dbca102..b26a6d0 100644
--- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift
+++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift
@@ -9,6 +9,7 @@ import SymLog
// Called when accepting a scanned P2P transaction: Receive coins or Pay
Request(Invoice)
struct P2pAcceptDone: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let transactionId: String
let incoming: Bool
@@ -29,15 +30,16 @@ struct P2pAcceptDone: View {
#endif
let navTitle = incoming ? String(localized: "Received P2P", comment:
"Title, short")
: String(localized: "Paid P2P", comment:
"Title, short")
- TransactionDetailView(transactionId: transactionId,
- reloadAction: reloadOneAction,
- navTitle: navTitle,
- doneAction: { dismissTop() },
- abortAction: nil,
- deleteAction: nil,
- failAction: nil,
- suspendAction: nil,
- resumeAction: nil)
+ TransactionDetailView(stack: stack.push(),
+ transactionId: transactionId,
+ reloadAction: reloadOneAction,
+ navTitle: navTitle,
+ doneAction: { dismissTop() },
+ abortAction: nil,
+ deleteAction: nil,
+ failAction: nil,
+ suspendAction: nil,
+ resumeAction: nil)
.navigationBarBackButtonHidden(true)
.interactiveDismissDisabled() // can only use "Done"
button to dismiss
.navigationTitle(navTitle)
@@ -64,6 +66,8 @@ struct P2pAcceptDone: View {
// MARK: -
struct P2pAcceptDone_Previews: PreviewProvider {
static var previews: some View {
- P2pAcceptDone(transactionId: "some ID", incoming: true)
+ P2pAcceptDone(stack: CallStack("Preview"),
+ transactionId: "some ID",
+ incoming: true)
}
}
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
index 4a156a8..01529fe 100644
--- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
+++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
@@ -10,6 +10,7 @@ import SymLog
// from another user's Send Request(Invoice). We show the P2P details.
struct P2pPayURIView: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let navTitle = String(localized: "Pay P2P")
// the scanned URL
@@ -39,8 +40,9 @@ struct P2pPayURIView: View {
.navigationTitle(navTitle)
NavigationLink(destination: LazyView {
- P2pAcceptDone(transactionId:
peerPullDebitResponse.transactionId,
- incoming: false)
+ P2pAcceptDone(stack: stack.push(),
+ transactionId: peerPullDebitResponse.transactionId,
+ incoming: false)
}) {
Text("Confirm Payment", comment:"pay P2P
request/invoice") // SHEET_PAY_P2P
}.buttonStyle(TalerButtonStyle(type: .prominent))
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
index a2c8e1b..9760a2b 100644
--- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
+++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
@@ -10,6 +10,7 @@ import SymLog
// from another user's SendCoins. We show the P2P details - but first the ToS
must be accepted.
struct P2pReceiveURIView: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let navTitle = String(localized: "P2P Receive")
@AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
@@ -40,8 +41,9 @@ struct P2pReceiveURIView: View {
let tosAccepted = true // TODO:
https://bugs.gnunet.org/view.php?id=7869
if tosAccepted {
NavigationLink(destination: LazyView {
- P2pAcceptDone(transactionId:
peerPushCreditResponse.transactionId,
- incoming: true)
+ P2pAcceptDone(stack: stack.push(),
+ transactionId:
peerPushCreditResponse.transactionId,
+ incoming: true)
}) {
Text("Accept P2P Receive") // SHEET_RCV_P2P_ACCEPT
}.buttonStyle(TalerButtonStyle(type: .prominent))
diff --git a/TalerWallet1/Views/Sheets/QRSheet.swift
b/TalerWallet1/Views/Sheets/QRSheet.swift
index 89a312f..315c60b 100644
--- a/TalerWallet1/Views/Sheets/QRSheet.swift
+++ b/TalerWallet1/Views/Sheets/QRSheet.swift
@@ -9,6 +9,7 @@ import AVFoundation
struct QRSheet: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
@State private var scannedCode: String?
var body: some View {
@@ -19,7 +20,7 @@ struct QRSheet: View {
if let scannedURL = URL(string: scannedCode!) {
let scheme = scannedURL.scheme
if scheme == "taler" {
- URLSheet(urlToOpen: scannedURL)
+ URLSheet(stack: stack.push(), urlToOpen: scannedURL)
} else {
let _ = print(scannedURL) // TODO: logging
ErrorView(errortext: scannedURL.absoluteString)
diff --git a/TalerWallet1/Views/Sheets/URLSheet.swift
b/TalerWallet1/Views/Sheets/URLSheet.swift
index a950134..b9f5751 100644
--- a/TalerWallet1/Views/Sheets/URLSheet.swift
+++ b/TalerWallet1/Views/Sheets/URLSheet.swift
@@ -7,6 +7,7 @@ import SymLog
struct URLSheet: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let navTitle = String(localized: "Checking Link")
var urlToOpen: URL
@EnvironmentObject private var controller: Controller
@@ -17,15 +18,15 @@ struct URLSheet: View {
Group {
switch urlCommand {
case .withdraw:
- WithdrawURIView(url: urlToOpen)
+ WithdrawURIView(stack: stack.push(), url: urlToOpen)
case .pay:
- PaymentView(url: urlToOpen)
+ PaymentView(stack: stack.push(), url: urlToOpen)
case .payPull:
- P2pPayURIView(url: urlToOpen)
+ P2pPayURIView(stack: stack.push(), url: urlToOpen)
case .payPush:
- P2pReceiveURIView(url: urlToOpen)
+ P2pReceiveURIView(stack: stack.push(), url: urlToOpen)
case .payTemplate:
- PayTemplateView(url: urlToOpen)
+ PayTemplateView(stack: stack.push(), url: urlToOpen)
// case .reward:
// RewardURIView(url: urlToOpen)
default: // Error view
diff --git a/TalerWallet1/Views/Transactions/TransactionDetailView.swift
b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
index f97851b..148d755 100644
--- a/TalerWallet1/Views/Transactions/TransactionDetailView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
@@ -23,6 +23,7 @@ extension Transaction { // for Dummys
// MARK: -
struct TransactionDetailView: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
@AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
#if DEBUG
@AppStorage("developerMode") var developerMode: Bool = true
diff --git a/TalerWallet1/Views/Transactions/TransactionsListView.swift
b/TalerWallet1/Views/Transactions/TransactionsListView.swift
index 16ce785..a0865a3 100644
--- a/TalerWallet1/Views/Transactions/TransactionsListView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionsListView.swift
@@ -7,6 +7,7 @@ import SymLog
struct TransactionsListView: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
@AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
let navTitle: String
@@ -28,6 +29,7 @@ struct TransactionsListView: View {
ScrollViewReader { scrollView in
List {
TransactionsRowsView(symLog: symLog,
+ stack: stack.push(),
currency: currency,
transactions: transactions,
// reloadAllAction: reloadAllAction,
@@ -78,6 +80,7 @@ struct TransactionsListView: View {
// used by TransactionsListView, and by Balances to show the last 3
transactions
struct TransactionsRowsView: View {
let symLog: SymLogV?
+ let stack: CallStack
let currency: String
let transactions: [Transaction]
// let reloadAllAction: () async -> ()
@@ -97,15 +100,16 @@ struct TransactionsRowsView: View {
ForEach(Array(zip(transactions.indices, transactions)), id: \.1) {
index, transaction in
NavigationLink {
LazyView {
- TransactionDetailView(transactionId: transaction.id,
- reloadAction: reloadOneAction,
- navTitle: nil,
- doneAction: nil,
- abortAction: abortAction,
- deleteAction: deleteAction,
- failAction: failAction,
- suspendAction: suspendAction,
- resumeAction: resumeAction)
+ TransactionDetailView(stack: stack.push(),
+ transactionId: transaction.id,
+ reloadAction: reloadOneAction,
+ navTitle: nil,
+ doneAction: nil,
+ abortAction: abortAction,
+ deleteAction: deleteAction,
+ failAction: failAction,
+ suspendAction: suspendAction,
+ resumeAction: resumeAction)
}
} label: {
TransactionRowView(transaction: transaction)
diff --git a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawAcceptDone.swift
b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawAcceptDone.swift
index f76cc18..0799c6c 100644
--- a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawAcceptDone.swift
+++ b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawAcceptDone.swift
@@ -8,6 +8,7 @@ import SymLog
struct WithdrawAcceptDone: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let navTitle = String(localized: "Confirm with Bank")
let exchangeBaseUrl: String?
@@ -29,15 +30,16 @@ struct WithdrawAcceptDone: View {
#endif
Group {
if let transactionId {
- TransactionDetailView(transactionId: transactionId,
- reloadAction: reloadOneAction,
- navTitle: navTitle,
- doneAction: { dismissTop() },
- abortAction: nil,
- deleteAction: nil,
- failAction: nil,
- suspendAction: nil,
- resumeAction: nil)
+ TransactionDetailView(stack: stack.push(),
+ transactionId: transactionId,
+ reloadAction: reloadOneAction,
+ navTitle: navTitle,
+ doneAction: { dismissTop() },
+ abortAction: nil,
+ deleteAction: nil,
+ failAction: nil,
+ suspendAction: nil,
+ resumeAction: nil)
.navigationBarBackButtonHidden(true)
.interactiveDismissDisabled() // can only use "Done"
button to dismiss
.navigationTitle(navTitle)
@@ -66,7 +68,8 @@ struct WithdrawAcceptDone: View {
// MARK: -
struct WithdrawAcceptDone_Previews: PreviewProvider {
static var previews: some View {
- WithdrawAcceptDone(exchangeBaseUrl: DEMOEXCHANGE,
- url: URL(string: DEMOSHOP)!)
+ WithdrawAcceptDone(stack: CallStack("Preview"),
+ exchangeBaseUrl: DEMOEXCHANGE,
+ url: URL(string: DEMOSHOP)!)
}
}
diff --git a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift
b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift
index cb58ad3..8e7580e 100644
--- a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift
+++ b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift
@@ -11,6 +11,7 @@ import SymLog
// After the user confirmed the withdrawal, we show a button to return to the
bank website to confirm there, too
struct WithdrawURIView: View {
private let symLog = SymLogV(0)
+ let stack: CallStack
let navTitle = String(localized: "Withdrawal")
// the URL from the bank website
@@ -50,7 +51,9 @@ struct WithdrawURIView: View {
let tosAccepted = withdrawalAmountDetails.tosAccepted
if tosAccepted {
NavigationLink(destination: LazyView {
- WithdrawAcceptDone(exchangeBaseUrl: exchangeBaseUrl,
url: url)
+ WithdrawAcceptDone(stack: stack.push(),
+ exchangeBaseUrl: exchangeBaseUrl,
+ url: url)
}) {
Text("Confirm Withdrawal") //
SHEET_WITHDRAW_ACCEPT
}.buttonStyle(TalerButtonStyle(type: .prominent))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 05/28: Terms of Service, (continued)
- [taler-taler-ios] 05/28: Terms of Service, gnunet, 2023/09/18
- [taler-taler-ios] 16/28: ScreenSize, gnunet, 2023/09/18
- [taler-taler-ios] 22/28: CallStack, gnunet, 2023/09/18
- [taler-taler-ios] 23/28: logging, gnunet, 2023/09/18
- [taler-taler-ios] 26/28: fix warning, gnunet, 2023/09/18
- [taler-taler-ios] 21/28: test.taler.net now uses KUDOS (instead of TESTKUDOS), gnunet, 2023/09/18
- [taler-taler-ios] 19/28: Sendable for Swift 6, gnunet, 2023/09/18
- [taler-taler-ios] 25/28: simplify, gnunet, 2023/09/18
- [taler-taler-ios] 20/28: Wording: don't use "encrypt", gnunet, 2023/09/18
- [taler-taler-ios] 17/28: Bargraph shows the last transactions visually, gnunet, 2023/09/18
- [taler-taler-ios] 24/28: more CallStack debugging,
gnunet <=