taler-ios

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

commit 1c756c729fe7137611db46e7bf7e4d5290682c9b
parent 540f62f8505ec2365e81e944d5f267d925b03247
Author: Marc Stibane <marc@taler.net>
Date:   Fri,  6 Nov 2026 04:05:46 +0100

cleanup

Diffstat:
MTalerCommon/ViewModifier/View+Condition.swift | 6++++++
MTalerWallet1/Views/HelperViews/SegmentControl.swift | 6++----
MTalerWallet1/Views/Main/WalletMain.swift | 8+++-----
MTalerWallet1/Views/Sheets/Payment/ChoicesView.swift | 3+--
MTalerWallet1/Views/Transactions/TransactionSummaryList.swift | 11++++-------
5 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/TalerCommon/ViewModifier/View+Condition.swift b/TalerCommon/ViewModifier/View+Condition.swift @@ -46,6 +46,12 @@ extension Bool { } return true // iOS 16+ } + static var iOS26: Bool { + guard #available(iOS 26, *) else { + return false // iOS 15..18 + } + return true // iOS 26+ + } } // Use like this: diff --git a/TalerWallet1/Views/HelperViews/SegmentControl.swift b/TalerWallet1/Views/HelperViews/SegmentControl.swift @@ -19,8 +19,7 @@ struct SegmentControl: View { @ScaledMetric var frameHeight = 60 // relative to fontSize public var body: some View { - let is26: Bool = if #available(iOS 26.0, *) { true } else { false } - let cornerRadius: CGFloat = is26 ? 16.0 : 6.0 + let cornerRadius: CGFloat = Bool.iOS26 ? 16.0 : 6.0 let count = accountDetails.count if count > 0 { ZStack(alignment: .center) { @@ -95,8 +94,7 @@ struct SegmentControl2: View { @Environment(\.colorSchemeContrast) private var colorSchemeContrast public var body: some View { - let is26: Bool = if #available(iOS 26.0, *) { true } else { false } - let cornerRadius: CGFloat = is26 ? 16.0 : 6.0 + let cornerRadius: CGFloat = Bool.iOS26 ? 16.0 : 6.0 let count = strings.count if count > 0 { ZStack(alignment: .center) { diff --git a/TalerWallet1/Views/Main/WalletMain.swift b/TalerWallet1/Views/Main/WalletMain.swift @@ -448,8 +448,6 @@ struct ActionsBubble: View { @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." @@ -460,11 +458,11 @@ struct ActionsBubble: View { .padding(.bottom, 20) } .padding(.horizontal, 30) .background { - BubblePath(is26: is26) + BubblePath() .fill(WalletColors().primaryAccent.opacity(0.6)) .padding(.horizontal, 30) } - .padding(.bottom, is26 ? 70 : 90) + .padding(.bottom, Bool.iOS26 ? 70 : 90) .contentShape(.rect) .onTapGesture { showIt = false @@ -473,7 +471,7 @@ struct ActionsBubble: View { } } struct BubblePath: Shape { - let is26: Bool // true: point to the bottom right, false: point to the middle + let is26 = Bool.iOS26 // true: point to the bottom right, false: point to the middle func path(in rect: CGRect) -> Path { var path = Path() diff --git a/TalerWallet1/Views/Sheets/Payment/ChoicesView.swift b/TalerWallet1/Views/Sheets/Payment/ChoicesView.swift @@ -12,8 +12,7 @@ struct SelectedBackground: View, Sendable { let useColor: Bool? var body: some View { - let is26: Bool = if #available(iOS 26.0, *) { true } else { false } - let rect = RoundedRectangle(cornerRadius: is26 ? 26 : 10) + let rect = RoundedRectangle(cornerRadius: Bool.iOS26 ? 26 : 10) let line = useColor == nil ? 0.5 : 2.4 let color = useColor == true ? WalletColors().primaryAccent : useColor == false ? .secondary : WalletColors().gray4 diff --git a/TalerWallet1/Views/Transactions/TransactionSummaryList.swift b/TalerWallet1/Views/Transactions/TransactionSummaryList.swift @@ -296,9 +296,6 @@ struct TransactionSummaryList: View { : isRepurchase ? String(localized: "Already paid", comment:"repurchase merchant navTitle") : talerTX.localizedType } - var is26: Bool { - if #available(iOS 26.0, *) { true } else { false } - } var body: some View { #if PRINT_CHANGES @@ -354,7 +351,7 @@ struct TransactionSummaryList: View { .safeAreaInset(edge: .bottom) { let cancelButton = Button("Cancel") { dismissTop(stack.push()) } .buttonStyle(TalerButtonStyle(type: .bordered)) - .padding(is26 ? .horizontal : .all) + .padding(Bool.iOS26 ? .horizontal : .all) let bottomButton = ZStack { if isPayDialog, case .payment(let paymentTransaction) = talerTX { let details = paymentTransaction.details @@ -373,7 +370,7 @@ struct TransactionSummaryList: View { } else if let showDone { Button("Done") { dismissTop(stack.push()) } .buttonStyle(TalerButtonStyle(type: showDone)) - .padding(is26 ? .horizontal : .all) + .padding(Bool.iOS26 ? .horizontal : .all) } } if controller.stalledConnection { @@ -385,11 +382,11 @@ struct TransactionSummaryList: View { .background { SelectedBackground(useColor: false) } - .padding(is26 ? .horizontal : .all) + .padding(Bool.iOS26 ? .horizontal : .all) .transition(.move(edge: .bottom)) } else { bottomButton - .padding(is26 ? .horizontal : .all) + .padding(Bool.iOS26 ? .horizontal : .all) .transition(.scale.combined(with: .opacity)) } }