commit 56615368eef6c33baa14c99582b579367836b6bb
parent 8646727279612a66e728f211cbe6d6b68c15b805
Author: Marc Stibane <marc@taler.net>
Date: Tue, 22 Aug 2023 16:24:29 +0200
Changed "Invoice" to "Request" (private mode - "Invoice" will be used in business mode post 1.0),
roundedBorder for input fields
Diffstat:
13 files changed, 58 insertions(+), 47 deletions(-)
diff --git a/TalerWallet1/Backend/Transaction.swift b/TalerWallet1/Backend/Transaction.swift
@@ -166,13 +166,13 @@ struct TransactionCommon: Decodable {
comment: "TransactionType")
case .reward: return String(localized: "Reward",
comment: "TransactionType")
- case .peerPushDebit: return String(localized: "P2P Send",
+ case .peerPushDebit: return String(localized: "Send Money",
comment: "TransactionType, send coins to another wallet")
- case .scanPushCredit: return String(localized: "P2P Receive",
+ case .scanPushCredit: return String(localized: "Receive Money",
comment: "TransactionType, scan to receive coins sent from another wallet")
- case .peerPullCredit: return String(localized: "P2P Invoice",
+ case .peerPullCredit: return String(localized: "Request Money", // Invoice?
comment: "TransactionType, send invoice to another wallet")
- case .scanPullDebit: return String(localized: "P2P Payment",
+ case .scanPullDebit: return String(localized: "Pay Request", // Pay Invoice is the same as Payment
comment: "TransactionType, scan invoice to pay to another wallet")
}
}
diff --git a/TalerWallet1/Controllers/DebugViewC.swift b/TalerWallet1/Controllers/DebugViewC.swift
@@ -49,17 +49,23 @@ public let VIEW_DEPOSIT = VIEW_WITHDRAWAL + 10 // 40 Deposi
//public let VIEW_DEPOSIT_TOS // 41 - user already accepted the ToS at withdrawal, invoice or receive
public let VIEW_DEPOSIT_ACCEPT = VIEW_DEPOSIT + 2 // 42
-// MARK: P2P Invoice (from Balances)
-// pull credit from another wallet ==> shows QR code to be scanned / link to be sent by mail or messenger
-public let VIEW_INVOICE_P2P = VIEW_DEPOSIT + 10 // 50 Invoice Amount
-public let VIEW_INVOICE_TOS = VIEW_INVOICE_P2P + 1 // 51 Invoice ToS
-public let VIEW_INVOICE_PURPOSE = VIEW_INVOICE_TOS + 1 // 52 Invoice Purpose
-
// MARK: P2P Send Coins (from Balances)
// push debit to another wallet ==> shows QR code to be scanned / link to be sent by mail or messenger
-public let VIEW_SEND_P2P = VIEW_INVOICE_P2P + 10 // 60 Send Coins
-//public let VIEW_SEND_TOS // 61 - user already accepted the ToS at withdrawal, invoice or receive
-public let VIEW_SEND_PURPOSE = VIEW_SEND_P2P + 2 // 62
+public let VIEW_SEND_P2P = VIEW_DEPOSIT + 10 // 50 Send Coins
+//public let VIEW_SEND_TOS // 51 - user already accepted the ToS at withdrawal, invoice or receive
+public let VIEW_SEND_PURPOSE = VIEW_SEND_P2P + 2 // 52
+
+// MARK: P2P Private Receive (from Balances)
+// pull credit from another wallet ==> shows QR code to be scanned / link to be sent by mail or messenger
+public let VIEW_RECEIVE_P2P = VIEW_SEND_P2P + 10 // 60 Receive Amount
+public let VIEW_RECEIVE_TOS = VIEW_RECEIVE_P2P + 1 // 61 Receive ToS
+public let VIEW_RECEIVE_PURPOSE = VIEW_RECEIVE_TOS + 1 // 62 Receive Purpose
+
+// MARK: P2P Business Invoice (from Balances)
+// pull credit from another wallet ==> shows QR code to be scanned / link to be sent by mail or messenger
+public let VIEW_INVOICE_P2P = VIEW_RECEIVE_P2P + 10 // 70 Invoice Amount
+public let VIEW_INVOICE_TOS = VIEW_INVOICE_P2P + 1 // 71 Invoice ToS
+public let VIEW_INVOICE_PURPOSE = VIEW_INVOICE_TOS + 1 // 72 Invoice Purpose
diff --git a/TalerWallet1/Model/Model+P2P.swift b/TalerWallet1/Model/Model+P2P.swift
@@ -99,7 +99,7 @@ extension WalletModel {
}
} // initiatePeerPushDebitM
// MARK: - PeerPullCredit
-/// Check fees before sending an invoice to another wallet
+/// Check fees before sending a request(invoice) to another wallet
struct CheckPeerPullCreditResponse: Codable {
let scopeInfo: ScopeInfo?
let exchangeBaseUrl: String?
@@ -131,7 +131,7 @@ extension WalletModel {
}
} // checkPeerPullCreditM
// - - - - - -
-/// Initiate an outgoing peer pull payment, send an invoice
+/// Initiate an outgoing peer pull payment, send a request(invoice)
struct InitiatePeerPullCreditResponse: Codable {
let talerUri: String
let transactionId: String
@@ -209,7 +209,7 @@ extension WalletModel {
}
} // acceptPeerPushCreditM
// MARK: - PeerPullDebit
-/// Prepare an incoming peer push invoice, pay coins
+/// Prepare an incoming peer push request(invoice), pay coins
struct PreparePeerPullDebitResponse: Codable {
let contractTerms: PeerContractTerms
let amountRaw: Amount
@@ -237,7 +237,7 @@ extension WalletModel {
}
} // preparePeerPullDebitM
// - - - - - -
-/// Confirm incoming peer push invoice and pay
+/// Confirm incoming peer push request(invoice) and pay
fileprivate struct ConfirmPeerPullDebit: WalletBackendFormattedRequest {
struct Response: Decodable {} // no result - getting no error back means success
func operation() -> String { return "confirmPeerPullDebit" }
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift
@@ -200,23 +200,23 @@ fileprivate struct NavigationLinksView : View {
NavigationLink(destination: LazyView {
SendAmount(amountAvailable: balance.available,
centsToTransfer: $centsToTransfer,
- summary: $summary)
+ 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)
+ 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)
+ 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/HelperViews/AmountView.swift b/TalerWallet1/Views/HelperViews/AmountView.swift
@@ -13,14 +13,16 @@ struct AmountView: View {
var body: some View {
VStack(alignment: .leading) {
Text(title)
+ .fixedSize(horizontal: false, vertical: true) // wrap in scrollview
.multilineTextAlignment(.leading)
.font(.body)
HStack {
Spacer()
Text(value)
+ .fixedSize(horizontal: false, vertical: true) // wrap in scrollview
.multilineTextAlignment(.center)
.font(large ? .title : .title2)
-// .fontWeight(large ? .medium : .regular) // @available(iOS 16.0, *)
+// .fontWeight(large ? .medium : .regular) // @available(iOS 16.0, *)
.foregroundColor(color)
.monospacedDigit()
Spacer()
diff --git a/TalerWallet1/Views/HelperViews/CurrencyField.swift b/TalerWallet1/Views/HelperViews/CurrencyField.swift
@@ -65,9 +65,10 @@ public struct CurrencyField: View {
// Set as priority so CurrencyInputField size doesn't affect parent
Text(label)
.layoutPriority(1)
-
+
// Input text field to handle UI
currencyInputField
+// .textFieldStyle(.roundedBorder)
}
}
}
diff --git a/TalerWallet1/Views/HelperViews/CurrencyInputView.swift b/TalerWallet1/Views/HelperViews/CurrencyInputView.swift
@@ -5,7 +5,6 @@
// Created by Marc Stibane on 2023-06-04.
// Copyright © 2023 Taler. All rights reserved.
//
-
import SwiftUI
struct CurrencyInputView: View {
@@ -22,8 +21,8 @@ struct CurrencyInputView: View {
.frame(maxWidth: .infinity, alignment: .trailing)
.foregroundColor(WalletColors().fieldForeground) // text color
.background(WalletColors().fieldBackground)
- .font(.title)
- .border(.primary)
+ .font(.title2)
+ .textFieldStyle(.roundedBorder)
}.onAppear { // make CurrencyField show the keyboard after 0.4 seconds
if hasBeenShown {
print("❗️Yikes: CurrencyInputView hasBeenShown")
@@ -39,6 +38,7 @@ struct CurrencyInputView: View {
}
}
}
+// MARK: -
#if DEBUG
fileprivate struct BindingViewContainer : View {
@State var centsToTransfer: UInt64 = 0
diff --git a/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift b/TalerWallet1/Views/Peer2peer/PaymentPurpose.swift
@@ -42,7 +42,7 @@ struct PaymentPurpose: View {
.font(.title)
.foregroundColor(WalletColors().fieldForeground) // text color
.background(WalletColors().fieldBackground)
- .border(.primary)
+ .textFieldStyle(.roundedBorder)
.focused($isFocused)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {
@@ -69,7 +69,7 @@ struct PaymentPurpose: View {
amountToReceive: amount,
summary: summary, expireDays: expireDays)
}) {
- Text("Invoice \(label) \(scopeInfo.currency)")
+ Text("Request \(label) \(scopeInfo.currency)")
.font(buttonFont)
}
.buttonStyle(TalerButtonStyle(type: .prominent))
@@ -80,10 +80,10 @@ struct PaymentPurpose: View {
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal)
}
- .navigationTitle("Invoice")
+ .navigationTitle("Request")
.background(WalletColors().backgroundColor.edgesIgnoringSafeArea(.all))
.onAppear {
- DebugViewC.shared.setViewID(VIEW_INVOICE_PURPOSE)
+ DebugViewC.shared.setViewID(VIEW_RECEIVE_PURPOSE)
print("❗️ PaymentPurpose onAppear")
}
.onDisappear {
diff --git a/TalerWallet1/Views/Peer2peer/RequestPayment.swift b/TalerWallet1/Views/Peer2peer/RequestPayment.swift
@@ -25,12 +25,12 @@ struct RequestPayment: View {
let _ = symLog.vlog() // just to get the # to compare it with .onAppear & onDisappear
#endif
let currency = scopeInfo.currency
- let navTitle = String(localized: "Request \(currency)", comment: "Request currency, Dialog Title")
+ let navTitle = String(localized: "Request Money", comment: "Dialog Title")
let currencyField = CurrencyField(value: $centsToTransfer, currency: currency)
ScrollView { VStack {
CurrencyInputView(currencyField: currencyField,
- title: String(localized: "Amount to receive:"))
+ title: String(localized: "Amount to request:"))
let someCoins = SomeCoins(details: peerPullCheck)
QuiteSomeCoins(someCoins: someCoins, shouldShowFee: true,
@@ -47,7 +47,8 @@ struct RequestPayment: View {
expireDays: $expireDays)
// { deactivateAction() }
}) {
- Text("Create invoice")
+ let amount = Amount.amountFromCents(currency, centsToTransfer)
+ Text("Request \(amount.readableDescription)")
}
.buttonStyle(TalerButtonStyle(type: .prominent))
.disabled(disabled)
@@ -59,7 +60,7 @@ struct RequestPayment: View {
.background(WalletColors().backgroundColor.edgesIgnoringSafeArea(.all))
.navigationTitle(navTitle)
.onAppear { // make CurrencyField show the keyboard
- DebugViewC.shared.setViewID(VIEW_INVOICE_P2P)
+ DebugViewC.shared.setViewID(VIEW_RECEIVE_P2P)
symLog.log("❗️Yikes \(navTitle) onAppear")
}
.onDisappear {
diff --git a/TalerWallet1/Views/Peer2peer/SendPurpose.swift b/TalerWallet1/Views/Peer2peer/SendPurpose.swift
@@ -38,12 +38,12 @@ struct SendPurpose: View {
.font(.title2)
if #available(iOS 16.0, *) {
- TextField("Purpose", text: $summary)
+ TextField("Purpose", text: $summary, axis: .vertical)
.font(.title2)
.lineLimit(2...)
.foregroundColor(WalletColors().fieldForeground) // text color
.background(WalletColors().fieldBackground)
- .border(.primary)
+ .textFieldStyle(.roundedBorder)
.focused($isFocused)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {
@@ -56,7 +56,7 @@ struct SendPurpose: View {
// .lineLimit(2...5) // lineLimit' is only available in iOS 16.0 or newer
.foregroundColor(WalletColors().fieldForeground) // text color
.background(WalletColors().fieldBackground)
- .border(.primary)
+ .textFieldStyle(.roundedBorder)
.focused($isFocused)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {
@@ -93,6 +93,7 @@ struct SendPurpose: View {
Spacer()
}
+ .textFieldStyle(.roundedBorder)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.horizontal)
}
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pAcceptDone.swift
@@ -6,7 +6,7 @@ import SwiftUI
import taler_swift
import SymLog
-// Called when accepting a scanned P2P transaction (Receive coins or Pay Invoice)
+// Called when accepting a scanned P2P transaction: Receive coins or Pay Request(Invoice)
struct P2pAcceptDone: View {
private let symLog = SymLogV()
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
@@ -6,8 +6,8 @@ import SwiftUI
import taler_swift
import SymLog
-// Will be called either by the user scanning a QR code or tapping the provided link,
-// from another user's SendInvoice. We show the P2P details.
+// Called either when scanning a QR code or tapping the provided link
+// from another user's Send Request(Invoice). We show the P2P details.
struct P2pPayURIView: View {
private let symLog = SymLogV()
let navTitle = String(localized: "Pay P2P")
@@ -42,7 +42,7 @@ struct P2pPayURIView: View {
P2pAcceptDone(transactionId: peerPullDebitResponse.transactionId,
incoming: false)
}) {
- Text("Confirm Payment", comment:"pay P2P invoice") // SHEET_PAY_P2P
+ Text("Confirm Payment", comment:"pay P2P request/invoice") // SHEET_PAY_P2P
}.buttonStyle(TalerButtonStyle(type: .prominent))
.padding()
} else {
diff --git a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift
@@ -6,9 +6,9 @@ import SwiftUI
import taler_swift
import SymLog
-// Will be called either by the user scanning a QR code or tapping the provided link, both from the bank's website
-// we show the user the withdrawal details - but first the ToS must be accepted
-// after the user confirmed the withdrawal, we remind them to return to the bank website to confirm there, too
+// Called either when scanning a QR code or tapping the provided link, both from the bank's website.
+// We show the user the withdrawal details - but first the ToS must be accepted.
+// 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()
let navTitle = String(localized: "Withdrawal")