diff --git a/WMFComponents/Package.swift b/WMFComponents/Package.swift index f540cef6cdc..7f782602582 100644 --- a/WMFComponents/Package.swift +++ b/WMFComponents/Package.swift @@ -5,7 +5,7 @@ import PackageDescription let package = Package( name: "WMFComponents", - platforms: [.iOS(.v15)], + platforms: [.iOS(.v16)], products: [ // Products define the executables and libraries a package produces, and make them visible to other packages. .library( diff --git a/WMFComponents/Sources/WMFComponents/Components/Donate Form/WMFDonateView.swift b/WMFComponents/Sources/WMFComponents/Components/Donate Form/WMFDonateView.swift index c004a2fd9ae..878577f8815 100644 --- a/WMFComponents/Sources/WMFComponents/Components/Donate Form/WMFDonateView.swift +++ b/WMFComponents/Sources/WMFComponents/Components/Donate Form/WMFDonateView.swift @@ -1,4 +1,5 @@ import SwiftUI +import _PassKit_SwiftUI public protocol WMFDonateDelegate: AnyObject { func donateDidTapProblemsDonatingLink() @@ -53,16 +54,18 @@ struct WMFDonateView: View { } Group { - WMFApplePayDonateButton(configuration: WMFApplePayDonateButton.Configuration(paymentButtonStyle: appEnvironment.theme.paymentButtonStyle)) - .onTapGesture { - viewModel.textfieldViewModel.hasFocus = false - viewModel.logTappedApplePayButton() - viewModel.validateAndSubmit() - if let errorViewModel = viewModel.errorViewModel { - errorViewModel.hasAccessibilityFocus = true - } + PayWithApplePayButton(.donate) { + viewModel.textfieldViewModel.hasFocus = false + viewModel.logTappedApplePayButton() + viewModel.validateAndSubmit() + if let errorViewModel = viewModel.errorViewModel { + errorViewModel.hasAccessibilityFocus = true } - .accessibilityHint(viewModel.accessibilityDonateButtonHint ?? "") + } fallback: { + + } + .payWithApplePayButtonStyle(appEnvironment.theme.applePayPaymentButtonStyle) + .accessibilityHint(viewModel.accessibilityDonateButtonHint ?? "") .frame(height: 42) .padding([.leading, .trailing], sizeClassDonateButtonPadding) Spacer() diff --git a/WMFComponents/Sources/WMFComponents/Components/Shared/Buttons/WMFApplePayDonateButton.swift b/WMFComponents/Sources/WMFComponents/Components/Shared/Buttons/WMFApplePayDonateButton.swift deleted file mode 100644 index e26d6ba334f..00000000000 --- a/WMFComponents/Sources/WMFComponents/Components/Shared/Buttons/WMFApplePayDonateButton.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Foundation -import SwiftUI -import PassKit -import UIKit - -struct WMFApplePayDonateButton: UIViewRepresentable { - - struct Configuration { - let paymentButtonStyle: PKPaymentButtonStyle - } - - let configuration: Configuration - - func makeUIView(context: Context) -> PKPaymentButton { - return PKPaymentButton(paymentButtonType: .donate, paymentButtonStyle: configuration.paymentButtonStyle) - } - - func updateUIView(_ uiView: PKPaymentButton, context: UIViewRepresentableContext) { - - } -} diff --git a/WMFComponents/Sources/WMFComponents/Style/WMFTheme.swift b/WMFComponents/Sources/WMFComponents/Style/WMFTheme.swift index 01fe8dda1dc..1910a136e02 100644 --- a/WMFComponents/Sources/WMFComponents/Style/WMFTheme.swift +++ b/WMFComponents/Sources/WMFComponents/Style/WMFTheme.swift @@ -7,7 +7,6 @@ public struct WMFTheme: Equatable { public let name: String public let userInterfaceStyle: UIUserInterfaceStyle public let keyboardAppearance: UIKeyboardAppearance - public let paymentButtonStyle: PKPaymentButtonStyle public let text: UIColor public let secondaryText: UIColor public let link: UIColor @@ -43,12 +42,15 @@ public struct WMFTheme: Equatable { public var preferredColorScheme: ColorScheme { return (self == WMFTheme.light || self == WMFTheme.sepia) ? .light : .dark } + + public var applePayPaymentButtonStyle: PayWithApplePayButtonStyle { + return (self == WMFTheme.light || self == WMFTheme.sepia) ? .black : .white + } public static let light = WMFTheme( name: "Light", userInterfaceStyle: .light, keyboardAppearance: .light, - paymentButtonStyle: .black, text: WMFColor.gray700, secondaryText: WMFColor.gray500, link: WMFColor.blue600, @@ -86,7 +88,6 @@ public struct WMFTheme: Equatable { name: "Sepia", userInterfaceStyle: .light, keyboardAppearance: .light, - paymentButtonStyle: .black, text: WMFColor.gray700, secondaryText: WMFColor.taupe600, link: WMFColor.blue600, @@ -124,7 +125,6 @@ public struct WMFTheme: Equatable { name: "Dark", userInterfaceStyle: .dark, keyboardAppearance: .dark, - paymentButtonStyle: .white, text: WMFColor.gray100, secondaryText: WMFColor.gray300, link: WMFColor.blue300, @@ -162,7 +162,6 @@ public struct WMFTheme: Equatable { name: "Black", userInterfaceStyle: .dark, keyboardAppearance: .dark, - paymentButtonStyle: .white, text: WMFColor.gray100, secondaryText: WMFColor.gray300, link: WMFColor.blue300,