[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-ios] 191/204: layout, legal hint
From: |
gnunet |
Subject: |
[taler-taler-ios] 191/204: layout, legal hint |
Date: |
Thu, 05 Dec 2024 23:52:39 +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 aa26ebe2283fe6772303abea0ce8a511c7eae2f2
Author: Marc Stibane <marc@taler.net>
AuthorDate: Wed Dec 4 07:25:45 2024 +0100
layout, legal hint
---
.../Views/Settings/Bank/BankListView.swift | 17 +--
.../Views/Settings/Bank/BankSectionView.swift | 124 ++++++++++++++++-----
2 files changed, 105 insertions(+), 36 deletions(-)
diff --git a/TalerWallet1/Views/Settings/Bank/BankListView.swift
b/TalerWallet1/Views/Settings/Bank/BankListView.swift
index 0ad35b0..87de136 100644
--- a/TalerWallet1/Views/Settings/Bank/BankListView.swift
+++ b/TalerWallet1/Views/Settings/Bank/BankListView.swift
@@ -55,17 +55,15 @@ struct BankListView: View {
let addTitleStr = String(localized: "Add bank account", comment:
"title of the addExchange alert")
let addButtonStr = String(localized: "Add", comment: "button in the
addExchange alert")
- let sortedList = List(bankAccounts, id: \.self) { account in
- BankSectionView(stack: stack.push(),
- account: account)
- }
+ let depositHint = Text("You can only deposit to a bank account that
you control, otherwise you will not be able to fulfill the regulatory
requirements.")
- let emptyList = List {
+ let emptyList = Group {
Section {
Text("There are no bank accounts yet.")
.talerFont(.title3)
}
Section {
+ depositHint
let plus = Image(systemName: "plus")
if !minimalistic {
Text("Tap the \(plus) button to add an account.")
@@ -78,11 +76,16 @@ struct BankListView: View {
.talerFont(.body)
}
- Group {
+ List {
if bankAccounts.isEmpty {
emptyList
} else {
- sortedList
+ depositHint
+ ForEach(bankAccounts, id: \.self) { account in
+ BankSectionView(stack: stack.push(),
+ account: account)
+// Text(account.paytoUri)
+ }
}
}
.listStyle(myListStyle.style).anyView
diff --git a/TalerWallet1/Views/Settings/Bank/BankSectionView.swift
b/TalerWallet1/Views/Settings/Bank/BankSectionView.swift
index 9be4cff..d13bcc4 100755
--- a/TalerWallet1/Views/Settings/Bank/BankSectionView.swift
+++ b/TalerWallet1/Views/Settings/Bank/BankSectionView.swift
@@ -21,6 +21,7 @@ struct BankSectionView: View {
@AppStorage("minimalistic") var minimalistic: Bool = false
@AppStorage("demoHints") var demoHints: Bool = true
@AppStorage("fakeNoFees") var fakeNoFees: Bool = true
+ @AppStorage("ownerName") var ownerName: String = EMPTYSTRING
@State private var shouldReloadBalances: Int = 0
@State private var currencyInfo: CurrencyInfo = CurrencyInfo.zero(UNKNOWN)
@@ -29,12 +30,42 @@ struct BankSectionView: View {
@State private var showAlert: Bool = false
@State private var purge: 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 alias: String = EMPTYSTRING
+ @State private var paytoType: PaytoType = .iban
+ @State private var selected = 0
+ @FocusState private var focus:FocusedField?
+
+ enum FocusedField: Hashable {
+ case accountHolder, iban, xTaler, alias
+ }
+
+// @MainActor
+// private func validateIban() async {
+// if (try? await model.validateIban(iban)) == true {
+// let payto = "payto://iban/\(iban)?receiver-name=\(accountHolder)"
+// paytoUri = payto.addingPercentEncoding(withAllowedCharacters:
.urlQueryAllowed)!
+// } else {
+// paytoUri = nil
+// }
+// }
@MainActor
private func viewDidLoad() async {
-// if let exc = try? await model.listExchanges(scope:
balance.scopeInfo) {
-// withAnimation { exchanges = exc }
-// }
+ let payURL = URL(string: account.paytoUri)
+ iban = payURL?.iban ?? EMPTYSTRING
+ xTaler = payURL?.xTaler ?? EMPTYSTRING
+ alias = account.alias ?? EMPTYSTRING
+ if let queryParameters = payURL?.queryParameters {
+ let name = if let rcv = queryParameters["receiver-name"] {
+ rcv.replacingOccurrences(of: "+", with: SPACE)
+ } else {
+ ownerName
+ }
+ accountHolder = name
+ }
}
@MainActor
@@ -61,50 +92,81 @@ struct BankSectionView: View {
let _ = Self._printChanges()
// let _ = symLog.vlog() // just to get the # to compare it with
.onAppear & onDisappear
#endif
+ let kyc = account.kycCompleted ? String(localized: "verified")
+ : String(localized: "not yet verified")
+ let methods = [PaytoType.iban, PaytoType.xTalerBank]
Section {
- if let alias = account.alias {
- Text(alias)
+ if !minimalistic {
+ Text("Account holder:")
+ .talerFont(.title3)
+ .accessibilityAddTraits(.isHeader)
+ .accessibilityRemoveTraits(.isStaticText)
}
- let payURL = URL(string: account.paytoUri)
- if let queryParameters = payURL?.queryParameters {
- let name = if let rcv = queryParameters["receiver-name"] {
- rcv.replacingOccurrences(of: "+", with: " ")
- } else {
- EMPTYSTRING
+ TextField(minimalistic ? "Account holder" : EMPTYSTRING, text:
$accountHolder)
+ .focused($focus, equals: .accountHolder)
+ .talerFont(.title2)
+ .foregroundColor(WalletColors().fieldForeground) // text
color
+ .background(WalletColors().fieldBackground)
+ .textFieldStyle(.roundedBorder)
+ Picker(EMPTYSTRING, selection: $selected) {
+ ForEach(0..<methods.count, id: \.self) { index in
+ let method = methods[index]
+ Text(method.rawValue.uppercased())
+ .tag(index)
}
- Text("Holder: \(name)")
-
-
-// let amountStr = queryParameters["amount"] ?? EMPTYSTRING
-// let messageStr = queryParameters["message"] ?? EMPTYSTRING
-// let senderStr = queryParameters["sender-name"] ?? EMPTYSTRING
-
+ }.pickerStyle(.segmented)
+ .onChange(of: selected) { newValue in
+ paytoType = methods[newValue]
}
- let method = if let iban = payURL?.iban {
- Text("IBAN: \(iban)")
- } else if let xTaler = payURL?.xTaler {
- Text("TALER: \(xTaler)")
+ if paytoType == .iban {
+ TextField(EMPTYSTRING, text: $iban)
+ .focused($focus, equals: .iban)
+ .talerFont(.title2)
+ .foregroundColor(WalletColors().fieldForeground) //
text color
+ .background(WalletColors().fieldBackground)
+ .textFieldStyle(.roundedBorder)
+ } else if paytoType == .xTalerBank {
+ TextField(EMPTYSTRING, text: $xTaler)
+ .focused($focus, equals: .xTaler)
+ .talerFont(.title2)
+ .foregroundColor(WalletColors().fieldForeground) //
text color
+ .background(WalletColors().fieldBackground)
+ .textFieldStyle(.roundedBorder)
} else {
Text("unknown payment method")
}
- method
- let kyc = account.kycCompleted ? String(localized: "verified")
- : String(localized: "not yet
verified")
- Text(kyc)
- .padding(.leading)
+ HStack {
+ Spacer()
+ Text("Status: \(kyc)")
+ }.padding(.top, -4)
if account.currencies.count == 1 {
let currency = account.currencies[0]
- Text("Currency: \(currency)")
+ Text(minimalistic ? currency
+ : "Currency: \(currency)")
} else {
- Text("Currencies:")
+ if !minimalistic {
+ Text("Currencies:")
+ }
ForEach (account.currencies, id: \.self) { currency in
Text(currency)
.padding(.leading)
}
}
+ if !minimalistic {
+ Text("Note:")
+ .talerFont(.title3)
+ .accessibilityAddTraits(.isHeader)
+ .accessibilityRemoveTraits(.isStaticText)
+ }
+ TextField(minimalistic ? "Note" : EMPTYSTRING, text: $alias)
+ .focused($focus, equals: .alias)
+ .talerFont(.title2)
+ .foregroundColor(WalletColors().fieldForeground) // text
color
+ .background(WalletColors().fieldBackground)
+ .textFieldStyle(.roundedBorder)
Button {
deleteAccount()
} label: {
@@ -114,6 +176,10 @@ struct BankSectionView: View {
.disabled(disabled)
} header: {
}
+ .listRowSeparator(.hidden)
+ .onChange(of: focus) {
+ print($0)
+ }
.task { await viewDidLoad() }
// .task(id: controller.currencyTicker) { await
currencyTickerChanged(scopeInfo) }
.onDisappear() {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-taler-ios] 173/204: update after +, (continued)
- [taler-taler-ios] 173/204: update after +, gnunet, 2024/12/05
- [taler-taler-ios] 174/204: only in debug mode, gnunet, 2024/12/05
- [taler-taler-ios] 176/204: cleanup, comments, gnunet, 2024/12/05
- [taler-taler-ios] 179/204: Bump version to 0.13.8 (0.13.13), gnunet, 2024/12/05
- [taler-taler-ios] 180/204: Comparable, gnunet, 2024/12/05
- [taler-taler-ios] 181/204: don't update if same data, gnunet, 2024/12/05
- [taler-taler-ios] 188/204: regional exchange baseURL, gnunet, 2024/12/05
- [taler-taler-ios] 182/204: L10N helper, gnunet, 2024/12/05
- [taler-taler-ios] 184/204: don't add to knownBankAccounts, gnunet, 2024/12/05
- [taler-taler-ios] 190/204: timeToPay w.i.p., gnunet, 2024/12/05
- [taler-taler-ios] 191/204: layout, legal hint,
gnunet <=
- [taler-taler-ios] 194/204: A11y, gnunet, 2024/12/05
- [taler-taler-ios] 136/204: Available for transfer, gnunet, 2024/12/05
- [taler-taler-ios] 192/204: layout, gnunet, 2024/12/05
- [taler-taler-ios] 196/204: Nav header, gnunet, 2024/12/05
- [taler-taler-ios] 189/204: AccountPicker, gnunet, 2024/12/05
- [taler-taler-ios] 142/204: DepositAmountView, gnunet, 2024/12/05
- [taler-taler-ios] 153/204: products, gnunet, 2024/12/05
- [taler-taler-ios] 161/204: DepositWireTypesForCurrency, gnunet, 2024/12/05
- [taler-taler-ios] 150/204: layout improvement, gnunet, 2024/12/05
- [taler-taler-ios] 152/204: fix badge, gnunet, 2024/12/05