gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-ios] 202/204: bank accounts - w.i.p.


From: gnunet
Subject: [taler-taler-ios] 202/204: bank accounts - w.i.p.
Date: Thu, 05 Dec 2024 23:52:50 +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 2a00782a651659c7f38afeebd1add40bc706047d
Author: Marc Stibane <marc@taler.net>
AuthorDate: Thu Dec 5 23:07:14 2024 +0100

    bank accounts - w.i.p.
---
 .../Views/Settings/Bank/BankListView.swift         |  16 ++-
 .../Views/Settings/Bank/BankSectionView.swift      | 140 ++++++++++-----------
 2 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/TalerWallet1/Views/Settings/Bank/BankListView.swift 
b/TalerWallet1/Views/Settings/Bank/BankListView.swift
index 87de136..38f20fd 100644
--- a/TalerWallet1/Views/Settings/Bank/BankListView.swift
+++ b/TalerWallet1/Views/Settings/Bank/BankListView.swift
@@ -20,8 +20,12 @@ struct BankListView: View {
     @AppStorage("minimalistic") var minimalistic: Bool = false
     @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
 
-    @State var showAlert: Bool = false
+    @State var showAddDialog: Bool = false
     @State var newExchange: String = TESTEXCHANGE
+    @State var newBankAccount = KnownBankAccountsInfo(paytoUri: EMPTYSTRING,
+                                                  kycCompleted: false,
+                                                    currencies: [],
+                                                         alias: nil)
     @State private var bankAccounts: [KnownBankAccountsInfo] = []
 
     @MainActor
@@ -50,7 +54,7 @@ struct BankListView: View {
 #endif
         let a11yLabelStr = String(localized: "Add bank account", comment: 
"VoiceOver for the + button")
         let plusButton = PlusButton(accessibilityLabelStr: a11yLabelStr) {
-            showAlert = true
+            showAddDialog = true
         }
         let addTitleStr = String(localized: "Add bank account", comment: 
"title of the addExchange alert")
         let addButtonStr = String(localized: "Add", comment: "button in the 
addExchange alert")
@@ -76,9 +80,16 @@ struct BankListView: View {
                 .talerFont(.body)
         }
 
+        let addBankDest = BankEditView(stack: stack.push(),
+                                     account: newBankAccount)
+        let actions = Group {
+            NavLink($showAddDialog) { addBankDest }
+        }
+
         List {
             if bankAccounts.isEmpty {
                 emptyList
+                    .opacity(0)
             } else {
                 depositHint
                 ForEach(bankAccounts, id: \.self) { account in
@@ -88,6 +99,7 @@ struct BankListView: View {
                 }
             }
         }
+        .background(actions)
         .listStyle(myListStyle.style).anyView
         .refreshable {
             controller.hapticNotification(.success)
diff --git a/TalerWallet1/Views/Settings/Bank/BankSectionView.swift 
b/TalerWallet1/Views/Settings/Bank/BankSectionView.swift
index d13bcc4..5340297 100755
--- a/TalerWallet1/Views/Settings/Bank/BankSectionView.swift
+++ b/TalerWallet1/Views/Settings/Bank/BankSectionView.swift
@@ -95,85 +95,38 @@ struct BankSectionView: View {
         let kyc = account.kycCompleted ? String(localized: "verified")
                                        : String(localized: "not yet verified")
         let methods = [PaytoType.iban, PaytoType.xTalerBank]
+        let methodType = methods[selected].rawValue.uppercased()
+        let methodStr = (paytoType == .iban) ? iban
+                : (paytoType == .xTalerBank) ? xTaler
+                                             : "unknown payment method"
         Section {
-            if !minimalistic {
-                Text("Account holder:")
-                    .talerFont(.title3)
-                    .accessibilityAddTraits(.isHeader)
-                    .accessibilityRemoveTraits(.isStaticText)
-            }
-            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)
-                }
-            }.pickerStyle(.segmented)
-            .onChange(of: selected) { newValue in
-                paytoType = methods[newValue]
-            }
-
-            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")
-            }
-
-            HStack {
-                Spacer()
-                Text("Status: \(kyc)")
-            }.padding(.top, -4)
-
-            if account.currencies.count == 1 {
-                let currency = account.currencies[0]
-                Text(minimalistic ? currency
-                                  : "Currency: \(currency)")
-            } else {
-                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()
+            NavigationLink {
+                BankEditView(stack: stack.push(),
+                           account: account)
             } label: {
-                Label("Delete Account", systemImage: "trash")
+                VStack(alignment: .leading) {
+                    if account.currencies.count == 1 {
+                        BankSectionRow(title: String(localized: "Currency:"),
+                                       value: account.currencies[0])
+                    } else {
+                        if !minimalistic { Text("Currencies:") }
+                        ForEach (account.currencies, id: \.self) { currency in
+                            Text(currency)
+                                .frame(maxWidth: .infinity, alignment: 
.trailing)
+                        }
+                    }
+                    BankSectionRow(title: String(localized: "Note:"),
+                                   value: alias)
+                    BankSectionRow(title: String(localized: "Account holder:"),
+                                   value: accountHolder)
+                    BankSectionRow(title: String(localized: "\(methodType):", 
comment: "methodType:"),
+                                   value: methodStr)
+                    BankSectionRow(title: String(localized: "Status:"),
+                                   value: kyc)
+                }   .talerFont(.body)
+                    .accessibilityElement(children: .combine)
+                    .accessibilityHint("Double tap to edit the account")
             }
-                .buttonStyle(TalerButtonStyle(type: .bordered, disabled: 
disabled))
-                .disabled(disabled)
         } header: {
         }
         .listRowSeparator(.hidden)
@@ -188,3 +141,38 @@ struct BankSectionView: View {
         }
     }
 }
+
+struct BankSectionRow: View {
+    let title: String
+    let value: String
+
+    @AppStorage("minimalistic") var minimalistic: Bool = false
+
+    var body: some View {
+        let hLayout = HStack {
+            Text(title)
+            Spacer()
+            Text(value)
+        }
+        let vLayout = VStack(alignment: .leading) {
+            Text(title)
+            HStack {
+                Spacer()
+                Text(value)
+            }
+        }
+
+        if minimalistic {
+            Text(value)
+        } else if #available(iOS 16.0, *) {
+            ViewThatFits(in: .horizontal) {
+                hLayout
+                vLayout
+            }.accessibilityElement(children: .combine)
+        } else {
+            vLayout
+                .accessibilityElement(children: .combine)
+        }
+
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]