-
Notifications
You must be signed in to change notification settings - Fork 328
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
Remove presentCodeRedemptionSheet from PaymentQueueWrapper & Use SK2 APIs #4378
base: main
Are you sure you want to change the base?
Changes from all commits
3a5dc05
feffc97
a73b131
ad97628
49f75f1
38e1085
7ef33c6
f86c2f4
027d18d
d0f5d98
80c7c37
9c952c9
e2545dd
e7aebe3
409dcac
6ce7f09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -679,6 +679,28 @@ public protocol PurchasesType: AnyObject { | |
|
||
#if os(iOS) || VISION_OS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was the |
||
|
||
/** | ||
* Displays a sheet that enables users to redeem subscription offer codes that you generated in App Store Connect. | ||
* | ||
* - Important: Even though the docs in `SKPaymentQueue.presentCodeRedemptionSheet` | ||
* say that it's available on Catalyst 14.0, there is a note: | ||
* "`This function doesn’t affect Mac apps built with Mac Catalyst.`" | ||
* when, in fact, it crashes when called both from Catalyst and also when running as "Designed for iPad". | ||
* This is why RevenueCat's SDK makes it unavailable in mac catalyst. | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean calling this function of the SDK has been crashing on Catalyst and iOS apps running on macOS? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For Catalyst, nope! Luckily the old version of For "Designed for iPad" on macOS, I haven't tested it myself, but I wouldn't be surprised if the existing SDK function is crashing, since this PR introduces the |
||
@available( | ||
iOS, | ||
introduced: 14.0, | ||
deprecated, | ||
renamed: "presentCodeRedemptionSheet(_:)", | ||
message: "Use async/throwing version instead" | ||
) | ||
@available(watchOS, unavailable) | ||
@available(tvOS, unavailable) | ||
@available(macOS, unavailable) | ||
@available(macCatalyst, unavailable) | ||
func presentCodeRedemptionSheet() | ||
|
||
/** | ||
* Presents a refund request sheet in the current window scene for | ||
* the latest transaction associated with the `productID` | ||
|
@@ -736,22 +758,6 @@ public protocol PurchasesType: AnyObject { | |
|
||
#endif | ||
|
||
/** | ||
* Displays a sheet that enables users to redeem subscription offer codes that you generated in App Store Connect. | ||
* | ||
* - Important: Even though the docs in `SKPaymentQueue.presentCodeRedemptionSheet` | ||
* say that it's available on Catalyst 14.0, there is a note: | ||
* "`This function doesn’t affect Mac apps built with Mac Catalyst.`" | ||
* when, in fact, it crashes when called both from Catalyst and also when running as "Designed for iPad". | ||
* This is why RevenueCat's SDK makes it unavailable in mac catalyst. | ||
*/ | ||
@available(iOS 14.0, *) | ||
@available(watchOS, unavailable) | ||
@available(tvOS, unavailable) | ||
@available(macOS, unavailable) | ||
@available(macCatalyst, unavailable) | ||
func presentCodeRedemptionSheet() | ||
|
||
#if os(iOS) || targetEnvironment(macCatalyst) || VISION_OS | ||
/** | ||
* Displays price consent sheet if needed. You only need to call this manually if you implement | ||
|
@@ -771,6 +777,24 @@ public protocol PurchasesType: AnyObject { | |
*/ | ||
@available(iOS 13.4, macCatalyst 13.4, *) | ||
@objc func showPriceConsentIfNeeded() | ||
|
||
/** | ||
* Displays a sheet that enables users to redeem subscription offer codes that you generated in App Store Connect. | ||
* | ||
* - Important: Even though the docs in `AppStore.presentOfferCodeRedeemSheet(in:)` | ||
* say that it's available on Catalyst 16.0+, there is a note: | ||
* "`In Mac apps built with Mac Catalyst, this method throws a StoreKitError.unknown error.`". | ||
* The function also throws a StoreKitError.unknown error when running as "Designed for iPad" on macOS. | ||
* | ||
* For these reasons, RevenueCat's SDK makes this function unavailable on Mac Catalyst, and it no-ops | ||
* for iOS apps running as a "Designed for iPad" app on macOS. | ||
*/ | ||
@available(iOS 14.0, *) | ||
@available(macCatalyst, unavailable) | ||
@available(watchOS, unavailable) | ||
@available(tvOS, unavailable) | ||
@available(macOS, unavailable) | ||
func presentCodeRedemptionSheet(uiWindowScene: UIWindowScene?) async throws | ||
#endif | ||
|
||
#if os(iOS) || os(macOS) || VISION_OS | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a little awkward that this is possible, but I thought it was important to keep the provided window scene optional for two reasons:
Purchases.presentCodeRedemptionSheet
API as similar as possible to the deprecated one