commit 7dea9e491354de52ccb8b2b9c2222d77abaa3b88
parent 0c0f3b1aeed93caf4aba69d27bbda8b4afc87003
Author: Marc Stibane <marc@taler.net>
Date: Wed, 3 Jan 2024 17:47:07 +0100
ToS for P2P
Diffstat:
3 files changed, 29 insertions(+), 26 deletions(-)
diff --git a/TalerWallet1/Views/Exchange/ManualWithdraw.swift b/TalerWallet1/Views/Exchange/ManualWithdraw.swift
@@ -48,23 +48,24 @@ struct ManualWithdraw: View {
// restrictAge: restrictAge)
}
let disabled = amountToTransfer.isZero || someCoins.invalid || someCoins.tooMany
+ let tosAccepted = exchange.tosStatus == .accepted
ScrollView { VStack(alignment: .trailing) {
Text("via \(exchange.exchangeBaseUrl.trimURL())")
.multilineTextAlignment(.center)
.accessibilityFont(.body)
- CurrencyInputView(amount: $amountToTransfer,
- available: nil,
- title: iconOnly ? String(localized: "Amount:")
- : String(localized: "Amount to withdraw:"),
- shortcutAction: nil)
- .padding(.top)
- QuiteSomeCoins(someCoins: someCoins,
- shouldShowFee: true, // TODO: set to false if we never charge withdrawal fees
- currency: currency,
- currencyInfo: currencyInfo,
- amountEffective: withdrawalAmountDetails?.amountEffective)
-// agePicker
- if exchange.tosStatus == .accepted {
+ if !tosAccepted {
+ CurrencyInputView(amount: $amountToTransfer,
+ available: nil,
+ title: iconOnly ? String(localized: "Amount:")
+ : String(localized: "Amount to withdraw:"),
+ shortcutAction: nil)
+ .padding(.top)
+ QuiteSomeCoins(someCoins: someCoins,
+ shouldShowFee: true, // TODO: set to false if we never charge withdrawal fees
+ currency: currency,
+ currencyInfo: currencyInfo,
+ amountEffective: withdrawalAmountDetails?.amountEffective)
+// agePicker
NavigationLink(destination: destination) {
Text("Confirm Withdrawal") // VIEW_WITHDRAW_ACCEPT
}
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
@@ -23,9 +23,15 @@ struct P2pReceiveURIView: View {
@State private var exchange: Exchange? = nil
var body: some View {
- let badURL = "Error in URL: \(url)"
VStack {
if let peerPushCreditResponse {
+ let tosAccepted = exchange?.tosStatus == .accepted
+ if !tosAccepted {
+ ToSButtonView(stack: stack.push(),
+ exchangeBaseUrl: peerPushCreditResponse.exchangeBaseUrl,
+ viewID: SHEET_RCV_P2P_TOS,
+ p2p: true)
+ }
List {
let raw = peerPushCreditResponse.amountRaw
let effective = peerPushCreditResponse.amountEffective
@@ -44,7 +50,6 @@ struct P2pReceiveURIView: View {
}
.listStyle(myListStyle.style).anyView
.navigationTitle(navTitle)
- let tosAccepted = exchange?.tosStatus == .accepted
if tosAccepted {
NavigationLink(destination: LazyView {
P2pAcceptDone(stack: stack.push(),
@@ -55,11 +60,6 @@ struct P2pReceiveURIView: View {
}
.buttonStyle(TalerButtonStyle(type: .prominent))
.padding(.horizontal)
- } else {
- ToSButtonView(stack: stack.push(),
- exchangeBaseUrl: peerPushCreditResponse.exchangeBaseUrl,
- viewID: SHEET_RCV_P2P_TOS,
- p2p: true)
}
} else {
LoadingView(url: url, message: nil)
diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
@@ -27,6 +27,13 @@ struct WithdrawURIView: View {
var body: some View {
VStack {
if let withdrawalAmountDetails, let exchange {
+ let tosAccepted = exchange.tosStatus == .accepted
+ if !tosAccepted {
+ ToSButtonView(stack: stack.push(),
+ exchangeBaseUrl: exchange.exchangeBaseUrl,
+ viewID: SHEET_WITHDRAW_TOS,
+ p2p: false)
+ }
List {
let raw = withdrawalAmountDetails.amountRaw
let effective = withdrawalAmountDetails.amountEffective
@@ -55,7 +62,7 @@ struct WithdrawURIView: View {
}
.listStyle(myListStyle.style).anyView
.navigationTitle(navTitle)
- if exchange.tosStatus == .accepted {
+ if tosAccepted {
NavigationLink(destination: LazyView {
WithdrawAcceptDone(stack: stack.push(),
exchangeBaseUrl: exchange.exchangeBaseUrl,
@@ -65,11 +72,6 @@ struct WithdrawURIView: View {
}
.buttonStyle(TalerButtonStyle(type: .prominent))
.padding(.horizontal)
- } else {
- ToSButtonView(stack: stack.push(),
- exchangeBaseUrl: exchange.exchangeBaseUrl,
- viewID: SHEET_WITHDRAW_TOS,
- p2p: false)
}
} else { // no details or no exchange
LoadingView(url: url, message: nil)