gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-ios] 26/32: cleanup


From: gnunet
Subject: [taler-taler-ios] 26/32: cleanup
Date: Mon, 16 Oct 2023 00:03:24 +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 4fd028f803c537e9156a8452a2d310de8db0fdff
Author: Marc Stibane <marc@taler.net>
AuthorDate: Sun Oct 15 08:14:33 2023 +0200

    cleanup
---
 TalerWallet1/Views/Balances/BalancesListView.swift    | 18 +++++++++---------
 TalerWallet1/Views/Exchange/ExchangeListView.swift    | 18 +++++++++---------
 TalerWallet1/Views/Exchange/ExchangeSectionView.swift |  8 ++++----
 TalerWallet1/Views/HelperViews/Buttons.swift          |  2 --
 TalerWallet1/Views/Main/MainView.swift                | 10 +++++-----
 5 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift 
b/TalerWallet1/Views/Balances/BalancesListView.swift
index 0e140b9..8ccad0c 100644
--- a/TalerWallet1/Views/Balances/BalancesListView.swift
+++ b/TalerWallet1/Views/Balances/BalancesListView.swift
@@ -81,7 +81,7 @@ struct BalancesListView: View {
 
     /// runs on MainActor if called in some Task {}
     @discardableResult
-    private func reloadAction(_ stack: CallStack, _ invalidateCache: Bool) 
async -> Int {
+    private func reloadBalances(_ stack: CallStack, _ invalidateCache: Bool) 
async -> Int {
         if invalidateCache {
             model.cachedBalances = nil
         }
@@ -103,7 +103,7 @@ struct BalancesListView: View {
 #endif
         Content(symLog: symLog, stack: stack.push(), balances: $balances,
                 centsToTransfer: $centsToTransfer, summary: $summary,
-                reloadAction: reloadAction)
+                reloadBalances: reloadBalances)
             .navigationTitle(navTitle)
             .navigationBarItems(leading: hamburger,
                                 trailing: QRButton(action: 
checkCameraAvailable))
@@ -120,7 +120,7 @@ struct BalancesListView: View {
                 symLog.log(".task shouldReloadBalances 
\(shouldReloadBalances)")
                 let invalidateCache = (lastReloadedBalances != 
shouldReloadBalances)
                 lastReloadedBalances = shouldReloadBalances
-                await reloadAction(stack.push(".task"), invalidateCache)
+                await reloadBalances(stack.push(".task"), invalidateCache)
             } // task
     }
 }
@@ -133,7 +133,7 @@ extension BalancesListView {
         @Binding var balances: [Balance]
         @Binding var centsToTransfer: UInt64
         @Binding var summary: String
-        var reloadAction: (_ stack: CallStack, _ invalidateCache: Bool) async 
-> Int
+        var reloadBalances: (_ stack: CallStack, _ invalidateCache: Bool) 
async -> Int
 
         var body: some View {
 #if DEBUG
@@ -147,10 +147,10 @@ extension BalancesListView {
                 } else {
                     List(balances, id: \.self) { balance in
                         BalancesSectionView(stack: 
stack.push("\(balance.available.currencyStr)"),
-                                            balance: balance,
-                                            sectionCount: count,
-                                            centsToTransfer: $centsToTransfer,
-                                            summary: $summary)
+                                          balance: balance,
+                                     sectionCount: count,
+                                  centsToTransfer: $centsToTransfer,
+                                          summary: $summary)
                     }
                     .onAppear() {
                         DebugViewC.shared.setViewID(VIEW_BALANCES, stack: 
stack.push("onAppear"))
@@ -160,7 +160,7 @@ extension BalancesListView {
             }
             .refreshable {  // already async
                 symLog?.log("refreshing balances")
-                let count = await reloadAction(stack.push("refreshing 
balances"), true)
+                let count = await reloadBalances(stack.push("refreshing 
balances"), true)
                 if count > 0 {
                     NotificationCenter.default.post(name: .BalanceReloaded, 
object: nil)
                 }
diff --git a/TalerWallet1/Views/Exchange/ExchangeListView.swift 
b/TalerWallet1/Views/Exchange/ExchangeListView.swift
index 2ff8532..47c74c8 100644
--- a/TalerWallet1/Views/Exchange/ExchangeListView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeListView.swift
@@ -10,8 +10,8 @@ import SymLog
 struct ExchangeListView: View {
     private let symLog = SymLogV(0)
     let stack: CallStack
+//    @Binding var balances: [Balance]
     let navTitle: String
-    @Binding var balances: [Balance]
 #if TABBAR  // Taler Wallet
 #else       // GNU Taler
     var hamburgerAction: () -> Void
@@ -24,7 +24,7 @@ struct ExchangeListView: View {
     // source of truth for the value the user enters in currencyField for 
exchange withdrawals
     @State private var centsToTransfer: UInt64 = 0        // TODO: different 
values for different currencies?
 
-    func reloadAction() async -> Void {
+    func reloadExchanges() async -> Void {
             exchanges = await model.listExchangesM()
     }
 
@@ -60,10 +60,10 @@ struct ExchangeListView: View {
         //Text("Exchanges...")
         Content(symLog: symLog,
                  stack: stack.push(),
-              balances: $balances,
+//              balances: $balances,
              exchanges: $exchanges,
        centsToTransfer: $centsToTransfer,
-          reloadAction: reloadAction)
+       reloadExchanges: reloadExchanges)
         .navigationTitle(navTitle)
         .navigationBarItems(leading: hamburger,
                             trailing: PlusButton(action: plusAction)
@@ -76,7 +76,7 @@ struct ExchangeListView: View {
         }
         .task {
             symLog.log(".task")
-            await reloadAction()
+            await reloadExchanges()
         }
         .textFieldAlert(isPresented: $showAlert, title: "Add Exchange",
                         doneText: "Add", text: $newExchange, action: 
addExchange)
@@ -97,10 +97,10 @@ extension ExchangeListView {
         let symLog: SymLogV?
         let stack: CallStack
         @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic
-        @Binding var balances: [Balance]
+//        @Binding var balances: [Balance]
         @Binding var exchanges: [Exchange]
         @Binding var centsToTransfer: UInt64
-        var reloadAction: () async -> Void
+        var reloadExchanges: () async -> Void
 
         func currenciesDict(_ exchanges: [Exchange]) -> [String : [Exchange]] {
             var currencies: [String : [Exchange]] = [:]
@@ -129,7 +129,7 @@ extension ExchangeListView {
                 }
                 .refreshable {
                     symLog?.log("refreshing")
-                    await reloadAction()
+                    await reloadExchanges()
                 }
                 .listStyle(myListStyle.style).anyView
             }
@@ -139,7 +139,7 @@ extension ExchangeListView {
             .onNotification(.ExchangeAdded) { notification in
                 // doesn't need to be received on main thread because we just 
reload in the background anyway
                 symLog?.log(".onNotification(.ExchangeAdded) ==> reloading 
exchanges")
-                Task { await reloadAction() } // runs on MainActor
+                Task { await reloadExchanges() } // runs on MainActor
             }
         } // body
     }
diff --git a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift 
b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
index cbb8528..692e750 100644
--- a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
+++ b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift
@@ -73,8 +73,8 @@ struct ExchangeRowView: View {
 /// [Deposit Coins]  [Withdraw Coins]
 struct ExchangeSectionView: View {
     let stack: CallStack
-    let currency: String
 //    let amount: Amount
+    let currency: String          // TODO: amount.currencyStr
     let exchanges: [Exchange]
 
     @Binding var centsToTransfer: UInt64
@@ -88,14 +88,14 @@ struct ExchangeSectionView: View {
             ForEach(exchanges) { exchange in
                 ExchangeRowView(stack: stack.push(),
                              exchange: exchange,
-                             currency: currency,
 //                               amount: amount,
+                             currency: currency,            // TODO: 
(balance.available) amount.isZero to disable Deposit-button
                       centsToTransfer: $centsToTransfer)
             }
             .accessibilityElement(children: .combine)
         } header: {
-            Text(currency)          // TODO: amount.currencyStr
-                .accessibilityFont(.title)
+            Text(currency)
+                .accessibilityFont(.title2)
         }
     }
 }
diff --git a/TalerWallet1/Views/HelperViews/Buttons.swift 
b/TalerWallet1/Views/HelperViews/Buttons.swift
index fb7f57b..945c86e 100644
--- a/TalerWallet1/Views/HelperViews/Buttons.swift
+++ b/TalerWallet1/Views/HelperViews/Buttons.swift
@@ -5,8 +5,6 @@
 import SwiftUI
 import Foundation
 
-
-
 extension ShapeStyle where Self == Color {
     static var random: Color {
         Color(
diff --git a/TalerWallet1/Views/Main/MainView.swift 
b/TalerWallet1/Views/Main/MainView.swift
index 4b6cae9..4acf74d 100644
--- a/TalerWallet1/Views/Main/MainView.swift
+++ b/TalerWallet1/Views/Main/MainView.swift
@@ -111,7 +111,7 @@ extension MainView {
 
         var views: [SidebarItem] {[
             SidebarItem(name: balancesTitle,
-                    sysImage: "creditcard.fill",        // TODO: Wallet Icon
+                    sysImage: "chart.bar.xaxis",  // creditcard.fill     // 
TODO: Wallet Icon
                         view: AnyView(BalancesListView(stack: 
stack.push(balancesTitle),
                                                     navTitle: balancesTitle,
                                                     balances: $balances,
@@ -121,8 +121,8 @@ extension MainView {
             SidebarItem(name: exchangesTitle,
                     sysImage: "building.columns",
                         view: AnyView(ExchangeListView(stack: 
stack.push(exchangesTitle),
+//                                                    balances: $balances,
                                                     navTitle: exchangesTitle,
-                                                    balances: $balances,
                                              hamburgerAction: hamburgerAction)
                                      )),
             SidebarItem(name: settingsTitle,    // TODO: "About"?
@@ -151,7 +151,7 @@ extension MainView {
                       shouldReloadBalances: $shouldReloadBalances)
                 }
                 .tabItem {
-                    Image(systemName: "creditcard")             // system will 
automatically use filled variant
+                    Image(systemName: "chart.bar.xaxis")             // 
creditcard     system will automatically use filled variant
                     if !iconOnly { Text(balancesTitle) }
                 }
                 .tag(Tab.balances)
@@ -159,8 +159,8 @@ extension MainView {
 
                 NavigationView {
                     ExchangeListView(stack: stack.push(exchangesTitle),
-                                  navTitle: exchangesTitle,
-                                  balances: $balances)
+//                                  balances: $balances,
+                                  navTitle: exchangesTitle)
                 }
                 .tabItem {
                     Image(systemName: "building.columns")

-- 
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]