commit dee64048bad4587285973f1cda53fef268664a97
parent e1bf44fbac331e953af8d2c68baf300b82419034
Author: Marc Stibane <marc@taler.net>
Date: Tue, 5 Dec 2023 11:58:37 +0100
amountToTransfer
Diffstat:
3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/TalerWallet1/Views/Peer2peer/P2PReadyV.swift b/TalerWallet1/Views/Peer2peer/P2PReadyV.swift
@@ -10,10 +10,10 @@ import SymLog
struct P2PReadyV: View {
private let symLog = SymLogV()
let stack: CallStack
- let amountToSend: Amount?
- let amountToReceive: Amount?
let summary: String
let expireDays: UInt
+ let amountToSend: Bool
+ let amountToTransfer: Amount
@Binding var transactionStarted: Bool
@EnvironmentObject private var model: WalletModel
@@ -74,23 +74,23 @@ struct P2PReadyV: View {
let timestamp = developerMode ? Timestamp.inSomeMinutes(expireDays > 20 ? (24*60)
: expireDays > 5 ? 60 : 3)
: Timestamp.inSomeDays(expireDays)
- if let amountToSend {
- let terms = PeerContractTerms(amount: amountToSend,
+ if amountToSend {
+ let terms = PeerContractTerms(amount: amountToTransfer,
summary: summary,
purse_expiration: timestamp)
// TODO: let user choose baseURL
let response = try await model.initiatePeerPushDebitM(nil, terms: terms)
// will switch from WithdrawProgressView to TransactionDetailView
transactionId = response.transactionId
- } else if let amountToReceive {
- let terms = PeerContractTerms(amount: amountToReceive,
+ } else {
+ let terms = PeerContractTerms(amount: amountToTransfer,
summary: summary,
purse_expiration: timestamp)
// TODO: let user choose baseURL
let response = try await model.initiatePeerPullCreditM(nil, terms: terms)
// will switch from WithdrawProgressView to TransactionDetailView
transactionId = response.transactionId
- } else { fatalError() }
+ }
} catch { // TODO: error
symLog.log(error.localizedDescription)
}
diff --git a/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift b/TalerWallet1/Views/Peer2peer/P2PSubjectV.swift
@@ -9,14 +9,12 @@ import SymLog
struct P2PSubjectV: View {
private let symLog = SymLogV(0)
let stack: CallStack
-
- let amountToSend: Amount?
- let amountToReceive: Amount?
-// let amountToTransfer: Amount
let navTitle: String
let buttonTitle: String
let feeLabel: String
let currencyInfo: CurrencyInfo
+ let amountToSend: Bool
+ @Binding var amountToTransfer: Amount
@Binding var summary: String
@Binding var expireDays: UInt
@@ -81,10 +79,10 @@ struct P2PSubjectV: View {
let disabled = (expireDays == 0) || (summary.count < 1) // TODO: check amountAvailable
NavigationLink(destination: LazyView {
P2PReadyV(stack: stack.push(),
- amountToSend: amountToSend,
- amountToReceive: amountToReceive,
summary: summary,
expireDays: expireDays,
+ amountToSend: amountToSend,
+ amountToTransfer: amountToTransfer,
transactionStarted: $transactionStarted)
}) {
Text(buttonTitle)
diff --git a/TalerWallet1/Views/Peer2peer/SendAmount.swift b/TalerWallet1/Views/Peer2peer/SendAmount.swift
@@ -78,12 +78,12 @@ struct SendAmount: View {
.padding(4)
NavigationLink(destination: LazyView {
P2PSubjectV(stack: stack.push(),
- amountToSend: amountToTransfer,
- amountToReceive: nil,
navTitle: navTitle2,
buttonTitle: buttonTitle,
feeLabel: feeLabel,
currencyInfo: currencyInfo,
+ amountToSend: true,
+ amountToTransfer: $amountToTransfer,
summary: $summary,
expireDays: $expireDays)
}) { Text("Next") }