[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 17/25: ThreeAmountsV cleanup
From: |
gnunet |
Subject: |
[taler-taler-ios] 17/25: ThreeAmountsV cleanup |
Date: |
Mon, 06 Nov 2023 20:40:24 +0100 |
This is an automated email from the git hooks/post-receive script.
marc-stibane pushed a commit to branch master
in repository taler-ios.
commit 0f8fbb80037ae1c7be45bb8a347d4a3cb0759744
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sat Nov 4 20:55:13 2023 +0100
ThreeAmountsV cleanup
---
TalerWallet.xcodeproj/project.pbxproj | 12 ++++----
.../Views/Sheets/P2P_Sheets/P2pPayURIView.swift | 16 +++++------
.../Sheets/P2P_Sheets/P2pReceiveURIView.swift | 16 +++++------
.../Views/Sheets/Payment/PayTemplateView.swift | 32 +++++++++++-----------
.../Views/Sheets/Payment/PaymentView.swift | 32 +++++++++++-----------
.../WithdrawBankIntegrated/WithdrawURIView.swift | 16 +++++------
.../{ThreeAmounts.swift => ThreeAmountsV.swift} | 32 ++++++++++++----------
7 files changed, 80 insertions(+), 76 deletions(-)
diff --git a/TalerWallet.xcodeproj/project.pbxproj
b/TalerWallet.xcodeproj/project.pbxproj
index 16283e0..9ca384c 100644
--- a/TalerWallet.xcodeproj/project.pbxproj
+++ b/TalerWallet.xcodeproj/project.pbxproj
@@ -99,7 +99,7 @@
4E3EAE672A990778009F1BE8 /* PendingOpsListView.swift in Sources
*/ = {isa = PBXBuildFile; fileRef = 4EB0954E2989CBFE0043A8A1 /*
PendingOpsListView.swift */; };
4E3EAE682A990778009F1BE8 /* WalletModel.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4EB095112989CBB00043A8A1 /* WalletModel.swift
*/; };
4E3EAE692A990778009F1BE8 /* URLSheet.swift in Sources */ = {isa
= PBXBuildFile; fileRef = 4EB095332989CBFE0043A8A1 /* URLSheet.swift */; };
- 4E3EAE6A2A990778009F1BE8 /* ThreeAmounts.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4ED2F94A2A278F5100453B40 /* ThreeAmounts.swift
*/; };
+ 4E3EAE6A2A990778009F1BE8 /* ThreeAmountsV.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4ED2F94A2A278F5100453B40 /* ThreeAmountsV.swift
*/; };
4E3EAE6B2A990778009F1BE8 /* Model+Withdraw.swift in Sources */
= {isa = PBXBuildFile; fileRef = 4EB0953D2989CBFE0043A8A1 /*
Model+Withdraw.swift */; };
4E3EAE6C2A990778009F1BE8 /* ExchangeSectionView.swift in
Sources */ = {isa = PBXBuildFile; fileRef = 4EC90C772A1B528B0071DC58 /*
ExchangeSectionView.swift */; };
4E3EAE6D2A990778009F1BE8 /* SendPurpose.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4E7940DD29FC307C00A9AEA1 /* SendPurpose.swift
*/; };
@@ -242,7 +242,7 @@
4EC90C782A1B528B0071DC58 /* ExchangeSectionView.swift in
Sources */ = {isa = PBXBuildFile; fileRef = 4EC90C772A1B528B0071DC58 /*
ExchangeSectionView.swift */; };
4ECB62802A0BA6DF004ABBB7 /* Model+P2P.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4ECB627F2A0BA6DF004ABBB7 /* Model+P2P.swift */;
};
4ECB62822A0BB01D004ABBB7 /* SelectDays.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4ECB62812A0BB01D004ABBB7 /* SelectDays.swift */;
};
- 4ED2F94B2A278F5100453B40 /* ThreeAmounts.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4ED2F94A2A278F5100453B40 /* ThreeAmounts.swift
*/; };
+ 4ED2F94B2A278F5100453B40 /* ThreeAmountsV.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4ED2F94A2A278F5100453B40 /* ThreeAmountsV.swift
*/; };
4EDBDCD92AB787CB00925C02 /* CallStack.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4EDBDCD82AB787CB00925C02 /* CallStack.swift */;
};
4EDBDCDA2AB787CB00925C02 /* CallStack.swift in Sources */ =
{isa = PBXBuildFile; fileRef = 4EDBDCD82AB787CB00925C02 /* CallStack.swift */;
};
4EEC157329F8242800D46A03 /* QRGeneratorView.swift in Sources */
= {isa = PBXBuildFile; fileRef = 4EEC157229F8242800D46A03 /*
QRGeneratorView.swift */; };
@@ -414,7 +414,7 @@
4EC90C772A1B528B0071DC58 /* ExchangeSectionView.swift */ = {isa
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift;
path = ExchangeSectionView.swift; sourceTree = "<group>"; };
4ECB627F2A0BA6DF004ABBB7 /* Model+P2P.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= "Model+P2P.swift"; sourceTree = "<group>"; };
4ECB62812A0BB01D004ABBB7 /* SelectDays.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= SelectDays.swift; sourceTree = "<group>"; };
- 4ED2F94A2A278F5100453B40 /* ThreeAmounts.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= ThreeAmounts.swift; sourceTree = "<group>"; };
+ 4ED2F94A2A278F5100453B40 /* ThreeAmountsV.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= ThreeAmountsV.swift; sourceTree = "<group>"; };
4EDBDCD82AB787CB00925C02 /* CallStack.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= CallStack.swift; sourceTree = "<group>"; };
4EEC157229F8242800D46A03 /* QRGeneratorView.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= QRGeneratorView.swift; sourceTree = "<group>"; };
4EEC157729F9032900D46A03 /* Sheet.swift */ = {isa =
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path
= Sheet.swift; sourceTree = "<group>"; };
@@ -693,7 +693,7 @@
4EB095312989CBFE0043A8A1 /*
TransactionDetailView.swift */,
4E87C8722A31CB7F001C6406 /*
TransactionsEmptyView.swift */,
4E6EDD842A3615BE0031D520 /*
ManualDetailsV.swift */,
- 4ED2F94A2A278F5100453B40 /* ThreeAmounts.swift
*/,
+ 4ED2F94A2A278F5100453B40 /* ThreeAmountsV.swift
*/,
);
path = Transactions;
sourceTree = "<group>";
@@ -1128,7 +1128,7 @@
4E3EAE672A990778009F1BE8 /*
PendingOpsListView.swift in Sources */,
4E3EAE682A990778009F1BE8 /* WalletModel.swift
in Sources */,
4E3EAE692A990778009F1BE8 /* URLSheet.swift in
Sources */,
- 4E3EAE6A2A990778009F1BE8 /* ThreeAmounts.swift
in Sources */,
+ 4E3EAE6A2A990778009F1BE8 /* ThreeAmountsV.swift
in Sources */,
4E3EAE6B2A990778009F1BE8 /*
Model+Withdraw.swift in Sources */,
4E3EAE6C2A990778009F1BE8 /*
ExchangeSectionView.swift in Sources */,
4E3EAE6D2A990778009F1BE8 /* SendPurpose.swift
in Sources */,
@@ -1237,7 +1237,7 @@
4EB095702989CBFE0043A8A1 /*
PendingOpsListView.swift in Sources */,
4EB095162989CBB00043A8A1 /* WalletModel.swift
in Sources */,
4EB0955A2989CBFE0043A8A1 /* URLSheet.swift in
Sources */,
- 4ED2F94B2A278F5100453B40 /* ThreeAmounts.swift
in Sources */,
+ 4ED2F94B2A278F5100453B40 /* ThreeAmountsV.swift
in Sources */,
4EB095622989CBFE0043A8A1 /*
Model+Withdraw.swift in Sources */,
4EC90C782A1B528B0071DC58 /*
ExchangeSectionView.swift in Sources */,
4E7940DE29FC307C00A9AEA1 /* SendPurpose.swift
in Sources */,
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
index 905670d..9e9ccc6 100644
--- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
+++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift
@@ -29,14 +29,14 @@ struct P2pPayURIView: View {
let effective = peerPullDebitResponse.amountEffective
let currency = raw.currencyStr
let fee = try! Amount.diff(raw, effective)
- ThreeAmountsView(topTitle: String(localized: "Amount to
pay:"),
- topAbbrev: String(localized: "Pay:"),
- topAmount: raw, fee: fee,
- bottomTitle: String(localized: "Amount to be
spent:"),
- bottomAbbrev: String(localized: "Effective:"),
- bottomAmount: effective,
- large: false, pending: false,
incoming: false,
- baseURL: nil)
+ ThreeAmountsV(topTitle: String(localized: "Amount to
pay:"),
+ topAbbrev: String(localized: "Pay:"),
+ topAmount: raw, fee: fee,
+ bottomTitle: String(localized: "Amount to be
spent:"),
+ bottomAbbrev: String(localized: "Effective:"),
+ bottomAmount: effective,
+ large: false, pending: false, incoming:
false,
+ baseURL: nil)
}
.listStyle(myListStyle.style).anyView
.navigationTitle(navTitle)
diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
index d8521e5..d856947 100644
--- a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
+++ b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift
@@ -29,14 +29,14 @@ struct P2pReceiveURIView: View {
let effective = peerPushCreditResponse.amountEffective
let currency = raw.currencyStr
let fee = try! Amount.diff(raw, effective)
- ThreeAmountsView(topTitle: String(localized: "Amount to
receive:"),
- topAbbrev: String(localized: "Receive:"),
- topAmount: raw, fee: fee,
- bottomTitle: String(localized: "Amount to be
obtained:"),
- bottomAbbrev: String(localized: "Effective:"),
- bottomAmount: effective,
- large: false, pending: false,
incoming: true,
- baseURL: nil)
+ ThreeAmountsV(topTitle: String(localized: "Amount to
receive:"),
+ topAbbrev: String(localized: "Receive:"),
+ topAmount: raw, fee: fee,
+ bottomTitle: String(localized: "Amount to
obtain:"),
+ bottomAbbrev: String(localized: "Effective:"),
+ bottomAmount: effective,
+ large: false, pending: false, incoming:
true,
+ baseURL: nil)
}
.listStyle(myListStyle.style).anyView
.navigationTitle(navTitle)
diff --git a/TalerWallet1/Views/Sheets/Payment/PayTemplateView.swift
b/TalerWallet1/Views/Sheets/Payment/PayTemplateView.swift
index e626cc2..7dda920 100644
--- a/TalerWallet1/Views/Sheets/Payment/PayTemplateView.swift
+++ b/TalerWallet1/Views/Sheets/Payment/PayTemplateView.swift
@@ -60,26 +60,26 @@ struct PayTemplateView: View {
if let effective {
// TODO: already paid
let fee = try! Amount.diff(raw, effective) // TODO:
different currencies
- ThreeAmountsView(topTitle: topTitle,
- topAbbrev: topAbbrev,
- topAmount: raw, fee: fee,
- bottomTitle: String(localized: "Amount to be
spent:"),
- bottomAbbrev: String(localized: "Effective:"),
- bottomAmount: effective,
- large: false, pending: false,
incoming: false,
- baseURL: baseURL)
+ ThreeAmountsV(topTitle: topTitle,
+ topAbbrev: topAbbrev,
+ topAmount: raw, fee: fee,
+ bottomTitle: String(localized: "Amount to
spend:"),
+ bottomAbbrev: String(localized: "Effective:"),
+ bottomAmount: effective,
+ large: false, pending: false, incoming:
false,
+ baseURL: baseURL)
// TODO: payment: popup with all possible exchanges, check
fees
} else if let balanceDetails = preparePayResult.balanceDetails
{ // Insufficient
Text("You don't have enough \(currency)")
.accessibilityFont(.body)
- ThreeAmountsView(topTitle: topTitle,
- topAbbrev: topAbbrev,
- topAmount: raw, fee: nil,
- bottomTitle: String(localized: "Amount
available:"),
- bottomAbbrev: String(localized: "Available:"),
- bottomAmount: balanceDetails.balanceAvailable,
- large: false, pending: false,
incoming: false,
- baseURL: baseURL)
+ ThreeAmountsV(topTitle: topTitle,
+ topAbbrev: topAbbrev,
+ topAmount: raw, fee: nil,
+ bottomTitle: String(localized: "Amount
available:"),
+ bottomAbbrev: String(localized: "Available:"),
+ bottomAmount: balanceDetails.balanceAvailable,
+ large: false, pending: false, incoming:
false,
+ baseURL: baseURL)
} 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
index 7a14aeb..27557b7 100644
--- a/TalerWallet1/Views/Sheets/Payment/PaymentView.swift
+++ b/TalerWallet1/Views/Sheets/Payment/PaymentView.swift
@@ -53,26 +53,26 @@ struct PaymentView: View {
if let effective {
// TODO: already paid
let fee = try! Amount.diff(raw, effective) // TODO:
different currencies
- ThreeAmountsView(topTitle: topTitle,
- topAbbrev: topAbbrev,
- topAmount: raw, fee: fee,
- bottomTitle: String(localized: "Amount to be
spent:"),
- bottomAbbrev: String(localized: "Effective:"),
- bottomAmount: effective,
- large: false, pending: false,
incoming: false,
- baseURL: baseURL)
+ ThreeAmountsV(topTitle: topTitle,
+ topAbbrev: topAbbrev,
+ topAmount: raw, fee: fee,
+ bottomTitle: String(localized: "Amount to
spend:"),
+ bottomAbbrev: String(localized: "Effective:"),
+ bottomAmount: effective,
+ large: false, pending: false, incoming:
false,
+ baseURL: baseURL)
// TODO: payment: popup with all possible exchanges, check
fees
} else if let balanceDetails = preparePayResult.balanceDetails
{ // Insufficient
Text("You don't have enough \(currency)")
.accessibilityFont(.body)
- ThreeAmountsView(topTitle: topTitle,
- topAbbrev: topAbbrev,
- topAmount: raw, fee: nil,
- bottomTitle: String(localized: "Available:"),
- bottomAbbrev: String(localized: "Available:"),
- bottomAmount: balanceDetails.balanceAvailable,
- large: false, pending: false,
incoming: false,
- baseURL: baseURL)
+ ThreeAmountsV(topTitle: topTitle,
+ topAbbrev: topAbbrev,
+ topAmount: raw, fee: nil,
+ bottomTitle: String(localized: "Amount
available:"),
+ bottomAbbrev: String(localized: "Available:"),
+ bottomAmount: balanceDetails.balanceAvailable,
+ large: false, pending: false, incoming:
false,
+ baseURL: baseURL)
} 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
index 89eda47..9b0f775 100644
--- a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
+++ b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawURIView.swift
@@ -36,14 +36,14 @@ struct WithdrawURIView: View {
let outColor = WalletColors().transactionColor(false)
let inColor = WalletColors().transactionColor(true)
- ThreeAmountsView(topTitle: String(localized: "Chosen
amount to withdraw:"),
- topAbbrev: String(localized: "Chosen:"),
- topAmount: raw, fee: fee,
- bottomTitle: String(localized: "Amount to be
withdrawn:"),
- bottomAbbrev: String(localized: "Effective:"),
- bottomAmount: effective,
- large: false, pending: false,
incoming: true,
- baseURL: exchangeBaseUrl)
+ ThreeAmountsV(topTitle: String(localized: "Chosen amount
to withdraw:"),
+ topAbbrev: String(localized: "Chosen:"),
+ topAmount: raw, fee: fee,
+ bottomTitle: String(localized: "Amount to be
withdrawn:"),
+ bottomAbbrev: String(localized: "Effective:"),
+ bottomAmount: effective,
+ large: false, pending: false, incoming:
true,
+ baseURL: exchangeBaseUrl)
let someCoins = SomeCoins(details: withdrawalAmountDetails)
QuiteSomeCoins(someCoins: someCoins, shouldShowFee: false,
currency: raw.currencyStr, amountEffective:
effective)
diff --git a/TalerWallet1/Views/Transactions/ThreeAmounts.swift
b/TalerWallet1/Views/Transactions/ThreeAmountsV.swift
similarity index 82%
rename from TalerWallet1/Views/Transactions/ThreeAmounts.swift
rename to TalerWallet1/Views/Transactions/ThreeAmountsV.swift
index ef77848..78fc1c1 100644
--- a/TalerWallet1/Views/Transactions/ThreeAmounts.swift
+++ b/TalerWallet1/Views/Transactions/ThreeAmountsV.swift
@@ -19,7 +19,9 @@ struct ThreeAmountsSheet: View {
let effective = common.amountEffective
let fee = common.fee()
let incoming = common.incoming()
- let pending = (common.txState.major == TransactionMajorState.pending)
+ let pending = (common.txState.major == .pending)
+ let isDone = (common.txState.major == .done)
+ let incomplete = !(isDone || pending)
let defaultBottomTitle = incoming ? (pending ? String(localized:
"Pending amount to obtain:")
: String(localized:
"Obtained amount:") )
@@ -27,24 +29,24 @@ struct ThreeAmountsSheet: View {
let defaultBottomAbbre = incoming ? (pending ? String(localized:
"Pending:")
: String(localized:
"Obtained:") )
: String(localized:
"Paid:")
- ThreeAmountsView(topTitle: topTitle, topAbbrev: topAbbrev, topAmount:
raw, fee: fee,
- bottomTitle: bottomTitle ?? defaultBottomTitle,
- bottomAbbrev: bottomAbbrev ?? defaultBottomAbbre,
- bottomAmount: effective,
- large: large, pending: pending, incoming: incoming,
- baseURL: baseURL,
- status: common.txState.major.localizedState)
+ ThreeAmountsV(topTitle: topTitle, topAbbrev: topAbbrev, topAmount:
raw, fee: fee,
+ bottomTitle: bottomTitle ?? defaultBottomTitle,
+ bottomAbbrev: bottomAbbrev ?? defaultBottomAbbre,
+ bottomAmount: incomplete ? nil : effective,
+ large: large, pending: pending, incoming: incoming,
+ baseURL: baseURL,
+ status: common.txState.major.localizedState)
}
}
// MARK: -
-struct ThreeAmountsView: View {
+struct ThreeAmountsV: View {
var topTitle: String
var topAbbrev: String
var topAmount: Amount
var fee: Amount?
var bottomTitle: String
var bottomAbbrev: String
- var bottomAmount: Amount
+ var bottomAmount: Amount?
let large: Bool
let pending: Bool
let incoming: Bool
@@ -71,10 +73,12 @@ struct ThreeAmountsView: View {
large: false)
.padding(.bottom, 4)
}
- AmountView(title: iconOnly ? bottomAbbrev : bottomTitle,
- value: bottomAmount.readableDescription,
- color: foreColor,
- large: large)
+ if let bottomAmount {
+ AmountView(title: iconOnly ? bottomAbbrev : bottomTitle,
+ value: bottomAmount.readableDescription,
+ color: foreColor,
+ large: large)
+ }
if let baseURL {
VStack(alignment: .leading) {
Text(iconOnly ? "Exchange:" : "Using Exchange:")
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 10/25: Use System Alert for iOS16+, (continued)
- [taler-taler-ios] 10/25: Use System Alert for iOS16+, gnunet, 2023/11/06
- [taler-taler-ios] 14/25: Blue Logo, gnunet, 2023/11/06
- [taler-taler-ios] 25/25: Bump version to 0.9.3 (24), gnunet, 2023/11/06
- [taler-taler-ios] 15/25: cleanup sortedTransactions, gnunet, 2023/11/06
- [taler-taler-ios] 07/25: IncompleteRowV, gnunet, 2023/11/06
- [taler-taler-ios] 09/25: Logger, gnunet, 2023/11/06
- [taler-taler-ios] 19/25: SendDone: Prevent double execution, gnunet, 2023/11/06
- [taler-taler-ios] 20/25: Debugging, gnunet, 2023/11/06
- [taler-taler-ios] 12/25: KYC - wip, gnunet, 2023/11/06
- [taler-taler-ios] 08/25: Accessibility, gnunet, 2023/11/06
- [taler-taler-ios] 17/25: ThreeAmountsV cleanup,
gnunet <=
- [taler-taler-ios] 11/25: cleanup, gnunet, 2023/11/06
- [taler-taler-ios] 22/25: Announce, gnunet, 2023/11/06