Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add watchOS support" #2086

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 0 additions & 10 deletions BuildConfigurations/StripeSupportsWatch Tests-Debug.xcconfig

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions BuildConfigurations/StripeSupportsWatch-Debug.xcconfig

This file was deleted.

9 changes: 0 additions & 9 deletions BuildConfigurations/StripeSupportsWatch-Release.xcconfig

This file was deleted.

7 changes: 0 additions & 7 deletions BuildConfigurations/StripeSupportsWatch-Shared.xcconfig

This file was deleted.

2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
## X.Y.Z 2022-xx-xx
### Apple Pay
* [Added] StripeApplePay now supports watchOS 6.2 or later. See [AppClipExample](Example/AppClipExample) for an example project.
### PaymentSheet
* [Added] Added `AddressViewController`, a customizable view controller that collects local and international addresses for your customers. See https://stripe.com/docs/elements/address-element?platform=ios.
* [Added] Added `PaymentSheet.Configuration.allowsPaymentMethodsRequiringShippingAddress`. Previously, to allow payment methods that require a shipping address (e.g. Afterpay and Affirm) in PaymentSheet, you attached a shipping address to the PaymentIntent before initializing PaymentSheet. Now, you can instead set this property to `true` and set `PaymentSheet.Configuration.shippingDetails` to a closure that returns your customers' shipping address. The shipping address will be attached to the PaymentIntent when the customer completes the checkout.
Expand Down
527 changes: 2 additions & 525 deletions Example/AppClipExample/AppClipExample.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

This file was deleted.

25 changes: 4 additions & 21 deletions Example/AppClipExample/Shared/PaymentButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,11 @@ struct PaymentButton: View {
extension PaymentButton {
#if os(iOS)
typealias ViewRepresentable = UIViewRepresentable
#elseif os(watchOS)
typealias ViewRepresentable = WKInterfaceObjectRepresentable
#else
typealias ViewRepresentable = NSViewRepresentable
#endif

struct Representable: ViewRepresentable {
#if os(watchOS)
typealias WKInterfaceObjectType = WKInterfacePaymentButton
#endif

var action: () -> Void

init(action: @escaping () -> Void) {
Expand All @@ -66,14 +60,6 @@ extension PaymentButton {
func updateUIView(_ rootView: UIView, context: Context) {
context.coordinator.action = action
}
#elseif os(watchOS)
func makeWKInterfaceObject(context: Context) -> WKInterfacePaymentButton {
WKInterfacePaymentButton(target: context.coordinator, action: #selector(Coordinator.callback))
}

func updateWKInterfaceObject(_ wkInterfaceObject: WKInterfacePaymentButton, context: Context) {
context.coordinator.action = action
}
#else
func makeNSView(context: Context) -> NSView {
context.coordinator.button
Expand All @@ -87,23 +73,21 @@ extension PaymentButton {

class Coordinator: NSObject {
var action: () -> Void
#if os(iOS) || os(macOS)
var button = PKPaymentButton(paymentButtonType: .buy, paymentButtonStyle: .automatic)
#endif

init(action: @escaping () -> Void) {
self.action = action
super.init()
#if os(iOS)
button.addTarget(self, action: #selector(callback), for: .touchUpInside)
#elseif os(macOS)
button.action = #selector(callback)
button.addTarget(self, action: #selector(callback(_:)), for: .touchUpInside)
#else
button.action = #selector(callback(_:))
button.target = self
#endif
}

@objc
func callback() {
func callback(_ sender: Any) {
action()
}
}
Expand All @@ -122,4 +106,3 @@ struct PaymentButton_Previews: PreviewProvider {
.previewLayout(.sizeThatFits)
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.