[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 20/32: Preparation for Exchange deposit only with posi
From: |
gnunet |
Subject: |
[taler-taler-ios] 20/32: Preparation for Exchange deposit only with positive balance |
Date: |
Mon, 16 Oct 2023 00:03:18 +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 fb7b78be9bc06ca86e74bb10b042b815c1fb5e9d
Author: Marc Stibane <marc@taler.net>
AuthorDate: Fri Oct 13 19:29:48 2023 +0200
Preparation for Exchange
deposit only with positive balance
---
TalerWallet1/Views/Exchange/ExchangeListView.swift | 3 +++
.../Views/Exchange/ExchangeSectionView.swift | 28 ++++++++++++++--------
TalerWallet1/Views/Main/MainView.swift | 4 +++-
3 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/TalerWallet1/Views/Exchange/ExchangeListView.swift
b/TalerWallet1/Views/Exchange/ExchangeListView.swift
index 9968448..2ff8532 100644
--- a/TalerWallet1/Views/Exchange/ExchangeListView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeListView.swift
@@ -11,6 +11,7 @@ struct ExchangeListView: View {
private let symLog = SymLogV(0)
let stack: CallStack
let navTitle: String
+ @Binding var balances: [Balance]
#if TABBAR // Taler Wallet
#else // GNU Taler
var hamburgerAction: () -> Void
@@ -59,6 +60,7 @@ struct ExchangeListView: View {
//Text("Exchanges...")
Content(symLog: symLog,
stack: stack.push(),
+ balances: $balances,
exchanges: $exchanges,
centsToTransfer: $centsToTransfer,
reloadAction: reloadAction)
@@ -95,6 +97,7 @@ extension ExchangeListView {
let symLog: SymLogV?
let stack: CallStack
@AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
+ @Binding var balances: [Balance]
@Binding var exchanges: [Exchange]
@Binding var centsToTransfer: UInt64
var reloadAction: () async -> Void
diff --git a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
index 3e2f57b..3e3d73d 100644
--- a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
@@ -8,21 +8,25 @@ import taler_swift
struct ExchangeRowView: View {
let stack: CallStack
let exchange: Exchange
+// let amount: Amount
let currency: String
@Binding var centsToTransfer: UInt64
+ @Environment(\.sizeCategory) var sizeCategory
@State private var buttonSelected: Int? = nil
func selectAndUpdate(_ button: Int) {
- Task { // runs on MainActor
- do {
- buttonSelected = button // will trigger NavigationLink
+ buttonSelected = button // will trigger NavigationLink
+ // while navigation animation runs, contact Exchange to update Fees
+// Task { // runs on MainActor
+// do {
// try await model.updateExchange(scopeInfo: balance.scopeInfo)
- } catch { // TODO: error handling - couldn't updateExchange
- // symLog.log("error: \(error)")
- }
- }
+// } catch { // TODO: error handling - couldn't updateExchange
+// // symLog.log("error: \(error)")
+// }
+// }
}
+
let depositTitle = String(localized: "Deposit", comment: "Top of button
<Deposit (currency)>")
let withdrawTitle = String(localized: "Withdraw", comment: "Top of button
<Withdraw (currency)>")
func needVStack(_ currency: String) -> Bool {
@@ -78,6 +82,7 @@ struct ExchangeRowView: View {
struct ExchangeSectionView: View {
let stack: CallStack
let currency: String
+// let amount: Amount
let exchanges: [Exchange]
@Binding var centsToTransfer: UInt64
@@ -92,11 +97,12 @@ struct ExchangeSectionView: View {
ExchangeRowView(stack: stack.push(),
exchange: exchange,
currency: currency,
+// amount: amount,
centsToTransfer: $centsToTransfer)
}
.accessibilityElement(children: .combine)
} header: {
- Text(currency)
+ Text(currency) // TODO: amount.currencyStr
.accessibilityFont(.title)
}
}
@@ -106,6 +112,7 @@ struct ExchangeSectionView: View {
struct ExchangeRow_Container : View {
@State private var centsToTransfer: UInt64 = 100
+// let amount = try! Amount(fromString: LONGCURRENCY + ":1234.56")
var body: some View {
let exchange1 = Exchange(exchangeBaseUrl: ARS_AGE_EXCHANGE,
currency: LONGCURRENCY,
@@ -121,8 +128,9 @@ struct ExchangeRow_Container : View {
exchangeEntryStatus: .ephemeral,
exchangeUpdateStatus: .ready,
ageRestrictionOptions: [])
- ExchangeSectionView(stack: CallStack("Preview"), currency:
LONGCURRENCY, exchanges: [exchange1, exchange2],
- centsToTransfer: $centsToTransfer)
+ ExchangeSectionView(stack: CallStack("Preview"), currency:
LONGCURRENCY,
+ exchanges: [exchange1, exchange2],
+ centsToTransfer: $centsToTransfer)
}
}
diff --git a/TalerWallet1/Views/Main/MainView.swift
b/TalerWallet1/Views/Main/MainView.swift
index 32d7ef0..4d61957 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -122,6 +122,7 @@ extension MainView {
sysImage: "building.columns",
view: AnyView(ExchangeListView(stack:
stack.push(exchangesTitle),
navTitle: exchangesTitle,
+ balances: $balances,
hamburgerAction: hamburgerAction)
)),
SidebarItem(name: settingsTitle, // TODO: "About"?
@@ -157,7 +158,8 @@ extension MainView {
NavigationView {
ExchangeListView(stack: stack.push(exchangesTitle),
- navTitle: exchangesTitle)
+ navTitle: exchangesTitle,
+ balances: $balances)
}
.tabItem {
Image(systemName: "building.columns")
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 23/32: fix for broken scalable font (not finished), (continued)
- [taler-taler-ios] 23/32: fix for broken scalable font (not finished), gnunet, 2023/10/15
- [taler-taler-ios] 11/32: bankAccessApiBaseUrl -> corebankApiBaseUrl, gnunet, 2023/10/15
- [taler-taler-ios] 12/32: AsyncSemaphore to serialize Getbalances, gnunet, 2023/10/15
- [taler-taler-ios] 31/32: comment, gnunet, 2023/10/15
- [taler-taler-ios] 25/32: Bargraph after Currency, gnunet, 2023/10/15
- [taler-taler-ios] 32/32: Bump version to 0.9.3 (20), gnunet, 2023/10/15
- [taler-taler-ios] 21/32: cleanup, gnunet, 2023/10/15
- [taler-taler-ios] 26/32: cleanup, gnunet, 2023/10/15
- [taler-taler-ios] 22/32: badge, gnunet, 2023/10/15
- [taler-taler-ios] 28/32: Button Layout, gnunet, 2023/10/15
- [taler-taler-ios] 20/32: Preparation for Exchange deposit only with positive balance,
gnunet <=
- [taler-taler-ios] 29/32: BarGraph also for Exchanges, gnunet, 2023/10/15
- [taler-taler-ios] 24/32: Balance button, gnunet, 2023/10/15