commit 856c05ae94fbe17e9788e2873cb780015c7d6cde parent 0353dcaea3e0aea4e1aeaca2158e2c4701b5cbf8 Author: Marc Stibane <marc@taler.net> Date: Thu, 6 Jul 2023 18:03:53 +0200 List handling Diffstat:
9 files changed, 31 insertions(+), 24 deletions(-)
diff --git a/TalerWallet1/Views/Balances/BalancesSectionView.swift b/TalerWallet1/Views/Balances/BalancesSectionView.swift @@ -193,17 +193,17 @@ fileprivate struct BindingViewContainer : View { scopeInfo: scopeInfo, requiresUserInput: false, hasPendingTransactions: true) - List { - BalancesSectionView(balance: balance, - centsToTransfer: $centsToTransfer, - summary: $summary) - } + BalancesSectionView(balance: balance, + centsToTransfer: $centsToTransfer, + summary: $summary) } } struct BalancesSectionView_Previews: PreviewProvider { static var previews: some View { - BindingViewContainer() + List { + BindingViewContainer() + } } } #endif diff --git a/TalerWallet1/Views/Exchange/ExchangeSectionView.swift b/TalerWallet1/Views/Exchange/ExchangeSectionView.swift @@ -87,16 +87,16 @@ struct ExchangeRow_Container : View { exchangeStatus: "exchangeStatus", ageRestrictionOptions: [], permanent: false) - List { ExchangeSectionView(currency: LONGCURRENCY, exchanges: [exchange1, exchange2], centsToTransfer: $centsToTransfer) - } } } struct ExchangeRow_Previews: PreviewProvider { static var previews: some View { - ExchangeRow_Container() + List { + ExchangeRow_Container() + } } } #endif diff --git a/TalerWallet1/Views/Main/WalletEmptyView.swift b/TalerWallet1/Views/Main/WalletEmptyView.swift @@ -27,9 +27,8 @@ struct WalletEmptyView: View { Text("Just register a test account, then withdraw some coins.") } } -// .padding(.vertical) - .font(.title2) .listStyle(myListStyle.style).anyView + .font(.title2) .background(WalletColors().backgroundColor.edgesIgnoringSafeArea(.all)) .onAppear() { DebugViewC.shared.setViewID(VIEW_EMPTY) // 10 diff --git a/TalerWallet1/Views/Payment/PaymentURIView.swift b/TalerWallet1/Views/Payment/PaymentURIView.swift @@ -13,6 +13,7 @@ struct PaymentURIView: View { let navTitle = String(localized: "Confirm Payment", comment:"pay merchant") @EnvironmentObject private var controller: Controller + @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic // the scanned URL let url: URL @@ -42,7 +43,7 @@ struct PaymentURIView: View { var body: some View { if let detailsForUri { ScrollViewReader { scrollView in - VStack { + List { let baseURL = detailsForUri.contractTerms.exchanges.first?.url let raw = detailsForUri.amountRaw let effective = detailsForUri.amountEffective @@ -52,17 +53,18 @@ struct PaymentURIView: View { topAmount: raw, fee: fee, bottomTitle: String(localized: "\(currency) to be spent:"), bottomAmount: effective, - large: true, pending: false, incoming: false, + large: false, pending: false, incoming: false, baseURL: baseURL) // TODO: payment: popup with all possible exchanges, check fees - .safeAreaInset(edge: .bottom) { - Button(navTitle, action: { acceptAction(detailsForUri: detailsForUri) }) - .buttonStyle(TalerButtonStyle(type: .prominent)) - .padding(.horizontal) - } + } + .listStyle(myListStyle.style).anyView + .safeAreaInset(edge: .bottom) { + Button(navTitle, action: { acceptAction(detailsForUri: detailsForUri) }) + .buttonStyle(TalerButtonStyle(type: .prominent)) + .padding(.horizontal) } .navigationTitle(navTitle) - } + } // ScrollViewReader } else { let badURL = "Error in URL: \(url)" WithdrawProgressView(message: url.host ?? badURL) diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pPayURIView.swift @@ -16,6 +16,7 @@ struct P2pPayURIView: View { let url: URL @EnvironmentObject private var model: WalletModel + @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic @State private var peerPullDebitResponse: PreparePeerPullDebitResponse? @@ -34,6 +35,7 @@ struct P2pPayURIView: View { large: false, pending: false, incoming: false, baseURL: nil) } + .listStyle(myListStyle.style).anyView .navigationTitle(navTitle) NavigationLink(destination: LazyView { diff --git a/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift b/TalerWallet1/Views/Sheets/P2P_Sheets/P2pReceiveURIView.swift @@ -11,6 +11,7 @@ import SymLog struct P2pReceiveURIView: View { private let symLog = SymLogV() let navTitle = String(localized: "Accept P2P Receive") + @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic // the scanned URL let url: URL @@ -34,6 +35,7 @@ struct P2pReceiveURIView: View { large: false, pending: false, incoming: true, baseURL: nil) } + .listStyle(myListStyle.style).anyView .navigationTitle(navTitle) let tosAccepted = true // TODO: https://bugs.gnunet.org/view.php?id=7869 if tosAccepted { diff --git a/TalerWallet1/Views/Transactions/TransactionsEmptyView.swift b/TalerWallet1/Views/Transactions/TransactionsEmptyView.swift @@ -19,10 +19,10 @@ struct TransactionsEmptyView: View { Section { Text("There are no transactions for \(currency).") } + .font(.title2) } - .padding(.vertical) - .font(.title2) .listStyle(myListStyle.style).anyView +// .padding(.vertical) .background(WalletColors().backgroundColor.edgesIgnoringSafeArea(.all)) .onAppear() { DebugViewC.shared.setViewID(VIEW_EMPTY) // 10 diff --git a/TalerWallet1/Views/Transactions/TransactionsListView.swift b/TalerWallet1/Views/Transactions/TransactionsListView.swift @@ -110,12 +110,12 @@ extension TransactionsListView { } } // .onDelete(perform: removeItems) // delete this row from the list - } + }.id(viewId) + .listStyle(myListStyle.style).anyView .refreshable { symLog?.log("refreshing") await reloadAllAction() - }.id(viewId) - .listStyle(myListStyle.style).anyView + } .onAppear { if showUpDown { upAction = { withAnimation { scrollView.scrollTo(0) }} diff --git a/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift b/TalerWallet1/Views/WithdrawBankIntegrated/WithdrawURIView.swift @@ -17,6 +17,7 @@ struct WithdrawURIView: View { let url: URL @EnvironmentObject private var model: WalletModel + @AppStorage("myListStyle") var myListStyle: MyListStyle = .automatic // the exchange used for this withdrawal. @State private var exchangeBaseUrl: String? = nil @@ -44,6 +45,7 @@ struct WithdrawURIView: View { QuiteSomeCoins(someCoins: someCoins, shouldShowFee: false, currency: raw.currencyStr, amountEffective: effective) } + .listStyle(myListStyle.style).anyView .navigationTitle(navTitle) let tosAccepted = withdrawalAmountDetails.tosAccepted if tosAccepted {