summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Stibane <marc@taler.net>2023-12-04 09:47:25 +0100
committerMarc Stibane <marc@taler.net>2023-12-04 09:47:25 +0100
commit820d8b3f88d8eb07823a45dea6dbf9bf78feede7 (patch)
treea9f195de180bef567e0da1b774bdfeb5d0114b96
parentb08eb3a442024adaa3c02bc94a4a96191790c287 (diff)
downloadtaler-ios-820d8b3f88d8eb07823a45dea6dbf9bf78feede7.tar.gz
taler-ios-820d8b3f88d8eb07823a45dea6dbf9bf78feede7.tar.bz2
taler-ios-820d8b3f88d8eb07823a45dea6dbf9bf78feede7.zip
cleanup
-rw-r--r--TalerWallet1/Views/Peer2peer/RequestPayment.swift38
-rw-r--r--TalerWallet1/Views/Peer2peer/SendAmount.swift7
-rw-r--r--TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift6
3 files changed, 25 insertions, 26 deletions
diff --git a/TalerWallet1/Views/Peer2peer/RequestPayment.swift b/TalerWallet1/Views/Peer2peer/RequestPayment.swift
index a16f3c8..74205af 100644
--- a/TalerWallet1/Views/Peer2peer/RequestPayment.swift
+++ b/TalerWallet1/Views/Peer2peer/RequestPayment.swift
@@ -39,47 +39,45 @@ struct RequestPayment: View {
defaultValue: "Request \(amountStr)",
comment: "NavTitle: Request 'amountStr'")
+ let someCoins = SomeCoins(details: peerPullCheck)
+ let p2pSubjectV = LazyView {
+ P2PSubjectV(stack: stack.push(),
+ amountToSend: nil,
+ amountToReceive: amountToTransfer,
+ navTitle: navTitle2,
+ buttonTitle: buttonTitle,
+ feeLabel: someCoins.feeLabel(currencyInfo),
+ currencyInfo: currencyInfo,
+ summary: $summary,
+ expireDays: $expireDays)
+ }
let _ = symLog.log("currency: \(currency)")
+ let disabled = amountToTransfer.isZero || someCoins.invalid || someCoins.tooMany
ScrollView { VStack(alignment: .trailing) {
CurrencyInputView(amount: $amountToTransfer,
available: nil,
title: iconOnly ? String(localized: "How much:")
: String(localized: "Amount to request:"))
- .padding(.top)
- let someCoins = SomeCoins(details: peerPullCheck)
+ .padding(.top)
QuiteSomeCoins(someCoins: someCoins,
shouldShowFee: true, // always true since the requester pays fees
currency: currency,
currencyInfo: currencyInfo,
amountEffective: peerPullCheck?.amountEffective)
-
- let disabled = amountToTransfer.isZero || someCoins.invalid || someCoins.tooMany
-
- NavigationLink(destination: LazyView {
- P2PSubjectV(stack: stack.push(),
- amountToSend: nil,
- amountToReceive: amountToTransfer,
- navTitle: navTitle2,
- buttonTitle: buttonTitle,
- feeLabel: someCoins.feeLabel(currencyInfo),
- currencyInfo: currencyInfo,
- summary: $summary,
- expireDays: $expireDays)
- }) { Text("Next") }
+ NavigationLink(destination: p2pSubjectV) { Text("Next") }
.buttonStyle(TalerButtonStyle(type: .prominent))
.disabled(disabled)
-// Spacer()
} } // ScrollVStack
.frame(maxWidth: .infinity, alignment: .leading)
- .padding(.horizontal)
+ .padding(.horizontal) // Lists do this automatically, but this is a VStack
.background(WalletColors().backgroundColor.edgesIgnoringSafeArea(.all))
.navigationTitle(navTitle)
.onAppear {
DebugViewC.shared.setViewID(VIEW_P2P_REQUEST, stack: stack.push())
- symLog.log("❗️Yikes \(navTitle) onAppear")
+ symLog.log("❗️ \(navTitle) onAppear")
}
.onDisappear {
- symLog.log("❗️Yikes \(navTitle) onDisappear")
+ symLog.log("❗️ \(navTitle) onDisappear")
}
.task(id: amountToTransfer.value) {
if amountToTransfer.isZero {
diff --git a/TalerWallet1/Views/Peer2peer/SendAmount.swift b/TalerWallet1/Views/Peer2peer/SendAmount.swift
index b63da48..642d278 100644
--- a/TalerWallet1/Views/Peer2peer/SendAmount.swift
+++ b/TalerWallet1/Views/Peer2peer/SendAmount.swift
@@ -61,6 +61,7 @@ struct SendAmount: View {
let insufficientLabel = String(localized: "You don't have enough \(currency).")
let insufficientLabel2 = String(localized: "but you only have \(available) to send.")
+ let disabled = insufficient || amountToTransfer.isZero
ScrollView { VStack(alignment: .trailing) {
// let _ = print("available: \(available)")
Text("Available:\t\(available)")
@@ -70,13 +71,11 @@ struct SendAmount: View {
available: amountAvailable,
title: iconOnly ? String(localized: "How much:")
: String(localized: "Amount to send:"))
- let disabled = insufficient || amountToTransfer.isZero
Text(insufficient ? insufficientLabel
: feeLabel)
.accessibilityFont(.body)
.foregroundColor(.red)
.padding(4)
-
NavigationLink(destination: LazyView {
P2PSubjectV(stack: stack.push(),
amountToSend: amountToTransfer,
@@ -98,10 +97,10 @@ struct SendAmount: View {
.navigationTitle(navTitle)
.onAppear {
DebugViewC.shared.setViewID(VIEW_P2P_SEND, stack: stack.push())
- symLog.log("❗️Yikes SendAmount onAppear")
+ symLog.log("❗️ \(navTitle) onAppear")
}
.onDisappear {
- symLog.log("❗️Yikes SendAmount onDisappear")
+ symLog.log("❗️ \(navTitle) onDisappear")
}
.task(id: amountToTransfer.value) {
do {
diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift
index dd80483..0eba89c 100644
--- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift
@@ -26,13 +26,15 @@ struct WithdrawTOSView: View {
Content(symLog: symLog, exchangeTOS: exchangeTOS, myListStyle: $myListStyle) {
Task { // runs on MainActor
do {
- if let exchangeBaseUrl {
- _ = try await model.setExchangeTOSAcceptedM(exchangeBaseUrl, etag: exchangeTOS!.currentEtag)
+ if let exchangeBaseUrl, let exchangeTOS {
+ _ = try await model.setExchangeTOSAcceptedM(exchangeBaseUrl, etag: exchangeTOS.currentEtag)
if acceptAction != nil {
acceptAction!()
} else { // just go back - caller will reload
self.presentationMode.wrappedValue.dismiss()
}
+ } else {
+ // TODO: error
}
} catch { // TODO: Show Error
symLog.log(error.localizedDescription)