[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 126/204: cleanup
From: |
gnunet |
Subject: |
[taler-taler-ios] 126/204: cleanup |
Date: |
Thu, 05 Dec 2024 23:51:34 +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 0da9fc43055b9d8a48ef21382f01ff2049f0d349
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sun Nov 10 11:51:55 2024 +0100
cleanup
---
TalerWallet1/Controllers/Controller.swift | 26 +++------
TalerWallet1/Helper/CallStack.swift | 11 ++++
TalerWallet1/Views/Balances/BalancesListView.swift | 2 -
.../Views/Settings/Exchange/ExchangeListView.swift | 30 +++-------
.../Views/Sheets/Payment/PayTemplateV.swift | 64 +++++++++++-----------
TalerWallet1/Views/Sheets/URLSheet.swift | 23 ++++----
.../Views/Transactions/TransactionsListView.swift | 2 -
7 files changed, 73 insertions(+), 85 deletions(-)
diff --git a/TalerWallet1/Controllers/Controller.swift
b/TalerWallet1/Controllers/Controller.swift
index 3674519..6b0ff04 100755
--- a/TalerWallet1/Controllers/Controller.swift
+++ b/TalerWallet1/Controllers/Controller.swift
@@ -309,24 +309,16 @@ extension Controller {
// TODO: uncrypted
}
switch command.lowercased() {
- case "withdraw":
- return .withdraw
- case "withdraw-exchange":
- return .withdrawExchange
- case "terms-exchange":
- return .termsExchange
- case "pay":
- return .pay
- case "pay-pull":
- return .payPull
- case "pay-push":
- return .payPush
- case "pay-template":
- return .payTemplate
- case "refund":
- return .refund
+ case "withdraw": return .withdraw
+ case "withdraw-exchange": return .withdrawExchange
+ case "terms-exchange": return .termsExchange
+ case "pay": return .pay
+ case "pay-pull": return .payPull
+ case "pay-push": return .payPush
+ case "pay-template": return .payTemplate
+ case "refund": return .refund
default:
- self.logger.error("unknown command taler://\(command)")
+ self.logger.error("❗️unknown command taler://\(command)")
}
return .unknown
}
diff --git a/TalerWallet1/Helper/CallStack.swift
b/TalerWallet1/Helper/CallStack.swift
index 8fa91ca..1692f88 100644
--- a/TalerWallet1/Helper/CallStack.swift
+++ b/TalerWallet1/Helper/CallStack.swift
@@ -82,6 +82,17 @@ extension CallStack {
return push(item: item)
}
#endif
+ public func print() -> String {
+ var result: String = EMPTYSTRING
+ for (item) in stack {
+#if DEBUG
+ result += item.file + " " + item.function + "; "
+#else
+ result += item.message + "; "
+#endif
+ }
+ return result
+ }
}
//extension CallStack: Equatable {
diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift
b/TalerWallet1/Views/Balances/BalancesListView.swift
index 0ace005..c8f1b7c 100644
--- a/TalerWallet1/Views/Balances/BalancesListView.swift
+++ b/TalerWallet1/Views/Balances/BalancesListView.swift
@@ -53,12 +53,10 @@ struct BalancesListView: View {
.listStyle(myListStyle.style).anyView
}
}
-#if REFRESHABLE
.refreshable { // already async
controller.hapticNotification(.success)
symLog.log("refreshing balances")
await controller.loadBalances(stack.push("refreshing balances"),
model)
}
-#endif
}
}
diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift
b/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift
index c59a983..48eea30 100644
--- a/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift
+++ b/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift
@@ -73,6 +73,7 @@ struct ExchangeListCommonV: View {
@EnvironmentObject private var model: WalletModel
@EnvironmentObject private var controller: Controller
+ @AppStorage("minimalistic") var minimalistic: Bool = false
@AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
var body: some View {
@@ -92,12 +93,15 @@ struct ExchangeListCommonV: View {
}
Section {
let plus = Image(systemName: "plus")
- Text("Use the \(plus) button to add a service.")
- .talerFont(.body)
- .listRowSeparator(.hidden)
- Text("You can also scan a withdrawal QR code from your bank in
the Action menu to automatically add a payment service.")
- .talerFont(.body)
+ if !minimalistic {
+ Text("Tap the \(plus) button to add a service.")
+ .listRowSeparator(.hidden)
+ Text("You can also scan a withdrawal QR code from your
bank in the Action menu to automatically add a payment service.")
+ } else {
+ Text("Tap \(plus) or scan a withdrawal QR code from your
bank to add a payment service.")
+ }
}
+ .talerFont(.body)
}
Group {
@@ -108,30 +112,14 @@ struct ExchangeListCommonV: View {
}
}
.listStyle(myListStyle.style).anyView
-//#if REFRESHABLE
.refreshable {
controller.hapticNotification(.success)
symLog?.log("refreshing")
// await reloadExchanges()
NotificationCenter.default.post(name: .BalanceChange, object: nil,
userInfo: nil)
}
-//#endif
.onAppear() {
DebugViewC.shared.setViewID(VIEW_PAYMENT_SERVICES, stack:
stack.push())
}
-// .onNotification(.ExchangeAdded) { notification in
-// // doesn't need to be received on main thread because we just
reload in the background anyway
-// symLog?.log(".onNotification(.ExchangeAdded) ==> reloading
exchanges")
-// Task { await reloadExchanges() } // runs on MainActor
-// }
-// .onNotification(.ExchangeDeleted) { notification in
-// // doesn't need to be received on main thread because we just
reload in the background anyway
-// symLog?.log(".onNotification(.ExchangeDeleted) ==> reloading
exchanges")
-// Task { await reloadExchanges() } // runs on MainActor
-// }
-// .task {
-// symLog?.log(".task")
-// await reloadExchanges()
-// }
} // body
}
diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
index e6d246d..164bf75 100644
--- a/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
+++ b/TalerWallet1/Views/Sheets/Payment/PayTemplateV.swift
@@ -71,11 +71,11 @@ struct PayTemplateV: View {
private func computeFeePayTemplate(_ amount: Amount) async ->
ComputeFeeResult? {
// if let result = await preparePayForTemplate(model: model,
-// url: url,
-// amount: amountToTransfer,
-// summary:
summaryIsEditable ? summary ?? " "
-// : nil,
-// announce: announce)
+// url: url,
+// amount: amountToTransfer,
+// summary: summaryIsEditable
? summary ?? " "
+//
: nil,
+// announce: announce)
// {
// preparePayResult = result.ppCheck
// }
@@ -128,47 +128,49 @@ struct PayTemplateV: View {
var body: some View {
if let templateContract { // preparePayResult
// let currency = templateContract.currency ??
templateContract.amount?.currencyStr ?? UNKNOWN
-// let currencyInfo = controller.info(for: currency,
controller.currencyTicker)
let amountLabel = minimalistic ? String(localized: "Amount:")
: String(localized: "Amount to
pay:")
// final destination with amountToTransfer, after user input of
amount
let finalDestinationI = PaymentView(stack: stack.push(),
url: url,
template: true,
- amountToTransfer: $amountToTransfer,
- summary: $summary,
- amountIsEditable: amountIsEditable,
- summaryIsEditable: summaryIsEditable)
+ amountToTransfer: $amountToTransfer,
+ summary: $summary,
+ amountIsEditable: amountIsEditable,
+ summaryIsEditable: summaryIsEditable)
+
+ // final destination with amountShortcut, when user tapped a
shortcut
let finalDestinationS = PaymentView(stack: stack.push(),
url: url,
- template: true,
- amountToTransfer: $amountShortcut,
- summary: $summary,
- amountIsEditable: amountIsEditable,
- summaryIsEditable: summaryIsEditable)
+ template: true,
+ amountToTransfer: $amountShortcut,
+ summary: $summary,
+ amountIsEditable: amountIsEditable,
+ summaryIsEditable: summaryIsEditable)
// destination to subject input
let inputDestination = SubjectInputV(stack: stack.push(),
url: url,
- amountAvailable: nil,
- amountToTransfer: $amountToTransfer,
- amountLabel: amountLabel,
- summary: $summary,
-// insufficient: $insufficient,
-// feeAmount: $feeAmount,
- feeIsNotZero: true, // TODO: feeIsNotZero()
- targetView: finalDestinationI)
+ amountAvailable: nil,
+ amountToTransfer: $amountToTransfer,
+ amountLabel: amountLabel,
+ summary: $summary,
+// insufficient: $insufficient,
+// feeAmount: $feeAmount,
+ feeIsNotZero: true, // TODO:
feeIsNotZero()
+ targetView: finalDestinationI)
+
// destination to subject input, when user tapped an amount
shortcut
let shortcutDestination = SubjectInputV(stack: stack.push(),
url: url,
- amountAvailable: nil,
- amountToTransfer: $amountShortcut,
- amountLabel: amountLabel,
- summary: $summary,
-// insufficient: $insufficient,
-// feeAmount: $feeAmount,
- feeIsNotZero: true, // TODO: feeIsNotZero()
- targetView: finalDestinationS)
+ amountAvailable: nil,
+ amountToTransfer: $amountShortcut,
+ amountLabel: amountLabel,
+ summary: $summary,
+// insufficient: $insufficient,
+// feeAmount: $feeAmount,
+ feeIsNotZero: true, // TODO:
feeIsNotZero()
+ targetView: finalDestinationS)
Group {
if amountIsEditable { // template contract amount is not
fixed => let the user input an amount first
let amountInput = AmountInputV(stack: stack.push(),
diff --git a/TalerWallet1/Views/Sheets/URLSheet.swift
b/TalerWallet1/Views/Sheets/URLSheet.swift
index 8abe48c..8677f38 100644
--- a/TalerWallet1/Views/Sheets/URLSheet.swift
+++ b/TalerWallet1/Views/Sheets/URLSheet.swift
@@ -19,16 +19,14 @@ struct URLSheet: View {
@EnvironmentObject private var controller: Controller
@State private var amountToTransfer = Amount.zero(currency: EMPTYSTRING)
@State private var summary = EMPTYSTRING
- @State private var urlCommand: UrlCommand = .unknown
-
- let navTitle = String(localized: "Checking Link")
+ @State private var urlCommand: UrlCommand?
var body: some View {
#if PRINT_CHANGES
let _ = Self._printChanges()
let _ = symLog.vlog() // just to get the # to compare it with
.onAppear & onDisappear
#endif
- Group {
+ if let urlCommand {
switch urlCommand {
case .termsExchange, // TODO: just check the ToS
.withdraw:
@@ -49,18 +47,19 @@ struct URLSheet: View {
PayTemplateV(stack: stack.push(), url: urlToOpen)
case .refund:
RefundURIView(stack: stack.push(), url: urlToOpen)
- default: // Error view
+ default: // TODO: Error view
VStack {
- Text("unknown command")
- .talerFont(.title)
+ let _ = symLog.log("❗️Unknown command❗️
\(urlToOpen.absoluteString)")
Text(controller.messageForSheet ??
urlToOpen.absoluteString)
}
- .navigationTitle(navTitle)
+ .navigationTitle("Unknown command")
}
- }
- .task {
- let command = controller.openURL(urlToOpen, stack: stack.push())
- urlCommand = command
+ } else {
+ LoadingView(scopeInfo: nil, message: "Scanning...")
+ .task {
+ let command = controller.openURL(urlToOpen, stack:
stack.push())
+ urlCommand = command
+ }
}
}
}
diff --git a/TalerWallet1/Views/Transactions/TransactionsListView.swift
b/TalerWallet1/Views/Transactions/TransactionsListView.swift
index f47d144..61f1f7c 100644
--- a/TalerWallet1/Views/Transactions/TransactionsListView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionsListView.swift
@@ -48,13 +48,11 @@ struct TransactionsListView: View {
}
.id(viewId)
.listStyle(myListStyle.style).anyView
-#if REFRESHABLE
.refreshable {
controller.hapticNotification(.success)
symLog.log("refreshing")
await reloadAllAction(stack.push())
}
-#endif
#if false // SCROLLBUTTONS
.if(count > showUpDown) { view in
view.navigationBarItems(trailing: HStack {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 119/204: cleanup, (continued)
- [taler-taler-ios] 119/204: cleanup, gnunet, 2024/12/05
- [taler-taler-ios] 120/204: Withdraw, gnunet, 2024/12/05
- [taler-taler-ios] 116/204: Settings, gnunet, 2024/12/05
- [taler-taler-ios] 112/204: P2P, gnunet, 2024/12/05
- [taler-taler-ios] 121/204: TransactionById, gnunet, 2024/12/05
- [taler-taler-ios] 123/204: fake currency, gnunet, 2024/12/05
- [taler-taler-ios] 108/204: inputAccessory 'return', gnunet, 2024/12/05
- [taler-taler-ios] 124/204: move DB to AppSupport, gnunet, 2024/12/05
- [taler-taler-ios] 111/204: exchange, gnunet, 2024/12/05
- [taler-taler-ios] 118/204: demoHints, gnunet, 2024/12/05
- [taler-taler-ios] 126/204: cleanup,
gnunet <=
- [taler-taler-ios] 128/204: less logging, gnunet, 2024/12/05
- [taler-taler-ios] 129/204: currencyInfo, gnunet, 2024/12/05
- [taler-taler-ios] 131/204: wire fee, gnunet, 2024/12/05
- [taler-taler-ios] 115/204: Refund, gnunet, 2024/12/05
- [taler-taler-ios] 125/204: Button visible, gnunet, 2024/12/05
- [taler-taler-ios] 127/204: Remove "Amount too small", gnunet, 2024/12/05
- [taler-taler-ios] 130/204: Sheet logic, gnunet, 2024/12/05
- [taler-taler-ios] 117/204: Transactions, gnunet, 2024/12/05
- [taler-taler-ios] 133/204: addGlobalCurrency, gnunet, 2024/12/05
- [taler-taler-ios] 132/204: don't reload after delete, gnunet, 2024/12/05