taler-ios

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

commit 1718ec797327587b4c77a6801c37eebb9aa439d7
parent 793599652b98b4b8ec04ba132be434498554e97c
Author: Marc Stibane <marc@taler.net>
Date:   Thu, 27 Aug 2026 09:15:54 +0200

extract WalletHeader

Diffstat:
MTalerWallet1/Views/Main/WalletEmptyView.swift | 37+++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/TalerWallet1/Views/Main/WalletEmptyView.swift b/TalerWallet1/Views/Main/WalletEmptyView.swift @@ -123,16 +123,14 @@ struct ProdSectionView: View { } } } - +// MARK: - /// This view shows hints if a wallet is empty /// It is the very first thing the user sees after installing the app - struct WalletEmptyHeader: View { let stack: CallStack @EnvironmentObject private var model: WalletModel @EnvironmentObject private var controller: Controller - @Environment(\.accessibilityVoiceOverEnabled) private var voiceOverEnabled func refresh() async { controller.hapticNotification(.success) @@ -141,6 +139,22 @@ struct WalletEmptyHeader: View { } var body: some View { + let emptyView = WalletEmptyView(stack: stack.push("isEmpty")) +// .navigationTitle("Taler Wallet") + .refreshable { + await refresh() + } + WalletHeader(showSettings: true, content: emptyView) + } +} +// MARK: - +struct WalletHeader<Content: View> : View { + let showSettings: Bool + let content: Content + + @Environment(\.accessibilityVoiceOverEnabled) private var voiceOverEnabled + + var body: some View { let talerLogo = HStack(spacing: 2) { Image(TALER_LOGO_FULL) // .border(Color.gray, width: 1) @@ -155,22 +169,17 @@ struct WalletEmptyHeader: View { .accessibilityAddTraits(.isHeader) .accessibilityLabel(Text("Taler Wallet", comment: "a11y")) - let emptyView = WalletEmptyView(stack: stack.push("isEmpty")) - // .navigationTitle("Taler Wallet") - .refreshable { - await refresh() - } let logoItem = ToolbarItem(placement: .principal) { talerLogo .padding(.top, 10) } - if #available(iOS 26.0, *) { + if showSettings, #available(iOS 26.0, *) { if voiceOverEnabled { - emptyView + content .toolbar { logoItem } } else { - emptyView + content .toolbar { ToolbarItem(placement: .principal) { HStack { @@ -187,12 +196,12 @@ struct WalletEmptyHeader: View { } } } else { // iOS 15..18 Settings is the 3rd tab - emptyView + content .toolbar { logoItem } } } } - +// MARK: - struct WalletEmptyView: View { private let symLog = SymLogV(0) let stack: CallStack @@ -275,7 +284,7 @@ struct WalletEmptyView: View { } } } - +// MARK: - struct WalletEmptyView_Previews: PreviewProvider { static var previews: some View { WalletEmptyView(stack: CallStack("Preview"))