[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 134/204: use addGlobalCurrency
From: |
gnunet |
Subject: |
[taler-taler-ios] 134/204: use addGlobalCurrency |
Date: |
Thu, 05 Dec 2024 23:51:42 +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 1394d4e786e0a4c37e6268fcbc785a94f2289d24
Author: Marc Stibane <marc@taler.net>
AuthorDate: Mon Nov 18 15:57:21 2024 +0100
use addGlobalCurrency
---
.../Settings/Exchange/ExchangeSectionView.swift | 32 +++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift
b/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift
index 3c5d8b5..45c7438 100755
--- a/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift
@@ -28,6 +28,7 @@ struct ExchangeSectionView: View {
@State private var disabled: Bool = false
@State private var showAlert: Bool = false
@State private var purge: Bool = false
+ @State private var global: Bool = false
// func amountAvailable(_ exchange: Exchange?, currency: String?) ->
Amount? {
// if let exchange {
@@ -49,6 +50,10 @@ struct ExchangeSectionView: View {
@MainActor
private func viewDidLoad() async {
if let exc = try? await model.listExchanges(scope: balance.scopeInfo) {
+ if exc.count > 0 {
+ let exchange = exc[0]
+ global = exchange.scopeInfo.type == .global
+ }
withAnimation { exchanges = exc }
}
}
@@ -82,6 +87,24 @@ struct ExchangeSectionView: View {
}
}
+ @MainActor
+ private func setGlobal() {
+ if exchanges.count > 0 {
+ let exchange = exchanges[0]
+ let scope = exchange.scopeInfo
+ Task {
+ if scope.type != .global {
+ try? await model.addGlobalCurrencyExchange(currency:
exchange.scopeInfo.currency,
+ baseUrl:
exchange.exchangeBaseUrl,
+ masterPub:
exchange.masterPub ?? EMPTYSTRING)
+ } else {
+ try? await model.rmvGlobalCurrencyExchange(currency:
exchange.scopeInfo.currency,
+ baseUrl:
exchange.exchangeBaseUrl,
+ masterPub:
exchange.masterPub ?? EMPTYSTRING)
+ }
+ }
+ }
+ }
var body: some View {
#if PRINT_CHANGES
let _ = Self._printChanges()
@@ -95,9 +118,16 @@ struct ExchangeSectionView: View {
exchange: exchange)
.listRowSeparator(.hidden)
}
+ if DEMOCURRENCY == currency || TESTCURRENCY == currency {
+ SettingsToggle(name: String(localized: "Global"), value:
$global.onChange({ isGlobal in
+ setGlobal()
+ }), id1: "global",
+ description: minimalistic ? nil : String(localized:
"Treat this as a global exchange"))
+ .listRowSeparator(.hidden)
+ }
if DEMOCURRENCY == currency {
SettingsToggle(name: String(localized: "Demo Hints"), value:
$demoHints, id1: "demoHints",
- description: minimalistic ? nil :
String(localized: "Show hints for demo money"))
+ description: minimalistic ? nil : String(localized:
"Show hints for demo money"))
.listRowSeparator(.hidden)
let bankingHint = String(localized: "Since the demo bank
supports the Taler integration, you can start a withdrawal directly on the")
let linkTitle = String(localized: "LinkTitle_DEMOBANK",
defaultValue: "Demo Bank Website")
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 128/204: less logging, (continued)
- [taler-taler-ios] 128/204: less logging, gnunet, 2024/12/05
- [taler-taler-ios] 129/204: currencyInfo, gnunet, 2024/12/05
- [taler-taler-ios] 131/204: wire fee, gnunet, 2024/12/05
- [taler-taler-ios] 115/204: Refund, gnunet, 2024/12/05
- [taler-taler-ios] 125/204: Button visible, gnunet, 2024/12/05
- [taler-taler-ios] 127/204: Remove "Amount too small", gnunet, 2024/12/05
- [taler-taler-ios] 130/204: Sheet logic, gnunet, 2024/12/05
- [taler-taler-ios] 117/204: Transactions, gnunet, 2024/12/05
- [taler-taler-ios] 133/204: addGlobalCurrency, gnunet, 2024/12/05
- [taler-taler-ios] 132/204: don't reload after delete, gnunet, 2024/12/05
- [taler-taler-ios] 134/204: use addGlobalCurrency,
gnunet <=
- [taler-taler-ios] 145/204: baseURL, gnunet, 2024/12/05
- [taler-taler-ios] 151/204: cleanup, gnunet, 2024/12/05
- [taler-taler-ios] 158/204: Logging, gnunet, 2024/12/05
- [taler-taler-ios] 140/204: wording, gnunet, 2024/12/05
- [taler-taler-ios] 154/204: show product images, gnunet, 2024/12/05
- [taler-taler-ios] 160/204: cleanup, gnunet, 2024/12/05
- [taler-taler-ios] 163/204: fix deposit, gnunet, 2024/12/05
- [taler-taler-ios] 165/204: get rid of P2P, gnunet, 2024/12/05
- [taler-taler-ios] 144/204: scope from balance, gnunet, 2024/12/05
- [taler-taler-ios] 135/204: Colors, gnunet, 2024/12/05