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

Release/3.14.1 #1264

Merged
merged 5 commits into from Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion Purchases/Public/RCPurchases.h
Expand Up @@ -382,7 +382,7 @@ NS_SWIFT_NAME(syncPurchases(_:));
/**
Computes whether or not a user is eligible for the introductory pricing period of a given product. You should use this method to determine whether or not you show the user the normal product price or the introductory price. This also applies to trials (trials are considered a type of introductory pricing).

@note Subscription groups are automatically collected for determining eligibility. If RevenueCat can't definitively compute the eligibilty, most likely because of missing group information, it will return `RCIntroEligibilityStatusUnknown`. The best course of action on unknown status is to display the non-intro pricing, to not create a misleading situation. To avoid this, make sure you are testing with the latest version of iOS so that the subscription group can be collected by the SDK.
@note Subscription groups are automatically collected for determining eligibility. If RevenueCat can't definitively compute the eligiibilty, most likely because of missing group information, it will return `RCIntroEligibilityStatusUnknown`. The best course of action on unknown status is to display the non-intro pricing, to not create a misleading situation. To avoid this, make sure you are testing with the latest version of iOS so that the subscription group can be collected by the SDK.
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops?

Copy link
Member Author

Choose a reason for hiding this comment

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

LOL I went to fix it and I made it worse


@param productIdentifiers Array of product identifiers for which you want to compute eligibility
@param receiveEligibility A block that receives a dictionary of product_id -> `RCIntroEligibility`.
Expand Down
2 changes: 1 addition & 1 deletion Purchases/Public/RCPurchases.m
Expand Up @@ -746,7 +746,7 @@ - (void)handleRestoreReceiptPostWithInfo:(RCPurchaserInfo *)info
- (void)checkTrialOrIntroductoryPriceEligibility:(NSArray<NSString *> *)productIdentifiers
completionBlock:(RCReceiveIntroEligibilityBlock)receiveEligibility
{
[self receiptData:^(NSData *data) {
[self receiptDataWithReceiptRefreshPolicy:RCReceiptRefreshPolicyNever completion:^(NSData *data) {
if (data != nil && data.length > 0) {
if (@available(iOS 12.0, macOS 10.14, macCatalyst 13.0, tvOS 12.0, watchOS 6.2, *)) {
NSSet *productIdentifiersSet = [[NSSet alloc] initWithArray:productIdentifiers];
Expand Down
14 changes: 14 additions & 0 deletions PurchasesTests/Purchasing/PurchasesTests.swift
Expand Up @@ -1374,6 +1374,20 @@ class PurchasesTests: XCTestCase {
expect(self.receiptFetcher.receiptDataCalled).to(beTrue())
}

func testGetEligibilityDoesntRefreshReceipt() {
setupPurchases()
self.receiptFetcher.shouldReturnReceipt = false

expect(self.requestFetcher.refreshReceiptCalled) == false
expect(self.receiptFetcher.receiptDataCalled) == false

purchases!.checkTrialOrIntroductoryPriceEligibility([]) { (eligibilities) in
Copy link
Contributor

Choose a reason for hiding this comment

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

The ! isn't required right? It's already an implicitly unwrapped optional.

Copy link
Member Author

Choose a reason for hiding this comment

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

great catch!! I was mislead because we're actually treating purchases as a regular optional everywhere in this file. I updated all references, since that's not necessary

}

expect(self.receiptFetcher.receiptDataCalled) == true
expect(self.requestFetcher.refreshReceiptCalled) == false
}

func testFetchVersionSendsAReceiptIfNoVersion() {
setupPurchases()

Expand Down