[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 45/54: TransactionDetails
From: |
gnunet |
Subject: |
[taler-taler-ios] 45/54: TransactionDetails |
Date: |
Fri, 30 Jun 2023 22:34:17 +0200 |
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 5747e3ce6c8901782c200e42270cc0a93c0d2948
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Jun 30 18:10:32 2023 +0200
TransactionDetails
---
.../Views/Transactions/TransactionDetailView.swift | 164 ++++++++++++---------
1 file changed, 92 insertions(+), 72 deletions(-)
diff --git a/TalerWallet1/Views/Transactions/TransactionDetailView.swift
b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
index 68f38d0..e1c2451 100644
--- a/TalerWallet1/Views/Transactions/TransactionDetailView.swift
+++ b/TalerWallet1/Views/Transactions/TransactionDetailView.swift
@@ -77,34 +77,51 @@ struct TransactionDetailView: View {
if transaction.isFailable { if let failAction {
TransactionButton(transactionId: common.transactionId,
command: .fail, action: failAction)
- } } // Delete button
+ } } // Fail button
if transaction.isDeleteable { if let deleteAction {
TransactionButton(transactionId: common.transactionId,
command: .delete, action: deleteAction)
} } // Delete button
-
- if let doneAction {
- DoneButton(doneAction: doneAction)
- } // Done button
+// if let doneAction {
+// DoneButton(doneAction: doneAction)
+// } // Done button
}.id(viewId) // change viewId to enforce a draw update
.listStyle(myListStyle.style).anyView
+ .safeAreaInset(edge: .bottom) {
+ if let doneAction {
+ Button("Done", action: doneAction)
+ .buttonStyle(TalerButtonStyle(type: .prominent))
+ .padding(.horizontal)
+ }
+ }
}.onNotification(.TransactionStateTransition) { notification in
if let transition = notification.userInfo?[TRANSACTIONTRANSITION]
as? TransactionTransition {
if transition.transactionId == common.transactionId {
- let newState = transition.newTxState.major
- if newState == .done { if let doneAction {
- symLog.log("newTxState.major == done => dismiss
sheet")
- doneAction() // if this view is in a sheet this
action will dissmiss it
- }} else { Task { do {
- if doneAction != nil { // don't update while we are in
a sheet - except done
- symLog.log("ignoring newState: \(newState)")
+ let newMajor = transition.newTxState.major
+ let newMinor = transition.newTxState.minor
+ if let doneAction {
+ if newMajor == .done {
+ symLog.log("newTxState.major == done => dismiss
sheet")
+ doneAction() // if this view is in a sheet
this action will dissmiss it
+ } else if newMajor == .pending {
+ if let newMinor {
+ if newMinor == .withdrawCoins { //
coin-withdrawal has started
+ symLog.log("newTxState.minor ==
withdrawCoins => dismiss sheet")
+ doneAction() // if this view is in
a sheet this action will dissmiss it
+ } else {
+ symLog.log("ignoring newTxState:
\(newMajor):\(newMinor)")
+ }
+ }
} else {
- symLog.log("newState: \(newState), reloading
transaction")
+ symLog.log("ignoring newTxState.major:
\(newMajor)")
+ }
+ } else { Task {
+ do {
+ symLog.log("newState: \(newMajor), reloading
transaction")
withAnimation() { transaction =
Transaction(dummyCurrency: DEMOCURRENCY); viewId = UUID() }
let reloadedTransaction = try await
reloadAction(common.transactionId)
symLog.log("reloaded transaction:
\(reloadedTransaction.common.txState.major)")
withAnimation() { transaction =
reloadedTransaction; viewId = UUID() } // redraw
- }
} catch {
symLog.log(error.localizedDescription)
}}}
@@ -142,69 +159,72 @@ struct TransactionDetailView: View {
var body: some View {
let common = transaction.common
let pending = transaction.isPending
- switch transaction {
- case .dummy(let dummyTransaction):
- Text("")
- case .withdrawal(let withdrawalTransaction):
- let details = withdrawalTransaction.details
- if pending {
- let withdrawalDetails = details.withdrawalDetails
- switch withdrawalDetails.type {
- case .manual: // "Make a wire
transfer of \(amount) to"
- ManualDetails(common: common, details:
withdrawalDetails)
-
- case .bankIntegrated: // "Confirm with bank"
- VStack {
- if let confirmationUrl =
withdrawalDetails.bankConfirmationUrl {
- if let destination = URL(string:
confirmationUrl) {
- // Show Hint that User should
Confirm on bank website
- Text("Waiting for bank
confirmation")
-
.multilineTextAlignment(.leading)
- .listRowSeparator(.hidden)
- Link("Confirm with bank",
destination: destination)
-
.buttonStyle(TalerButtonStyle(type: .prominent, narrow: false, aligned:
.center))
- .padding(.horizontal)
-
+ Group {
+ switch transaction {
+ case .dummy(let dummyTransaction):
+ Text("")
+ case .withdrawal(let withdrawalTransaction):
+ let details = withdrawalTransaction.details
+ if pending {
+ let withdrawalDetails = details.withdrawalDetails
+ switch withdrawalDetails.type {
+ case .manual: // "Make a wire
transfer of \(amount) to"
+ ManualDetails(common: common, details:
withdrawalDetails)
+
+ case .bankIntegrated: // "Confirm with
bank"
+ VStack {
+ if let confirmationUrl =
withdrawalDetails.bankConfirmationUrl {
+ if let destination = URL(string:
confirmationUrl) {
+ // Show Hint that User should
Confirm on bank website
+ Text("Waiting for bank
confirmation")
+
.multilineTextAlignment(.leading)
+ .listRowSeparator(.hidden)
+ Link("Confirm with bank",
destination: destination)
+
.buttonStyle(TalerButtonStyle(type: .prominent, narrow: false, aligned:
.center))
+ .padding(.horizontal)
+
+ }
}
}
- }
- }
- } // ManualDetails or Confirm with bank
- ThreeAmounts(common: common, topTitle: String(localized:
"Chosen amount to withdraw:"),
- baseURL:
withdrawalTransaction.details.exchangeBaseUrl, large: true)
- case .payment(let paymentTransaction):
- let details = paymentTransaction.details
- let info = details.info
- Text(info.summary)
- .font(.title)
- .lineLimit(4)
- .padding(.bottom)
- ThreeAmounts(common: common, topTitle: String(localized:
"Sum to be paid:"),
- baseURL: nil, large: true) // TODO:
baseURL
- case .refund(let refundTransaction):
- let details = refundTransaction.details //
TODO: more details
- ThreeAmounts(common: common, topTitle: String(localized:
"Refunded amount:"),
- baseURL: nil, large: true) // TODO:
baseURL
- case .reward(let rewardTransaction):
- let details = rewardTransaction.details //
TODO: more details
- ThreeAmounts(common: common, topTitle: String(localized:
"Received Reward:"),
- baseURL: details.exchangeBaseUrl, large: true)
+ }
+ } // ManualDetails or Confirm with bank
+ let _ = print("ThreeAmounts")
+ ThreeAmounts(common: common, topTitle:
String(localized: "Chosen amount to withdraw:"),
+ baseURL:
withdrawalTransaction.details.exchangeBaseUrl, large: true)
+ case .payment(let paymentTransaction):
+ let details = paymentTransaction.details
+ let info = details.info
+ Text(info.summary)
+ .font(.title)
+ .lineLimit(4)
+ .padding(.bottom)
+ ThreeAmounts(common: common, topTitle:
String(localized: "Sum to be paid:"),
+ baseURL: nil, large: true) // TODO:
baseURL
+ case .refund(let refundTransaction):
+ let details = refundTransaction.details
// TODO: more details
+ ThreeAmounts(common: common, topTitle:
String(localized: "Refunded amount:"),
+ baseURL: nil, large: true) // TODO:
baseURL
+ case .reward(let rewardTransaction):
+ let details = rewardTransaction.details
// TODO: more details
+ ThreeAmounts(common: common, topTitle:
String(localized: "Received Reward:"),
+ baseURL: details.exchangeBaseUrl, large:
true)
// case .tip(let tipTransaction):
// let details = tipTransaction.details //
TODO: details
// ThreeAmounts(common: common, topTitle: String(localized:
"Received Tip:"), large: true)
- case .refresh(let refreshTransaction):
- let details = refreshTransaction.details //
TODO: details
- ThreeAmounts(common: common, topTitle: String(localized:
"Refreshed amount:"),
- baseURL: nil, large: true) // TODO:
baseURL
- case .peer2peer(let p2pTransaction):
- let details = p2pTransaction.details //
TODO: details
- // TODO: isSendCoins should show QR only while not expired
- if pending || transaction.isSendCoins {
- QRCodeDetails(transaction: transaction)
- }
- ThreeAmounts(common: common, topTitle: String(localized:
"Peer to Peer:"),
- baseURL: details.exchangeBaseUrl, large:
false)
- }
+ case .refresh(let refreshTransaction):
+ let details = refreshTransaction.details
// TODO: details
+ ThreeAmounts(common: common, topTitle:
String(localized: "Refreshed amount:"),
+ baseURL: nil, large: true) // TODO:
baseURL
+ case .peer2peer(let p2pTransaction):
+ let details = p2pTransaction.details
// TODO: details
+ // TODO: isSendCoins should show QR only while not
expired
+ if pending || transaction.isSendCoins {
+ QRCodeDetails(transaction: transaction)
+ }
+ ThreeAmounts(common: common, topTitle:
String(localized: "Peer to Peer:"),
+ baseURL: details.exchangeBaseUrl, large:
false)
+ } // switch
+ } // Group
}
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 38/54: actions, (continued)
- [taler-taler-ios] 38/54: actions, gnunet, 2023/06/30
- [taler-taler-ios] 28/54: playSound, gnunet, 2023/06/30
- [taler-taler-ios] 32/54: Adjust DebugView for Notch, gnunet, 2023/06/30
- [taler-taler-ios] 20/54: viewID + comments, gnunet, 2023/06/30
- [taler-taler-ios] 31/54: bump Testflight version, gnunet, 2023/06/30
- [taler-taler-ios] 37/54: Decodable, gnunet, 2023/06/30
- [taler-taler-ios] 29/54: Model cleanup, gnunet, 2023/06/30
- [taler-taler-ios] 36/54: playSound, gnunet, 2023/06/30
- [taler-taler-ios] 44/54: BalanceReloaded, gnunet, 2023/06/30
- [taler-taler-ios] 35/54: developerMode, gnunet, 2023/06/30
- [taler-taler-ios] 45/54: TransactionDetails,
gnunet <=
- [taler-taler-ios] 39/54: Scrollview, gnunet, 2023/06/30
- [taler-taler-ios] 25/54: failTransaction, gnunet, 2023/06/30
- [taler-taler-ios] 23/54: Remove old view, gnunet, 2023/06/30
- [taler-taler-ios] 24/54: balance-change, gnunet, 2023/06/30
- [taler-taler-ios] 47/54: #available(iOS 17.0, *) only with Xcode 15, gnunet, 2023/06/30
- [taler-taler-ios] 46/54: ThreeAmountsSheet, gnunet, 2023/06/30
- [taler-taler-ios] 51/54: remove debugging, gnunet, 2023/06/30
- [taler-taler-ios] 22/54: cleaned up P2P, gnunet, 2023/06/30
- [taler-taler-ios] 54/54: iOS: bump version to 0.9.3 (10), gnunet, 2023/06/30
- [taler-taler-ios] 49/54: ScrollViewReader, gnunet, 2023/06/30