[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 04/06: use accountID
From: |
gnunet |
Subject: |
[taler-taler-ios] 04/06: use accountID |
Date: |
Mon, 09 Dec 2024 21:46:52 +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 6591f07e94b8361d94dee0174816181f8f6f14b7
Author: Marc Stibane <marc@taler.net>
AuthorDate: Mon Dec 9 18:57:04 2024 +0100
use accountID
---
.../Views/Settings/Bank/BankEditView.swift | 36 ++++++++++++----------
.../Views/Settings/Bank/BankListView.swift | 2 +-
.../Views/Settings/Bank/BankSectionView.swift | 11 +++----
3 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/TalerWallet1/Views/Settings/Bank/BankEditView.swift
b/TalerWallet1/Views/Settings/Bank/BankEditView.swift
index 0972d39..27a2883 100755
--- a/TalerWallet1/Views/Settings/Bank/BankEditView.swift
+++ b/TalerWallet1/Views/Settings/Bank/BankEditView.swift
@@ -14,7 +14,7 @@ import SymLog
struct BankEditView: View {
private let symLog = SymLogV(0)
let stack: CallStack
- let account: BankAccountsInfo
+ let accountID: String?
@EnvironmentObject private var model: WalletModel
@EnvironmentObject private var controller: Controller
@@ -29,12 +29,13 @@ struct BankEditView: 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
+// @State private var global: Bool = false
@State private var accountHolder: String = EMPTYSTRING
@State private var iban: String = EMPTYSTRING
@State private var xTaler: String = EMPTYSTRING
@State private var label: String = EMPTYSTRING
@State private var paytoType: PaytoType = .iban
+ @State private var currencies: [String] = []
@State private var selected = 0
@FocusState private var focus:FocusedField?
@@ -54,17 +55,20 @@ struct BankEditView: View {
@MainActor
private func viewDidLoad() async {
- let payURL = URL(string: account.paytoUri)
- iban = payURL?.iban ?? EMPTYSTRING
- xTaler = payURL?.xTaler ?? EMPTYSTRING
- label = account.label ?? EMPTYSTRING
- if let queryParameters = payURL?.queryParameters {
- let name = if let rcv = queryParameters["receiver-name"] {
- rcv.replacingOccurrences(of: "+", with: SPACE)
- } else {
- ownerName
+ if let accountID {
+ if let account = try? await model.getBankAccountById(accountID) {
+ let payURL = URL(string: account.paytoUri)
+ iban = payURL?.iban ?? EMPTYSTRING
+ xTaler = payURL?.xTaler ?? EMPTYSTRING
+ label = account.label ?? EMPTYSTRING
+ if let queryParameters = payURL?.queryParameters {
+ let name = queryParameters["receiver-name"] ?? ownerName
+ accountHolder = name.replacingOccurrences(of: "+", with:
SPACE)
+ }
+ currencies = account.currencies ?? []
}
- accountHolder = name
+ } else {
+
}
}
@@ -148,15 +152,15 @@ struct BankEditView: View {
}.padding(.bottom)
- if account.currencies.count == 1 {
- let currency = account.currencies[0]
+ if currencies.count == 1 {
+ let currency = currencies[0]
Text(minimalistic ? currency
: "Currency: \(currency)")
- } else {
+ } else if currencies.count > 1 {
if !minimalistic {
Text("Currencies:")
}
- ForEach (account.currencies, id: \.self) { currency in
+ ForEach (currencies, id: \.self) { currency in
Text(currency)
.padding(.leading)
}
diff --git a/TalerWallet1/Views/Settings/Bank/BankListView.swift
b/TalerWallet1/Views/Settings/Bank/BankListView.swift
index 9c3e90b..66656d0 100644
--- a/TalerWallet1/Views/Settings/Bank/BankListView.swift
+++ b/TalerWallet1/Views/Settings/Bank/BankListView.swift
@@ -77,7 +77,7 @@ struct BankListView: View {
}
let addBankDest = BankEditView(stack: stack.push(),
- account: nil)
+ accountID: nil)
let actions = Group {
NavLink($showAddDialog) { addBankDest }
}
diff --git a/TalerWallet1/Views/Settings/Bank/BankSectionView.swift
b/TalerWallet1/Views/Settings/Bank/BankSectionView.swift
index 6f17155..ee6263b 100755
--- a/TalerWallet1/Views/Settings/Bank/BankSectionView.swift
+++ b/TalerWallet1/Views/Settings/Bank/BankSectionView.swift
@@ -27,9 +27,8 @@ struct BankSectionView: View {
@State private var currencyInfo: CurrencyInfo = CurrencyInfo.zero(UNKNOWN)
@State private var didDelete: Bool = false
@State private var disabled: Bool = false
- @State private var showAlert: Bool = false
- @State private var purge: Bool = false
- @State private var global: Bool = false
+// @State private var purge: Bool = false
+
@State private var accountHolder: String = EMPTYSTRING
@State private var iban: String = EMPTYSTRING
@State private var xTaler: String = EMPTYSTRING
@@ -81,7 +80,6 @@ struct BankSectionView: View {
// demoHints = true
// } else {
// purge = true
-// showAlert = true
// disabled = false
// }
}
@@ -102,7 +100,7 @@ struct BankSectionView: View {
Section {
NavigationLink {
BankEditView(stack: stack.push(),
- account: account)
+ accountID: account.bankAccountId)
} label: {
VStack(alignment: .leading) {
if let currencies = account.currencies {
@@ -139,10 +137,9 @@ struct BankSectionView: View {
print($0)
}
.task { await viewDidLoad() }
-// .task(id: controller.currencyTicker) { await
currencyTickerChanged(scopeInfo) }
.onDisappear() {
disabled = false
- purge = false
+// purge = false
}
}
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] branch master updated (36ccf96 -> 73753bb), gnunet, 2024/12/09
- [taler-taler-ios] 01/06: re-add missing baseURL for regional, gnunet, 2024/12/09
- [taler-taler-ios] 02/06: fix a11y, gnunet, 2024/12/09
- [taler-taler-ios] 03/06: bank accounts, gnunet, 2024/12/09
- [taler-taler-ios] 04/06: use accountID,
gnunet <=
- [taler-taler-ios] 06/06: L10N comments, gnunet, 2024/12/09
- [taler-taler-ios] 05/06: Iban -> Select, gnunet, 2024/12/09