taler-ios

iOS apps for GNU Taler (wallet)
Log | Files | Refs | README | LICENSE

commit 348a090cb7505d688f11e1feb7eb36b9a9cf2400
parent bfaf17c0dd86af27ec33dce206dad8b0dc3a8158
Author: Marc Stibane <marc@taler.net>
Date:   Sat,  9 Nov 2024 10:47:56 +0100

demoHints

Diffstat:
MTalerWallet1/Views/Actions/ActionsSheet.swift | 18+++++++++---------
MTalerWallet1/Views/Settings/Exchange/ExchangeRowView.swift | 4+---
MTalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift | 29++++++++++++++++-------------
3 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/TalerWallet1/Views/Actions/ActionsSheet.swift b/TalerWallet1/Views/Actions/ActionsSheet.swift @@ -19,7 +19,7 @@ struct ActionsSheet: View { @Binding var qrButtonTapped: Bool @AppStorage("minimalistic") var minimalistic: Bool = false - @AppStorage("hideSpendingHint") var hideSpendingHint: Bool = false + @AppStorage("demoHints") var demoHints: Bool = true @EnvironmentObject private var controller: Controller private var hasKudos: Bool { @@ -50,7 +50,7 @@ struct ActionsSheet: View { .padding(.top, 5) .padding(.bottom, 10) - if hasKudos && !hideSpendingHint { + if hasKudos && demoHints { Text(minimalistic ? "Spend your \(DEMOCURRENCY) in the Demo shop" : "You can spend your \(DEMOCURRENCY) in the Demo shop, or send them to another wallet.") .talerFont(.body) @@ -59,7 +59,7 @@ struct ActionsSheet: View { let title = String(localized: "LinkTitle_DEMOSHOP", defaultValue: "Spend demo money") let shopAction = { - hideSpendingHint = true +// demoHints += 1 UIApplication.shared.open(URL(string:DEMOSHOP)!, options: [:]) dismissTop(stack.push()) } @@ -127,7 +127,7 @@ struct DualHeightSheet: View { .onChange(of: qrButtonTapped2) { tapped2 in if tapped2 { - logger.log("❗️the user tapped") +// logger.trace("❗️the user tapped") qrButtonTapped = true // tell our caller withAnimation(Animation.easeIn(duration: 0.6)) { // animate this sheet to full height @@ -137,13 +137,13 @@ struct DualHeightSheet: View { } .onChange(of: qrButtonTapped) { tapped in if !tapped { - logger.log("❗️dismissed, cleanup") + logger.trace("❗️dismissed, cleanup") sheetHeight = innerHeight qrButtonTapped2 = false } } .onChange(of: innerHeight) { newHeight in - logger.log("onChange❗️set sheetHeight: \(sheetHeight) -> \(newHeight)❗️") + logger.trace("onChange❗️set sheetHeight: \(sheetHeight) -> \(newHeight)❗️") // withAnimation { sheetHeight = newHeight selectedDetent = .height(sheetHeight) // will update detents in .onChange(:) @@ -152,16 +152,16 @@ struct DualHeightSheet: View { .presentationDetents(detents, selection: $selectedDetent) .onChange(of: selectedDetent) { newValue in if newValue == .large { - logger.log("onChange❗️selectedDetent = .large)") + logger.trace("onChange❗️selectedDetent = .large)") updateDetentsWithDelay() qrButtonTapped = true // tell our caller } else { - logger.log("onChange❗️selectedDetent = .height(\(sheetHeight))") + logger.trace("onChange❗️selectedDetent = .height(\(sheetHeight))") detents = [.large, .height(sheetHeight)] } } .task { - logger.log("task❗️selectedDetent = .height(\(sheetHeight))") + logger.trace("task❗️selectedDetent = .height(\(sheetHeight))") selectedDetent = .height(sheetHeight) // will update detents in .onChange(:) } // .animation(.spring(), value: selectedDetent) diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeRowView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeRowView.swift @@ -12,7 +12,6 @@ import SymLog struct ExchangeRowView: View { private let symLog = SymLogV(0) let stack: CallStack - @Binding var currencyInfo: CurrencyInfo // this is the currency to be used let exchange: Exchange @Environment(\.sizeCategory) var sizeCategory @@ -54,7 +53,7 @@ fileprivate struct ExchangeRow_Previews: PreviewProvider { @State private var amountToPreview = Amount(currency: LONGCURRENCY, cent: 1234) @State private var depositIBAN = "DE1234567890" @State private var accountHolder = "Marc Stibane" - @State private var currencyInfoL: CurrencyInfo = CurrencyInfo.zero(LONGCURRENCY) +// @State private var previewL: CurrencyInfo = CurrencyInfo.zero(LONGCURRENCY) // let amount = Amount(currency: LONGCURRENCY, cent: 123456) var body: some View { @@ -76,7 +75,6 @@ fileprivate struct ExchangeRow_Previews: PreviewProvider { exchangeUpdateStatus: .ready, ageRestrictionOptions: []) ExchangeRowView(stack: CallStack("Preview"), - currencyInfo: $currencyInfoL, exchange: exchange1) } } diff --git a/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift b/TalerWallet1/Views/Settings/Exchange/ExchangeSectionView.swift @@ -19,7 +19,7 @@ struct ExchangeSectionView: View { @EnvironmentObject private var model: WalletModel @EnvironmentObject private var controller: Controller @AppStorage("minimalistic") var minimalistic: Bool = false - @AppStorage("hideSpendingHint") var hideSpendingHint: Bool = false + @AppStorage("demoHints") var demoHints: Bool = true @State private var exchanges: [Exchange] = [] @State private var shouldReloadBalances: Int = 0 @@ -72,7 +72,7 @@ struct ExchangeSectionView: View { didDelete = true // change button text NotificationCenter.default.post(name: .ExchangeDeleted, object: nil, userInfo: nil) NotificationCenter.default.post(name: .BalanceChange, object: nil, userInfo: nil) - hideSpendingHint = false + demoHints = true } else { purge = true showAlert = true @@ -89,28 +89,31 @@ struct ExchangeSectionView: View { #endif let scopeInfo = balance.scopeInfo let currency = scopeInfo.currency -// let currencyInfo = controller.info(for: currency, controller.currencyTicker) Section { ForEach(exchanges) { exchange in ExchangeRowView(stack: stack.push(), - currencyInfo: $currencyInfo, exchange: exchange) .listRowSeparator(.hidden) } if DEMOCURRENCY == currency { + SettingsToggle(name: String(localized: "Demo Hints"), value: $demoHints, id1: "demoHints", + description: minimalistic ? nil : String(localized: "Show hints for demo money")) + .listRowSeparator(.hidden) let bankingHint = String(localized: "Since the demo bank supports the Taler integration, you can start a withdrawal directly on the") let linkTitle = String(localized: "LinkTitle_DEMOBANK", defaultValue: "Demo Bank Website") - VStack { - if !minimalistic { - Text(bankingHint) + if demoHints { + VStack { + if !minimalistic { + Text(bankingHint) + } + Link(linkTitle, destination: URL(string: DEMOBANK)!) + .buttonStyle(TalerButtonStyle(type: .bordered, narrow: false, aligned: .center)) } - Link(linkTitle, destination: URL(string: DEMOBANK)!) - .buttonStyle(TalerButtonStyle(type: .bordered, narrow: false, aligned: .center)) + .accessibilityElement(children: .combine) + .accessibilityLabel(bankingHint + " " + linkTitle) + .padding(.top) + .listRowSeparator(.hidden) } - .accessibilityElement(children: .combine) - .accessibilityLabel(bankingHint + " " + linkTitle) - .padding(.top) - .listRowSeparator(.hidden) } let buttonTitle = String(localized: "Exchange.Delete", defaultValue: "Delete payment service", comment: "Action button")