taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit faccb37cfa39617cf7754f5bf68024e98fb0880c
parent 52ae044f96d6d0d005dc2a4e7a9064eadb7d4082
Author: Marc Stibane <marc@taler.net>
Date:   Sun,  4 Feb 2024 15:32:29 +0100

Show merchant in payment details

Diffstat:
MTalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift | 3++-
MTalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift | 3++-
MTalerWallet1/Views/Sheets/Payment/PayTemplateView.swift | 6++++--
MTalerWallet1/Views/Sheets/Payment/PaymentView.swift | 6++++--
MTalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift | 3++-
MTalerWallet1/Views/Transactions/ThreeAmountsV.swift | 21+++++++++++++++------
MTalerWallet1/Views/Transactions/TransactionSummaryV.swift | 22+++++++++++++++-------
7 files changed, 44 insertions(+), 20 deletions(-)

diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift @@ -38,7 +38,8 @@ struct P2pPayURIView: View { large: false, pending: false, incoming: false, baseURL: nil, status: nil, - summary: peerPullDebitResponse.contractTerms.summary) + summary: peerPullDebitResponse.contractTerms.summary, + merchant: nil) let expiration = peerPullDebitResponse.contractTerms.purse_expiration let (dateString, date) = TalerDater.dateString(from: expiration) let accessibilityDate = TalerDater.accessibilityDate(date) ?? dateString diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift @@ -46,7 +46,8 @@ struct P2pReceiveURIView: View { large: false, pending: false, incoming: true, baseURL: nil, status: nil, - summary: peerPushCreditResponse.contractTerms.summary) + summary: peerPushCreditResponse.contractTerms.summary, + merchant: nil) let expiration = peerPushCreditResponse.contractTerms.purse_expiration let (dateString, date) = TalerDater.dateString(from: expiration) let accessibilityDate = TalerDater.accessibilityDate(date) ?? dateString diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateView.swift b/TalerWallet1/Views/Sheets/Payment/PayTemplateView.swift @@ -68,7 +68,8 @@ struct PayTemplateView: View { large: false, pending: false, incoming: false, baseURL: baseURL, status: nil, - summary: nil) + summary: nil, + merchant: nil) // TODO: payment: popup with all possible exchanges, check fees } else if let balanceDetails = preparePayResult.balanceDetails { // Insufficient Text("You don't have enough \(currency)") @@ -82,7 +83,8 @@ struct PayTemplateView: View { large: false, pending: false, incoming: false, baseURL: baseURL, status: nil, - summary: nil) + summary: nil, + merchant: nil) } else { // TODO: Error - neither effective nor balanceDetails Text("Error") diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift @@ -45,7 +45,8 @@ struct PaymentView: View { large: false, pending: false, incoming: false, baseURL: baseURL, status: nil, - summary: terms.summary) + summary: terms.summary, + merchant: terms.merchant.name) // TODO: payment: popup with all possible exchanges, check fees } else if let balanceDetails = preparePayResult.balanceDetails { // Insufficient Text("You don't have enough \(currency)") @@ -59,7 +60,8 @@ struct PaymentView: View { large: false, pending: false, incoming: false, baseURL: baseURL, status: nil, - summary: terms.summary) + summary: terms.summary, + merchant: terms.merchant.name) } else { // TODO: Error - neither effective nor balanceDetails Text("Error") diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift @@ -52,7 +52,8 @@ struct WithdrawURIView: View { large: false, pending: false, incoming: true, baseURL: exchange.exchangeBaseUrl, status: nil, // common.txState.major.localizedState - summary: nil) + summary: nil, + merchant: nil) let someCoins = SomeCoins(details: withdrawalAmountDetails) QuiteSomeCoins(someCoins: someCoins, shouldShowFee: true, // TODO: set to false if we never charge withdrawal fees diff --git a/TalerWallet1/Views/Transactions/ThreeAmountsV.swift b/TalerWallet1/Views/Transactions/ThreeAmountsV.swift @@ -14,6 +14,7 @@ struct ThreeAmountsSheet: View { let baseURL: String? let large: Bool // set to false for QR or IBAN let summary: String? + let merchant: String? var body: some View { let raw = common.amountRaw @@ -24,8 +25,8 @@ struct ThreeAmountsSheet: View { let isDone = (common.txState.major == .done) let incomplete = !(isDone || pending) - let defaultBottomTitle = incoming ? (pending ? String(localized: "Pending amount to obtain:") - : String(localized: "Obtained amount:") ) + let defaultBottomTitle = incoming ? (pending ? String(localized: "Pending amount to obtain:") + : String(localized: "Obtained amount:") ) : (pending ? String(localized: "Amount to pay:") : String(localized: "Paid amount:") ) let defaultBottomAbbrev = incoming ? (pending ? String(localized: "Pending:", comment: "mini") @@ -39,7 +40,8 @@ struct ThreeAmountsSheet: View { large: large, pending: pending, incoming: incoming, baseURL: baseURL, status: common.txState.major.localizedState, - summary: summary) + summary: summary, + merchant: merchant) } } // MARK: - @@ -57,6 +59,7 @@ struct ThreeAmountsV: View { let baseURL: String? let status: String? let summary: String? + let merchant: String? @AppStorage("iconOnly") var iconOnly: Bool = false @@ -67,14 +70,20 @@ struct ThreeAmountsV: View { Section { if let summary { Text(summary) - .accessibilityFont(.title2) + .accessibilityFont(.title3) + .lineLimit(4) + .padding(.bottom) + } + if let merchant { + Text(merchant) + .accessibilityFont(.title3) .lineLimit(4) .padding(.bottom) } AmountRowV(title: iconOnly ? topAbbrev : topTitle, amount: topAmount, color: labelColor, - large: large) + large: false) .padding(.bottom, 4) .accessibilityElement(children: .combine) if let fee { @@ -134,7 +143,7 @@ struct ThreeAmounts_Previews: PreviewProvider { List { ThreeAmountsSheet(common: common, topAbbrev: "Withdrawal", topTitle: "Withdrawal", baseURL: DEMOEXCHANGE, - large: 1==0, summary: nil) + large: 1==0, summary: nil, merchant: nil) .safeAreaInset(edge: .bottom) { Button(String(localized: "Accept"), action: {}) .buttonStyle(TalerButtonStyle(type: .prominent)) diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift @@ -277,14 +277,15 @@ struct TransactionSummaryV: View { } // ManualDetails or Confirm now (with bank) ThreeAmountsSheet(common: common, topAbbrev: String(localized: "Chosen:", comment: "mini"), topTitle: String(localized: "Chosen amount to withdraw:"), - baseURL: details.exchangeBaseUrl, large: false, summary: nil) + baseURL: details.exchangeBaseUrl, large: false, + summary: nil, merchant: nil) } case .deposit(let depositTransaction): Group { let details = depositTransaction.details ThreeAmountsSheet(common: common, topAbbrev: String(localized: "Deposit:", comment: "mini"), topTitle: String(localized: "Amount to deposit:"), baseURL: nil, large: true, // TODO: baseURL - summary: nil) + summary: nil, merchant: nil) } case .payment(let paymentTransaction): Group { let details = paymentTransaction.details @@ -296,26 +297,32 @@ struct TransactionSummaryV: View { // .buttonStyle(TalerButtonStyle(type: .bordered)) ThreeAmountsSheet(common: common, topAbbrev: String(localized: "Pay:"), topTitle: String(localized: "Sum to be paid:"), - baseURL: nil, large: true, summary: details.info.summary) // TODO: baseURL + baseURL: nil, large: true, // TODO: baseURL + summary: details.info.summary, + merchant: details.info.merchant.name) } case .refund(let refundTransaction): Group { let details = refundTransaction.details // TODO: more details ThreeAmountsSheet(common: common, topAbbrev: String(localized: "Refunded:", comment: "mini"), topTitle: String(localized: "Refunded amount:"), - baseURL: nil, large: true, summary: nil) // TODO: baseURL, summary + baseURL: nil, large: true, // TODO: baseURL + summary: details.info?.summary, + merchant: details.info?.merchant.name) } case .reward(let rewardTransaction): Group { let details = rewardTransaction.details ThreeAmountsSheet(common: common, topAbbrev: String(localized: "Reward:", comment: "mini"), topTitle: String(localized: "Received Reward:"), - baseURL: details.exchangeBaseUrl, large: true, summary: nil) // TODO: summary + baseURL: details.exchangeBaseUrl, large: true, + summary: nil, merchant: nil) // TODO: summary } case .refresh(let refreshTransaction): Group { let details = refreshTransaction.details // TODO: details Text(details.refreshReason.rawValue) ThreeAmountsSheet(common: common, topAbbrev: String(localized: "Refreshed:", comment: "mini"), topTitle: String(localized: "Refreshed amount:"), - baseURL: nil, large: true, summary: nil) // TODO: baseURL + baseURL: nil, large: true, // TODO: baseURL + summary: nil, merchant: nil) } case .peer2peer(let p2pTransaction): Group { let details = p2pTransaction.details @@ -350,7 +357,8 @@ struct TransactionSummaryV: View { topAbbrev: localizedType + colon, topTitle: localizedType + colon, baseURL: details.exchangeBaseUrl, large: false, - summary: details.info.summary) + summary: details.info.summary, + merchant: nil) } // p2p } // switch } // Group