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

Add support for RCEntitlementInfo API testing #595

Merged
merged 1 commit into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions APITester/main.m

This file was deleted.

19 changes: 19 additions & 0 deletions PublicSDKAPITester/RCEntitlementInfoAPI.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// RCEntitlementInfoAPI.h
// APITester
//
// Created by Joshua Liebowitz on 6/25/21.
// Copyright © 2021 Purchases. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface RCEntitlementInfoAPI : NSObject

+ (void)checkAPI;

@end

NS_ASSUME_NONNULL_END
34 changes: 34 additions & 0 deletions PublicSDKAPITester/RCEntitlementInfoAPI.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// RCEntitlementInfoAPI.m
// APITester
//
// Created by Joshua Liebowitz on 6/25/21.
// Copyright © 2021 Purchases. All rights reserved.
//


@import Purchases;
@import PurchasesCoreSwift;

#import "RCEntitlementInfoAPI.h"

@implementation RCEntitlementInfoAPI

+ (void)checkAPI {
RCEntitlementInfo *ri = [[RCEntitlementInfo alloc] init];
BOOL wr = [ri willRenew];
RCPeriodType pt = [ri periodType];
NSDate *lpd = [ri latestPurchaseDate];
NSDate *opd = [ri originalPurchaseDate];
NSDate *ed = [ri expirationDate];
RCStore s = [ri store];
NSString *pi = [ri productIdentifier];
BOOL is = [ri isSandbox];
NSDate *uda = [ri unsubscribeDetectedAt];
NSDate *bida = [ri billingIssueDetectedAt];
RCPurchaseOwnershipType ot = [ri ownershipType];

NSLog(ri, wr, pt, lpd, opd, ed, s, pi, is, uda, bida, ot);
}

@end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// RevenueCatAPI.h
// MigrateTester
// RCPurchasesAPI
//
// Created by Joshua Liebowitz on 6/18/21.
//
Expand All @@ -11,9 +11,9 @@ NS_ASSUME_NONNULL_BEGIN

@class RCPurchasesDelegate;

@interface RevenueCatAPI<RCPurchasesDelegate> : NSObject
@interface RCPurchasesAPI<RCPurchasesDelegate> : NSObject

+ (void)allTheThings;
+ (void)checkAPI;
+ (void)enums;

@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
// Created by Joshua Liebowitz on 6/18/21.
//

#import <Purchases/RCEntitlementInfo.h>
#import <Purchases/RCPurchaserInfo.h>
#import <Purchases/RCPurchases.h>
#import "RevenueCatAPI.h"

@import Purchases;
@import PurchasesCoreSwift;
@import StoreKit;

@implementation RevenueCatAPI
#import "RCPurchasesAPI.h"

@implementation RCPurchasesAPI

bool canI;
NSString *version;
Expand All @@ -32,7 +30,7 @@ @implementation RevenueCatAPI
NSString *appUserID;
BOOL isAnonymous;

