taler-ios

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

commit a9f22bf0fc72b438a5051d54167ac9f8a38b18c8
parent 674b79152950dc59d71e588d1cabcda6a4976ef0
Author: Marc Stibane <marc@taler.net>
Date:   Thu,  5 Nov 2026 18:18:48 +0100

Bubble Onboarding

Diffstat:
MTalerWallet1/Controllers/PublicConstants.swift | 1+
MTalerWallet1/Views/Balances/BalancesListView.swift | 2++
MTalerWallet1/Views/Main/WalletEmptyView.swift | 11+++++++++--
MTalerWallet1/Views/Main/WalletMain.swift | 84++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 95 insertions(+), 3 deletions(-)

diff --git a/TalerWallet1/Controllers/PublicConstants.swift b/TalerWallet1/Controllers/PublicConstants.swift @@ -25,6 +25,7 @@ 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 +public let BUBBLE = 1 // how often the ActionsBubble is shown public let TAPPED = 3 // how often you need to tap on the Actions button before it loses its label public let DRAGGED = 2 // #times to drag to stop the auto-dragging public let DRAGDELAY = 0.5 diff --git a/TalerWallet1/Views/Balances/BalancesListView.swift b/TalerWallet1/Views/Balances/BalancesListView.swift @@ -15,6 +15,7 @@ struct BalancesListView: View { private let symLog = SymLogV(0) let stack: CallStack let title: String + let showBubble: Bool @Binding var selectedBalance: Balance? // set in TransactionsListView @Binding var showRealCashHint: Bool @Binding var reloadTransactions: Int @@ -47,6 +48,7 @@ struct BalancesListView: View { let list = List { if !controller.haveProdBalance && !controller.defaultExchanges.isEmpty && demoHints { ProdSectionView(stack: stack.push(), + showBubble: showBubble, showRealCashHint: $showRealCashHint, isEmpty: false, disabled: false) diff --git a/TalerWallet1/Views/Main/WalletEmptyView.swift b/TalerWallet1/Views/Main/WalletEmptyView.swift @@ -11,6 +11,7 @@ import taler_swift struct ProdSectionView: View { let stack: CallStack + let showBubble: Bool @Binding var showRealCashHint: Bool let isEmpty: Bool let disabled: Bool @@ -95,7 +96,7 @@ struct ProdSectionView: View { controller.talerURI = talerURI } } - .buttonStyle(TalerButtonStyle(type: isEmpty ? .prominent : .bordered, + .buttonStyle(TalerButtonStyle(type: (isEmpty && !showBubble) ? .prominent : .bordered, narrow: false, disabled: disabled, aligned: .center)) @@ -129,6 +130,7 @@ struct ProdSectionView: View { /// It is the very first thing the user sees after installing the app struct WalletEmptyHeader: View { let stack: CallStack + let showBubble: Bool @Binding var showRealCashHint: Bool @EnvironmentObject private var controller: Controller @@ -141,6 +143,7 @@ struct WalletEmptyHeader: View { var body: some View { let emptyView = WalletEmptyView(stack: stack.push("isEmpty"), + showBubble: showBubble, showRealCashHint: $showRealCashHint) // .navigationTitle("Taler Wallet") .refreshable { @@ -207,6 +210,7 @@ struct WalletHeader<Content: View> : View { struct WalletEmptyView: View { private let symLog = SymLogV(0) let stack: CallStack + let showBubble: Bool @Binding var showRealCashHint: Bool @EnvironmentObject private var controller: Controller @@ -220,6 +224,7 @@ struct WalletEmptyView: View { let list = List { if !controller.defaultExchanges.isEmpty { ProdSectionView(stack: stack.push(), + showBubble: showBubble, showRealCashHint: $showRealCashHint, isEmpty: true, disabled: withDrawStarted) } @@ -254,7 +259,8 @@ struct WalletEmptyView: View { } } } - .buttonStyle(TalerButtonStyle(type: .prominent, narrow: false, disabled: withDrawStarted, aligned: .center)) + .buttonStyle(TalerButtonStyle(type: showBubble ? .bordered : .prominent, + narrow: false, disabled: withDrawStarted, aligned: .center)) .disabled(withDrawStarted) .accessibilityIdentifier(A11yID.demoCashButton) // } header: { @@ -293,6 +299,7 @@ struct WalletEmptyView: View { struct WalletEmptyView_Previews: PreviewProvider { static var previews: some View { WalletEmptyView(stack: CallStack("Preview"), + showBubble: false, showRealCashHint: Binding.constant(true)) } } diff --git a/TalerWallet1/Views/Main/WalletMain.swift b/TalerWallet1/Views/Main/WalletMain.swift @@ -43,8 +43,10 @@ struct WalletMain: View { #endif @AppStorage("minimalistic") var minimalistic: Bool = false @AppStorage("tapped") var tapped: Int = 0 + @AppStorage("dragged") var dragged: Int = 0 @AppStorage("oimEuro") var oimEuro: Bool = false + @State private var showBubble: Bool = true @State private var shouldReloadBalances = 0 @State private var shouldReloadContacts = 0 @State private var shouldReloadMessages = 0 @@ -77,6 +79,12 @@ struct WalletMain: View { } } + public var isShowing: Bool { + let notTapped = tapped < BUBBLE + let notDragged = dragged < BUBBLE + return showBubble && (notTapped || notDragged) + } + // @available(iOS, deprecated: 26.0) // \|/ this doesn't work - should give a compiler warning when called from 26+, but doesn't @available(iOS, obsoleted: 26.0) @@ -179,7 +187,9 @@ struct WalletMain: View { let balancesStack = NavigationView { ZStack(alignment: .trailing) { if controller.balances.isEmpty { - WalletEmptyHeader(stack: stack.push(), showRealCashHint: $showRealCashHint) + WalletEmptyHeader(stack: stack.push(), + showBubble: isShowing, + showRealCashHint: $showRealCashHint) } else { // if #available(iOS 17.0, *) { // CarouselView(stack: stack.push(balancesTitle), @@ -188,6 +198,7 @@ struct WalletMain: View { // } else { // Fallback on earlier versions BalancesListView(stack: stack.push(balancesTitle), title: balancesTitle, + showBubble: isShowing, selectedBalance: $selectedBalance, // needed for sheets, gets set in TransactionsListView showRealCashHint: $showRealCashHint, reloadTransactions: $shouldReloadTransactions) @@ -319,6 +330,7 @@ struct WalletMain: View { if #unavailable(iOS 26.0) { tabBarView() } + ActionsBubble(showIt: $showBubble, isShowing: isShowing) } // ZStack .frame(maxWidth: .infinity, maxHeight: .infinity) .onNotification(.SendAction) { notification in @@ -429,4 +441,74 @@ struct WalletMain: View { } } } // Content +// MARK: - Bubble +struct ActionsBubble: View { + @Binding var showIt: Bool + let isShowing: Bool + @AppStorage("tapped") var tapped: Int = 0 + + var body: some View { + let is26: Bool = if #available(iOS 26.0, *) { true } else { false } + if isShowing { + VStack { + Text(tapped < BUBBLE ? "Tap the Actions button to start transactions, or scan a QR code." + : "Drag the Actions button upwards to directly start the QR scanner.") + .talerFont(.title) + .padding(10) + .foregroundColor(WalletColors().onPrimary) + .padding(.bottom, 20) + } .padding(.horizontal, 30) + .background { + BubblePath(is26: is26) + .fill(WalletColors().primaryAccent.opacity(0.6)) + .padding(.horizontal, 30) + } + .padding(.bottom, is26 ? 70 : 90) + .contentShape(.rect) + .onTapGesture { + showIt = false + } + } + } +} +struct BubblePath: Shape { + let is26: Bool // true: point to the bottom right, false: point to the middle + func path(in rect: CGRect) -> Path { + var path = Path() + + let cornerRadius: CGFloat = is26 ? 20: 12 + let arrowWidth: CGFloat = 40 + let arrowHeight: CGFloat = 20 + + path.move(to: CGPoint(x: cornerRadius, y: 0)) // top-left + path.addLine(to: CGPoint(x: rect.width - cornerRadius, y: 0)) // top-right + path.addArc(center: CGPoint(x: rect.width - cornerRadius, y: cornerRadius), radius: cornerRadius, startAngle: Angle(degrees: -90), endAngle: Angle(degrees: 0), clockwise: false) + if is26 { + path.addLine(to: CGPoint(x: rect.width, + y: rect.height - arrowHeight)) // bottom-right + path.addLine(to: CGPoint(x: rect.width - arrowWidth / 2, + y: rect.height)) + path.addLine(to: CGPoint(x: rect.width - arrowWidth, + y: rect.height - arrowHeight)) + } else { + path.addLine(to: CGPoint(x: rect.width, + y: rect.height - cornerRadius - arrowHeight)) // bottom-right + path.addArc(center: CGPoint(x: rect.width - cornerRadius, + y: rect.height - cornerRadius - arrowHeight), + radius: cornerRadius, startAngle: Angle(degrees: 0), + endAngle: Angle(degrees: 90), clockwise: false) + path.addLine(to: CGPoint(x: rect.width / 2 + arrowWidth / 2, + y: rect.height - arrowHeight)) + path.addLine(to: CGPoint(x: rect.width / 2, y: rect.height)) + path.addLine(to: CGPoint(x: rect.width / 2, y: rect.height)) + path.addLine(to: CGPoint(x: rect.width / 2 - arrowWidth / 2, y: rect.height - arrowHeight)) + } + path.addLine(to: CGPoint(x: cornerRadius, y: rect.height - arrowHeight)) // bottom-left + path.addArc(center: CGPoint(x: cornerRadius, y: rect.height - cornerRadius - arrowHeight), radius: cornerRadius, startAngle: Angle(degrees: 90), endAngle: Angle(degrees: 180), clockwise: false) + path.addLine(to: CGPoint(x: 0, y: cornerRadius)) + path.addArc(center: CGPoint(x: cornerRadius, y: cornerRadius), radius: cornerRadius, startAngle: Angle(degrees: 180), endAngle: Angle(degrees: 270), clockwise: false) + + return path + } +}