commit ee7ad70f50081262a205deb9042be5344b37b068 parent 7afe6f870ed7fa1e829bd4e0a4a6d861e9797dd1 Author: Marc Stibane <marc@taler.net> Date: Thu, 19 Dec 2024 20:46:01 +0100 hide tabBar in ToS Diffstat:
6 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/TalerWallet1/Controllers/PublicConstants.swift b/TalerWallet1/Controllers/PublicConstants.swift @@ -7,6 +7,7 @@ */ import Foundation +public let MAXEXCHANGES = 1000 // per currency public let CHF_4217 = "CHF" // ISO-4217 Swiss Francs public let EUR_4217 = "EUR" // ISO-4217 Euro public let HUF_4217 = "HUF" // ISO-4217 Hungarian Forint diff --git a/TalerWallet1/Views/Main/MainView.swift b/TalerWallet1/Views/Main/MainView.swift @@ -320,7 +320,7 @@ extension MainView { exchange: $exchange, // only for withdraw-exchange isSheet: false) /// each NavigationView needs its own NavLinks - let balanceActions = Group { + let balanceActions = Group { // actionSelected will hide the tabBar NavLink(1, $navModel.actionSelected) { sendDest } NavLink(2, $navModel.actionSelected) { requestDest } NavLink(3, $navModel.actionSelected) { depositDest } @@ -382,6 +382,7 @@ extension MainView { .ignoresSafeArea(.keyboard, edges: .bottom) .accessibilityHidden(true) // for a11y we use the original tabBar, not our custom one } // ZStack + .environmentObject(navModel) .frame(maxWidth: .infinity, maxHeight: .infinity) .onNotification(.SendAction) { triggerAction(1) } .onNotification(.RequestAction) { triggerAction(2) } diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeListView.swift @@ -84,9 +84,10 @@ struct ExchangeListCommonV: View { let _ = Self._printChanges() let _ = symLog?.vlog() // just to get the # to compare it with .onAppear & onDisappear #endif - let sortedList = List(controller.balances, id: \.self) { balance in + let sortedList = List(Array(controller.balances.enumerated()), id: \.element) { index, balance in ExchangeSectionView(stack: stack.push(), - balance: balance) + balance: balance, + thousand: index * MAXEXCHANGES) } let emptyList = List { diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeRowView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeRowView.swift @@ -13,10 +13,12 @@ struct ExchangeRowView: View { private let symLog = SymLogV(0) let stack: CallStack let exchange: Exchange + let index: Int @Environment(\.sizeCategory) var sizeCategory @EnvironmentObject private var controller: Controller @EnvironmentObject private var model: WalletModel + @EnvironmentObject private var navModel: NavigationModel @AppStorage("minimalistic") var minimalistic: Bool = false var body: some View { @@ -36,12 +38,33 @@ struct ExchangeRowView: View { .talerFont(.body) } } + let cellView = HStack { + rowView + Spacer() + Text(Image(systemName: "chevron.right")) + .talerFont(.table) + .foregroundColor(.secondary) + }.background { // only needed for .onTapGesture + Color.gray.opacity(0.001) + } let showToS = WithdrawTOSView(stack: stack.push(), exchangeBaseUrl: baseURL, viewID: VIEW_WITHDRAW_TOS, acceptAction: nil) // pop back to here + let actions = Group { + NavLink(index, $navModel.tosView) { showToS } + } + Group { - NavigationLink(destination: showToS) { rowView } +// NavigationLink(destination: showToS) { rowView } + cellView + .background(actions) + .onTapGesture { + navModel.tosView = index + } +// .task { +// navModel.tosView = false +// } }.listRowSeparator(.hidden) } } @@ -75,7 +98,8 @@ fileprivate struct ExchangeRow_Previews: PreviewProvider { exchangeUpdateStatus: .ready, ageRestrictionOptions: []) ExchangeRowView(stack: CallStack("Preview"), - exchange: exchange1) + exchange: exchange1, + index: 1) } } diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift @@ -15,6 +15,7 @@ struct ExchangeSectionView: View { private let symLog = SymLogV(0) let stack: CallStack let balance: Balance + let thousand: Int @EnvironmentObject private var model: WalletModel @EnvironmentObject private var controller: Controller @@ -102,9 +103,11 @@ struct ExchangeSectionView: View { let scopeInfo = balance.scopeInfo let currency = scopeInfo.currency Section { - ForEach(exchanges) { exchange in + ForEachWithIndex(data: exchanges) { index, exchange in + let _ = symLog.log("Index: \(thousand + index)") ExchangeRowView(stack: stack.push(), - exchange: exchange) + exchange: exchange, + index: thousand + index + 1) .listRowSeparator(.hidden) } if developerMode && (DEMOCURRENCY == currency || TESTCURRENCY == currency) { diff --git a/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift b/TalerWallet1/Views/Sheets/WithdrawBankIntegrated/WithdrawTOSView.swift @@ -163,7 +163,8 @@ extension WithdrawTOSView { .padding(.horizontal) list.safeAreaInset(edge: .bottom) { if showButton { - button.padding(.bottom, 40) + button +// .padding(.bottom, 40) } } }