+ (void)allTheThings {
+ (void)checkAPI {
// TODO: Addresses these blocks
// typedef void (^RCReceivePurchaserInfoBlock)(RCPurchaserInfo * _Nullable, NSError * _Nullable) NS_SWIFT_NAME(Purchases.ReceivePurchaserInfoBlock);
// typedef void (^RCReceiveIntroEligibilityBlock)(NSDictionary<NSString *, RCIntroEligibility *> *) NS_SWIFT_NAME(Purchases.ReceiveIntroEligibilityBlock);
Expand Down
7 changes: 5 additions & 2 deletions PublicSDKAPITester/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
//

#import <Foundation/Foundation.h>
#import "RCEntitlementInfoAPI.h"
#import "RCPurchasesAPI.h"

@import StoreKit;

int main(int argc, const char * argv[]) {
@autoreleasepool {
// insert code here...
NSLog(@"Hello, World!");
[RCPurchasesAPI checkAPI];
[RCEntitlementInfoAPI checkAPI];
}
return 0;
}
44 changes: 18 additions & 26 deletions Purchases.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,12 @@
9A65E0A02591A23200DE00B0 /* OfferingStrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A65E09F2591A23200DE00B0 /* OfferingStrings.swift */; };
9A65E0A52591A23500DE00B0 /* PurchaseStrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A65E0A42591A23500DE00B0 /* PurchaseStrings.swift */; };
9A65E0AA2591A23800DE00B0 /* RestoreStrings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A65E0A92591A23800DE00B0 /* RestoreStrings.swift */; };
B32B74FF26868AEB005647BF /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3D3C4712685784800CB3C21 /* Package.swift */; };
B33C43EF267295E2006B8C8C /* RCObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = B33C43EC2672953D006B8C8C /* RCObjC.m */; };
B33C43F22672986D006B8C8C /* ObjCThrowExceptionMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = B33C43F12672986D006B8C8C /* ObjCThrowExceptionMatcher.swift */; };
B387F47A2683FDEA0028701F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B387F46D2683FDAC0028701F /* main.m */; };
B387F47B2683FDEA0028701F /* RevenueCatAPI.h in Sources */ = {isa = PBXBuildFile; fileRef = B387F46C2683FDAC0028701F /* RevenueCatAPI.h */; };
B387F47C2683FDEA0028701F /* RevenueCatAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = B387F46E2683FDAC0028701F /* RevenueCatAPI.m */; };
B3D3C4722685784800CB3C21 /* Package.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3D3C4712685784800CB3C21 /* Package.swift */; };
B387F480268400EE0028701F /* Purchases.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 352629FE1F7C4B9100C04F2C /* Purchases.framework */; };
B3AA35A0268682410007771B /* RCEntitlementInfoAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = B3AA359D268682410007771B /* RCEntitlementInfoAPI.m */; };
B3AA35A1268682410007771B /* RCPurchasesAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = B3AA359F268682410007771B /* RCPurchasesAPI.m */; };
B3D3C47026856AFF00CB3C21 /* APITester.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3D3C46F26856AFF00CB3C21 /* APITester.swift */; };
B3D5CFBD267282630056FA67 /* Nimble in Frameworks */ = {isa = PBXBuildFile; productRef = B3D5CFBC267282630056FA67 /* Nimble */; };
B3D5CFC0267282760056FA67 /* OHHTTPStubsSwift in Frameworks */ = {isa = PBXBuildFile; productRef = B3D5CFBF267282760056FA67 /* OHHTTPStubsSwift */; };
Expand Down Expand Up @@ -568,16 +567,17 @@
B33C43EB2672953D006B8C8C /* RCObjC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCObjC.h; sourceTree = "<group>"; };
B33C43EC2672953D006B8C8C /* RCObjC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCObjC.m; sourceTree = "<group>"; };
B33C43F12672986D006B8C8C /* ObjCThrowExceptionMatcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjCThrowExceptionMatcher.swift; sourceTree = "<group>"; };
B387F46C2683FDAC0028701F /* RevenueCatAPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RevenueCatAPI.h; sourceTree = "<group>"; };
B387F46D2683FDAC0028701F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
B387F46E2683FDAC0028701F /* RevenueCatAPI.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RevenueCatAPI.m; sourceTree = "<group>"; };
B387F4732683FDDB0028701F /* APITester */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = APITester; sourceTree = BUILT_PRODUCTS_DIR; };
B387F4752683FDDB0028701F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
B3AA359C268682410007771B /* RCEntitlementInfoAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCEntitlementInfoAPI.h; sourceTree = "<group>"; };
B3AA359D268682410007771B /* RCEntitlementInfoAPI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCEntitlementInfoAPI.m; sourceTree = "<group>"; };
B3AA359E268682410007771B /* RCPurchasesAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCPurchasesAPI.h; sourceTree = "<group>"; };
B3AA359F268682410007771B /* RCPurchasesAPI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCPurchasesAPI.m; sourceTree = "<group>"; };
B3D3C46E26856AFE00CB3C21 /* APITester-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "APITester-Bridging-Header.h"; sourceTree = "<group>"; };
B3D3C46F26856AFF00CB3C21 /* APITester.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APITester.swift; sourceTree = "<group>"; };
B3D3C4712685784800CB3C21 /* Package.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; };
B3DDB55826854865008CCF23 /* PurchaseOwnershipType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PurchaseOwnershipType.swift; sourceTree = "<group>"; };
B3DDB55B26854A1E008CCF23 /* EntitlementInfoEnums.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntitlementInfoEnums.swift; sourceTree = "<group>"; };
B3D3C46E26856AFE00CB3C21 /* APITester-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "APITester-Bridging-Header.h"; sourceTree = "<group>"; };
B3D3C46F26856AFF00CB3C21 /* APITester.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APITester.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -641,7 +641,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B387F486268405F10028701F /* Purchases.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -910,7 +909,6 @@
2DC5622224EC63430031F69B /* PurchasesCoreSwiftTests */,
2DE20B6D264087FB004C597D /* StoreKitTests */,
2DE20B8026409EB7004C597D /* StoreKitTestApp */,
B387F4742683FDDB0028701F /* APITester */,
352629FF1F7C4B9100C04F2C /* Products */,
3530C18722653E8F00D6DF52 /* Frameworks */,
2DCB85BF2406EC3F003C1260 /* Recovered References */,
Expand Down Expand Up @@ -1303,23 +1301,17 @@
B387F46B2683FD730028701F /* PublicSDKAPITester */ = {
isa = PBXGroup;
children = (
B387F46D2683FDAC0028701F /* main.m */,
B387F46C2683FDAC0028701F /* RevenueCatAPI.h */,
B387F46E2683FDAC0028701F /* RevenueCatAPI.m */,
B3D3C46F26856AFF00CB3C21 /* APITester.swift */,
B3D3C46E26856AFE00CB3C21 /* APITester-Bridging-Header.h */,
B3D3C46F26856AFF00CB3C21 /* APITester.swift */,
B387F46D2683FDAC0028701F /* main.m */,
B3AA359C268682410007771B /* RCEntitlementInfoAPI.h */,
B3AA359D268682410007771B /* RCEntitlementInfoAPI.m */,
B3AA359E268682410007771B /* RCPurchasesAPI.h */,
B3AA359F268682410007771B /* RCPurchasesAPI.m */,
);
path = PublicSDKAPITester;
sourceTree = "<group>";
};
B387F4742683FDDB0028701F /* APITester */ = {
isa = PBXGroup;
children = (
B387F4752683FDDB0028701F /* main.m */,
);
path = APITester;
sourceTree = "<group>";
};
B3DDB55726854850008CCF23 /* Public */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1721,7 +1713,6 @@
2DDF41B524F6F387005BC22D /* AppleReceiptBuilder.swift in Sources */,
2DDF41A324F6F331005BC22D /* ReceiptParser.swift in Sources */,
2DDF41BA24F6F392005BC22D /* ISO3601DateFormatter.swift in Sources */,
B3D3C4722685784800CB3C21 /* Package.swift in Sources */,
2DDF41AE24F6F37C005BC22D /* InAppPurchase.swift in Sources */,
2DC19195255F36D10039389A /* Logger.swift in Sources */,
2DDF419F24F6F331005BC22D /* ReceiptParsingError.swift in Sources */,
Expand All @@ -1741,6 +1732,7 @@
2DDF41BC24F6F392005BC22D /* ArraySlice_UInt8+Extensions.swift in Sources */,
9A65E0A02591A23200DE00B0 /* OfferingStrings.swift in Sources */,
2DDF41A224F6F331005BC22D /* ProductsManager.swift in Sources */,
B32B74FF26868AEB005647BF /* Package.swift in Sources */,
2DDF41B324F6F387005BC22D /* InAppPurchaseBuilder.swift in Sources */,
9A65DFDE258AD60A00DE00B0 /* LogIntent.swift in Sources */,
37E35C8515C5E2D01B0AF5C1 /* Strings.swift in Sources */,
Expand Down Expand Up @@ -1910,9 +1902,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B3AA35A1268682410007771B /* RCPurchasesAPI.m in Sources */,
B3AA35A0268682410007771B /* RCEntitlementInfoAPI.m in Sources */,
B387F47A2683FDEA0028701F /* main.m in Sources */,
B387F47B2683FDEA0028701F /* RevenueCatAPI.h in Sources */,
B387F47C2683FDEA0028701F /* RevenueCatAPI.m in Sources */,
B3D3C47026856AFF00CB3C21 /* APITester.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down