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

Adds presentCodeRedemptionSheet #400

Merged
merged 4 commits into from Nov 18, 2020
Merged

Adds presentCodeRedemptionSheet #400

merged 4 commits into from Nov 18, 2020

Conversation

vegaro
Copy link
Contributor

@vegaro vegaro commented Nov 18, 2020

Adds this as part of the new Subscription offer codes https://developer.apple.com/app-store/subscriptions/#providing-subscription-offers

Copy link
Member

@aboedo aboedo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for taking care of this!

if (@available(iOS 14.0, *)) {
[self.paymentQueue presentCodeRedemptionSheet];
} else {
// Fallback on earlier versions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's log a warning here saying that presentCodeRedemptionSheet was attempted, but isn't available on this device, for debugging purposes.

@aboedo aboedo added this to the 3.8.0 milestone Nov 18, 2020
@aboedo
Copy link
Member

aboedo commented Nov 18, 2020

I set 3.8.0 as the release version for this one, let's chat about logistics since might still need some updates to the programmatic restore method

@vegaro
Copy link
Contributor Author

vegaro commented Nov 18, 2020

Still haven't been able to test. I'll try again today, hopefully they have propagated and the codes work today

@aboedo
Copy link
Member

aboedo commented Nov 18, 2020

I don't think there's anything more to do sdk-wise, though, so I'd be fine with merging

@vegaro
Copy link
Contributor Author

vegaro commented Nov 18, 2020

Yes, I agree. I am just worried about releasing this if we haven't been able to test the backend

@@ -21,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN

- (void)addPayment:(SKPayment *)payment;
- (void)finishTransaction:(SKPaymentTransaction *)transaction;
- (void)presentCodeRedemptionSheet;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- (void)presentCodeRedemptionSheet;
- (void)presentCodeRedemptionSheet API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(tvos, macos, watchos);

Comment on lines 69 to 77
- (void)presentCodeRedemptionSheet {
#if TARGET_OS_IOS
if (@available(iOS 14.0, *)) {
[self.paymentQueue presentCodeRedemptionSheet];
} else {
// Fallback on earlier versions
}
#endif
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- (void)presentCodeRedemptionSheet {
#if TARGET_OS_IOS
if (@available(iOS 14.0, *)) {
[self.paymentQueue presentCodeRedemptionSheet];
} else {
// Fallback on earlier versions
}
#endif
}
- (void)presentCodeRedemptionSheet API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(tvos, macos, watchos) {
if (@available(iOS 14.0, *)) {
[self.paymentQueue presentCodeRedemptionSheet];
} else {
RCLog(@"Tried presentCodeRedemptionSheet, but it's not supported on this device's OS version");
}
}

@@ -727,6 +727,11 @@ - (void)invalidatePurchaserInfoCache {
[self.deviceCache clearPurchaserInfoCacheForAppUserID:self.appUserID];
}

- (void)presentCodeRedemptionSheet {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- (void)presentCodeRedemptionSheet {
- (void)presentCodeRedemptionSheet API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(tvos, macos, watchos) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add the api available bit here as well

@vegaro vegaro requested a review from aboedo November 18, 2020 18:00
@@ -66,6 +66,14 @@ - (void)finishTransaction:(SKPaymentTransaction *)transaction
[self.paymentQueue finishTransaction:transaction];
}

- (void)presentCodeRedemptionSheet {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should add the api available bit here

@@ -727,6 +727,11 @@ - (void)invalidatePurchaserInfoCache {
[self.deviceCache clearPurchaserInfoCacheForAppUserID:self.appUserID];
}

- (void)presentCodeRedemptionSheet {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add the api available bit here as well

@vegaro vegaro merged commit 44b1e25 into develop Nov 18, 2020
@vegaro vegaro deleted the offer-codes branch November 18, 2020 23:31
@aboedo aboedo mentioned this pull request Nov 19, 2020
@@ -66,6 +66,14 @@ - (void)finishTransaction:(SKPaymentTransaction *)transaction
[self.paymentQueue finishTransaction:transaction];
}

- (void)presentCodeRedemptionSheet API_AVAILABLE(ios(14.0)) API_UNAVAILABLE(tvos, macos, watchos) {
if (@available(iOS 14.0, *)) {
[self.paymentQueue presentCodeRedemptionSheet];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this gives an error

No visible @interface for 'SKPaymentQueue' declares the selector 'presentCodeRedemptionSheet'

on latest version 3.9.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which Xcode version are you running?

This method is only available when compiling on Xcode versions >= 12.0.
@alicanbatur Do you have any specific needs that force you to use earlier Xcode versions?

@aboedo aboedo mentioned this pull request Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants