diff options
author | Marc Stibane <marc@taler.net> | 2024-04-15 19:55:32 +0200 |
---|---|---|
committer | Marc Stibane <marc@taler.net> | 2024-04-15 19:55:32 +0200 |
commit | 9fc70f32548fd28667ee80e7be07d42ba513fd08 (patch) | |
tree | 50725b89f4ec660193716f52204612c51387e795 | |
parent | 8837d688a3be08c4e28710c923896e1492799862 (diff) | |
download | taler-ios-9fc70f32548fd28667ee80e7be07d42ba513fd08.tar.gz taler-ios-9fc70f32548fd28667ee80e7be07d42ba513fd08.tar.bz2 taler-ios-9fc70f32548fd28667ee80e7be07d42ba513fd08.zip |
noFees
6 files changed, 33 insertions, 21 deletions
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift index e51f00a..fed0b41 100644 --- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift +++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift @@ -40,6 +40,7 @@ struct P2pPayURIView: View { bottomAmount: effective, large: false, pending: false, incoming: false, baseURL: nil, + noFees: nil, // TODO: check baseURL for fees status: nil, summary: peerPullDebitResponse.contractTerms.summary, merchant: nil) diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift index 9037682..09235bc 100644 --- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift +++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift @@ -49,6 +49,7 @@ struct P2pReceiveURIView: View { bottomAmount: effective, large: false, pending: false, incoming: true, baseURL: nil, + noFees: nil, // TODO: check baseURL for fees status: nil, summary: peerPushCreditResponse.contractTerms.summary, merchant: nil) diff --git a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift index 3b7ab98..7cb4903 100644 --- a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift +++ b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift @@ -49,6 +49,7 @@ struct PaymentView: View { bottomAmount: effective, large: false, pending: false, incoming: false, baseURL: baseURL, + noFees: nil, // TODO: check baseURL for fees status: nil, summary: terms.summary, merchant: terms.merchant.name) @@ -65,6 +66,7 @@ struct PaymentView: View { bottomAmount: balanceDetails.balanceAvailable, large: false, pending: false, incoming: false, baseURL: baseURL, + noFees: nil, // TODO: check baseURL for fees status: nil, summary: terms.summary, merchant: terms.merchant.name) diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift index 651b502..35840d1 100644 --- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift +++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift @@ -55,6 +55,7 @@ struct WithdrawURIView: View { bottomAmount: effective, large: false, pending: false, incoming: true, baseURL: exchange.exchangeBaseUrl, + noFees: exchange.noFees, status: nil, // common.txState.major.localizedState summary: nil, merchant: nil) diff --git a/TalerWallet1/Views/Transactions/ThreeAmountsV.swift b/TalerWallet1/Views/Transactions/ThreeAmountsV.swift index 1d05508..c5945df 100644 --- a/TalerWallet1/Views/Transactions/ThreeAmountsV.swift +++ b/TalerWallet1/Views/Transactions/ThreeAmountsV.swift @@ -13,6 +13,7 @@ struct ThreeAmountsSheet: View { var bottomTitle: String? var bottomAbbrev: String? let baseURL: String? + let noFees: Bool? // true if exchange charges no fees at all let large: Bool // set to false for QR or IBAN let summary: String? let merchant: String? @@ -42,6 +43,7 @@ struct ThreeAmountsSheet: View { bottomAmount: incomplete ? nil : effective, large: large, pending: pending, incoming: incoming, baseURL: baseURL, + noFees: noFees, status: common.txState.major.localizedState, summary: summary, merchant: merchant) @@ -61,6 +63,7 @@ struct ThreeAmountsV: View { let pending: Bool let incoming: Bool let baseURL: String? + let noFees: Bool? // true if exchange charges no fees at all let status: String? let summary: String? let merchant: String? @@ -73,6 +76,7 @@ struct ThreeAmountsV: View { let labelColor = WalletColors().labelColor let foreColor = pending ? WalletColors().pendingColor(incoming) : WalletColors().transactionColor(incoming) + let hasNoFees = noFees ?? false Section { if let summary { Text(summary) @@ -91,19 +95,21 @@ struct ThreeAmountsV: View { color: labelColor, large: false) .padding(.bottom, 4) - if let fee { - AmountRowV(title: minimalistic ? String(localized: "Fee (short):", defaultValue:"Fee:", comment:"short version") - : String(localized: "Fee (long):", defaultValue:"Fee:", comment:"long version"), - amount: fee, - color: labelColor, - large: false) - .padding(.bottom, 4) - } - if let bottomAmount { - AmountRowV(title: minimalistic ? bottomAbbrev : bottomTitle, - amount: bottomAmount, - color: foreColor, - large: large) + if hasNoFees == false { + if let fee { + AmountRowV(title: minimalistic ? String(localized: "Fee (short):", defaultValue:"Fee:", comment:"short version") + : String(localized: "Fee (long):", defaultValue:"Fee:", comment:"long version"), + amount: fee, + color: labelColor, + large: false) + .padding(.bottom, 4) + } + if let bottomAmount { + AmountRowV(title: minimalistic ? bottomAbbrev : bottomTitle, + amount: bottomAmount, + color: foreColor, + large: large) + } } if let baseURL { VStack(alignment: .leading) { @@ -146,7 +152,7 @@ struct ThreeAmounts_Previews: PreviewProvider { List { ThreeAmountsSheet(stack: CallStack("Preview"), common: common, topAbbrev: "Withdrawal", - topTitle: "Withdrawal", baseURL: DEMOEXCHANGE, + topTitle: "Withdrawal", baseURL: DEMOEXCHANGE, noFees: false, large: 1==0, summary: nil, merchant: nil) .safeAreaInset(edge: .bottom) { Button(String(localized: "Accept"), action: {}) diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift index 74d719b..375a94d 100644 --- a/TalerWallet1/Views/Transactions/TransactionSummaryV.swift +++ b/TalerWallet1/Views/Transactions/TransactionSummaryV.swift @@ -308,7 +308,7 @@ struct TransactionSummaryV: View { ThreeAmountsSheet(stack: stack.push(), common: common, topAbbrev: String(localized: "Chosen:", comment: "mini"), topTitle: String(localized: "Chosen amount to withdraw:"), - baseURL: details.exchangeBaseUrl, large: false, + baseURL: details.exchangeBaseUrl, noFees: nil, large: false, summary: nil, merchant: nil) } case .deposit(let depositTransaction): Group { @@ -316,7 +316,7 @@ struct TransactionSummaryV: View { ThreeAmountsSheet(stack: stack.push(), common: common, topAbbrev: String(localized: "Deposit:", comment: "mini"), topTitle: String(localized: "Amount to deposit:"), - baseURL: nil, large: true, // TODO: baseURL + baseURL: nil, noFees: nil, large: true, // TODO: baseURL, noFees summary: nil, merchant: nil) } case .payment(let paymentTransaction): Group { @@ -325,7 +325,7 @@ struct TransactionSummaryV: View { ThreeAmountsSheet(stack: stack.push(), common: common, topAbbrev: String(localized: "Price:", comment: "mini"), topTitle: String(localized: "Price (net):"), - baseURL: nil, large: true, // TODO: baseURL + baseURL: nil, noFees: nil, large: true, // TODO: baseURL, noFees summary: details.info.summary, merchant: details.info.merchant.name) } @@ -334,7 +334,7 @@ struct TransactionSummaryV: View { ThreeAmountsSheet(stack: stack.push(), common: common, topAbbrev: String(localized: "Refunded:", comment: "mini"), topTitle: String(localized: "Refunded amount:"), - baseURL: nil, large: true, // TODO: baseURL + baseURL: nil, noFees: nil, large: true, // TODO: baseURL, noFees summary: details.info?.summary, merchant: details.info?.merchant.name) } @@ -414,7 +414,8 @@ struct TransactionSummaryV: View { common: common, topAbbrev: localizedType + colon, topTitle: localizedType + colon, - baseURL: details.exchangeBaseUrl, large: false, + baseURL: details.exchangeBaseUrl, noFees: nil, // TODO: noFees + large: false, summary: details.info.summary, merchant: nil) } // p2p @@ -423,7 +424,7 @@ struct TransactionSummaryV: View { ThreeAmountsSheet(stack: stack.push(), common: common, topAbbrev: String(localized: "Recoup:", comment: "mini"), topTitle: String(localized: "Recoup:"), - baseURL: nil, large: true, // TODO: baseURL, noFees + baseURL: nil, noFees: nil, large: true, // TODO: baseURL, noFees summary: nil, merchant: nil) @@ -433,7 +434,7 @@ struct TransactionSummaryV: View { ThreeAmountsSheet(stack: stack.push(), common: common, topAbbrev: String(localized: "Lost:", comment: "mini"), topTitle: String(localized: "Money lost:"), - baseURL: details.exchangeBaseUrl, large: true, // TODO: baseURL, noFees + baseURL: details.exchangeBaseUrl, noFees: nil, large: true, // TODO: baseURL, noFees summary: details.lossEventType, merchant: nil) } |