Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Release v1.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarbo committed Mar 24, 2023
1 parent 4d1a16f commit eae4e00
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Glassfy.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Glassfy"
s.version = "1.3.6"
s.version = "1.3.7"
s.summary = "Subscription and in-app-purchase service."
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.source = { :git => "https://github.com/glassfy/ios-sdk.git", :tag => s.version.to_s }
Expand Down
12 changes: 10 additions & 2 deletions Glassfy.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
811F31BC26317ED300777020 /* GYTransaction+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 8161C49E2594DF87009CA563 /* GYTransaction+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
811F31C126317ED800777020 /* GYSku+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 81A7064425ACADB200169564 /* GYSku+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
811F322E2631CC6C00777020 /* Glassfy+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 811F322D2631CC6C00777020 /* Glassfy+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
812767FC29CC990200498889 /* GYInitializeOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 812767FA29CC990200498889 /* GYInitializeOptions.m */; };
812767FE29CCA7F800498889 /* GYInitializeOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 812767FD29CCA7F800498889 /* GYInitializeOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
812C842229B5F51F00A3F736 /* GYPurchasesHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = 812C842029B5F51F00A3F736 /* GYPurchasesHistory.m */; };
812C842429B5F55200A3F736 /* GYPurchasesHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = 812C842329B5F55200A3F736 /* GYPurchasesHistory.h */; settings = {ATTRIBUTES = (Public, ); }; };
812C842629B5F58800A3F736 /* GYPurchasesHistory+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 812C842529B5F58800A3F736 /* GYPurchasesHistory+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -142,6 +144,8 @@
811DB39E280975C900021880 /* GYSkuBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GYSkuBase.h; path = Public/GYSkuBase.h; sourceTree = "<group>"; };
811DB3A0280977C800021880 /* GYSkuBase+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GYSkuBase+Private.h"; sourceTree = "<group>"; };
811F322D2631CC6C00777020 /* Glassfy+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Glassfy+Private.h"; sourceTree = "<group>"; };
812767FA29CC990200498889 /* GYInitializeOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GYInitializeOptions.m; sourceTree = "<group>"; };
812767FD29CCA7F800498889 /* GYInitializeOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GYInitializeOptions.h; path = Public/GYInitializeOptions.h; sourceTree = "<group>"; };
812C842029B5F51F00A3F736 /* GYPurchasesHistory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GYPurchasesHistory.m; sourceTree = "<group>"; };
812C842329B5F55200A3F736 /* GYPurchasesHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GYPurchasesHistory.h; path = Public/GYPurchasesHistory.h; sourceTree = "<group>"; };
812C842529B5F58800A3F736 /* GYPurchasesHistory+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GYPurchasesHistory+Private.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -360,6 +364,8 @@
812C842C29B5FD9200A3F736 /* GYPurchaseHistory.m */,
812C842329B5F55200A3F736 /* GYPurchasesHistory.h */,
812C842029B5F51F00A3F736 /* GYPurchasesHistory.m */,
812767FD29CCA7F800498889 /* GYInitializeOptions.h */,
812767FA29CC990200498889 /* GYInitializeOptions.m */,
81C9AF5D2805BB82004A36A1 /* GYStoresInfo.h */,
81C9AF5A2805BB5B004A36A1 /* GYStoresInfo.m */,
81C9AF5E2805BB82004A36A1 /* GYStoreInfo.h */,
Expand Down Expand Up @@ -459,6 +465,7 @@
817A1CFF258CF7EE00D1BA10 /* GYStoreRequest.h in Headers */,
817A1CB7258CE81000D1BA10 /* GYLogger.h in Headers */,
81010F292590C1AB00B07DE4 /* GYAPIOfferingsResponse.h in Headers */,
812767FE29CCA7F800498889 /* GYInitializeOptions.h in Headers */,
81951CD726443F94003901F1 /* GYOfferings.h in Headers */,
8138BAB225924D0A005CB44E /* SKProductSubscriptionPeriod+GYEncode.h in Headers */,
81E5B89A2912CEBC00D134E9 /* GYAttributionItem+Private.h in Headers */,
Expand Down Expand Up @@ -651,6 +658,7 @@
8138BAA925924CDF005CB44E /* SKPaymentDiscount+GYEncode.m in Sources */,
816EF28A2661161200513FB1 /* GYUserProperties.m in Sources */,
8138BAB325924D0A005CB44E /* SKProductSubscriptionPeriod+GYEncode.m in Sources */,
812767FC29CC990200498889 /* GYInitializeOptions.m in Sources */,
817A1C76258CE0A200D1BA10 /* Glassfy.m in Sources */,
81B49B562729A31C000BDDA1 /* GYFormatter.m in Sources */,
816EF28E26611C5900513FB1 /* GYAPIPropertiesResponse.m in Sources */,
Expand Down Expand Up @@ -821,7 +829,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.3.6;
MARKETING_VERSION = 1.3.7;
PRODUCT_BUNDLE_IDENTIFIER = net.glassfy.sdk;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -849,7 +857,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.3.6;
MARKETING_VERSION = 1.3.7;
PRODUCT_BUNDLE_IDENTIFIER = net.glassfy.sdk;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Our SDK can be easly integrated through Cocoapods or Swift Package Manager
#### Integrate using Cocoapods
Add the pod to your Podfile:

```pod 'Glassfy', '~> 1.3.6'```
```pod 'Glassfy', '~> 1.3.7'```

Then, run the following command:

Expand Down
4 changes: 3 additions & 1 deletion Source/GYAPIManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ NS_ASSUME_NONNULL_BEGIN

- (instancetype)initWithApiKey:(NSString *)apiKey cache:(GYCacheManager *)cache;

- (void)getInitWithInfoWithCompletion:(GYGetInitCompletion _Nullable)block;
- (void)getInitWithCrossPlatformSdkFramework:(NSString *_Nullable)framework
crossPlatformSdkVersion:(NSString *_Nullable)version
completion:(GYGetInitCompletion _Nullable)block;

- (void)getSkuWithId:(NSString *)skuid store:(GYStore)store withCompletion:(GYGetSkuCompletion _Nullable)block;
- (void)getSkuWithProductId:(NSString *)productid promotionalId:(NSString *_Nullable)promoid withCompletion:(GYGetSkuCompletion _Nullable)block;
Expand Down
13 changes: 12 additions & 1 deletion Source/GYAPIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,22 @@ - (NSURLComponents *)baseURLV1

#pragma mark - public

- (void)getInitWithInfoWithCompletion:(GYGetInitCompletion)block
- (void)getInitWithCrossPlatformSdkFramework:(NSString *)framework
crossPlatformSdkVersion:(NSString *)version
completion:(GYGetInitCompletion)block
{
NSURLComponents *url = [self baseURLV0];
url.path = [url.path stringByAppendingPathComponent:@"init"];

NSMutableArray<NSURLQueryItem*> *queryItems = [(url.queryItems ?: @[]) mutableCopy];
if (framework) {
[queryItems addObject:[NSURLQueryItem queryItemWithName:@"cross_platform_sdk_framework" value:framework]];
}
if (version) {
[queryItems addObject:[NSURLQueryItem queryItemWithName:@"cross_platform_sdk_version" value:version]];
}
url.queryItems = queryItems;

NSURLRequest *req = [self authorizedRequestWithComponents:url];
[self callApiWithRequest:req response:GYAPIInitResponse.class completion:block];
}
Expand Down
52 changes: 52 additions & 0 deletions Source/GYInitializeOptions.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// GYInitializeOptions.m
// Glassfy
//
// Created by Luca Garbolino on 23/03/23.
//

#import "GYInitializeOptions.h"

@interface GYInitializeOptions()
@property(nonatomic, readwrite, strong) NSString *apiKey;
@end

@implementation GYInitializeOptions


+ (instancetype)initializeOptionsWithAPIKey:(NSString *)apiKey
{
return [[self alloc] initWithAPIKey:apiKey];
}

- (GYInitializeOptions *)watcherMode:(BOOL)enable
{
self.watcherMode = enable;
return self;
}

- (GYInitializeOptions *)crossPlatformSdkFramework:(NSString *)framework
{
self.crossPlatformSdkFramework = framework;
return self;
}

- (GYInitializeOptions *)crossPlatformSdkVersion:(NSString *)version
{
self.crossPlatformSdkVersion = version;
return self;
}


#pragma mark - private

- (instancetype)initWithAPIKey:(NSString *)apiKey
{
self = [super init];
if (self) {
_apiKey = apiKey;
}
return self;
}

@end
3 changes: 2 additions & 1 deletion Source/GYManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
#import "GYPurchaseDelegate.h"
@class GYSku;
@class GYAttributionItem;
@class GYInitializeOptions;

NS_ASSUME_NONNULL_BEGIN

@interface GYManager : NSObject
@property(nonatomic, readonly, strong, nonnull) NSString *apiKey;
@property(nonatomic, readonly, assign) BOOL watcherMode;

+ (GYManager *)managerWithApiKey:(NSString *)apiKey watcherMode:(BOOL)watcherMode;
+ (GYManager *)managerWithOptions:(GYInitializeOptions *)options;

- (void)setPurchaseDelegate:(id<GYPurchaseDelegate>)delegate;

Expand Down
20 changes: 12 additions & 8 deletions Source/GYManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
#import "Glassfy+Private.h"
#import "GYPurchasesHistory+Private.h"
#import "GYSysInfo.h"
#import "GYInitializeOptions.h"

@interface GYManager() <SKPaymentTransactionObserver>
@property(nonatomic, strong) GYCacheManager *cache;
@property(nonatomic, strong) GYAPIManager *api;
@property(nonatomic, strong) GYStoreRequest *store;
@property(nonatomic, assign) BOOL watcherMode;
@property(nonatomic, strong) GYInitializeOptions *options;
@property(nonatomic, assign) BOOL initialized;

@property(nonatomic, weak) id<GYPurchaseDelegate> purchasesDelegate;
Expand All @@ -41,21 +42,22 @@ @interface GYManager() <SKPaymentTransactionObserver>

@implementation GYManager

+ (GYManager *)managerWithApiKey:(NSString *)apiKey watcherMode:(BOOL)watcherMode
+ (GYManager *)managerWithOptions:(GYInitializeOptions *)options
{
GYManager *manager = [[self alloc] initWithApiKey:apiKey watcherMode:watcherMode];
GYManager *manager = [[self alloc] initWithInitializeOptions:options];
[manager startSDK];
return manager;
}

- (instancetype)initWithApiKey:(NSString *)apiKey watcherMode:(BOOL)watcherMode
- (instancetype)initWithInitializeOptions:(GYInitializeOptions *)options
{
self = [super init];
if (self) {
self.watcherMode = watcherMode;
self.options = options;

self.store = [GYStoreRequest new];
self.cache = [GYCacheManager new];
self.api = [[GYAPIManager alloc] initWithApiKey:apiKey cache:self.cache];
self.api = [[GYAPIManager alloc] initWithApiKey:options.apiKey cache:self.cache];
self.purchaseCompletions = [NSMapTable mapTableWithKeyOptions:NSMapTableStrongMemory valueOptions:NSMapTableCopyIn];

if (GYSysInfo.applicationDidBecomeActiveNotification) {
Expand Down Expand Up @@ -114,7 +116,7 @@ - (void)logoutWithCompletion:(GYErrorCompletion _Nullable)block

- (BOOL)watcherMode
{
return _watcherMode;
return self.options.watcherMode;
}

- (void)permissionsWithCompletion:(GYPermissionsCompletion)block
Expand Down Expand Up @@ -714,7 +716,9 @@ - (void)startSDK
}
};

[self.api getInitWithInfoWithCompletion:^(GYAPIInitResponse *res, NSError *err) {
[self.api getInitWithCrossPlatformSdkFramework:self.options.crossPlatformSdkFramework
crossPlatformSdkVersion:self.options.crossPlatformSdkVersion
completion:^(GYAPIInitResponse *res, NSError *err) {
BOOL shouldSendReceipt = !res.hasReceipt;
[self.store productWithSkus:res.skus completion:^(NSArray<SKProduct*> *products, NSError *err) {
if (products.count) {
Expand Down
12 changes: 10 additions & 2 deletions Source/Glassfy.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ + (Glassfy *)shared

+ (NSString *)sdkVersion
{
return @"1.3.6";
return @"1.3.7";
}

+ (void)initializeWithAPIKey:(NSString *)apiKey
Expand All @@ -49,9 +49,17 @@ + (void)initializeWithAPIKey:(NSString *)apiKey
}

+ (void)initializeWithAPIKey:(NSString *)apiKey watcherMode:(BOOL)watcherMode
{
GYInitializeOptions *opt = [GYInitializeOptions initializeOptionsWithAPIKey:apiKey];
opt.watcherMode = watcherMode;

[self initializeWithOptions:opt];
}

+ (void)initializeWithOptions:(GYInitializeOptions *)options
{
dispatch_async(Glassfy.shared.glqueue, ^{
Glassfy.shared.manager = [GYManager managerWithApiKey:apiKey watcherMode:watcherMode];
Glassfy.shared.manager = [GYManager managerWithOptions:options];
});
}

Expand Down
32 changes: 32 additions & 0 deletions Source/Public/GYInitializeOptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// GYInitializeOptions.h
// Glassfy
//
// Created by Luca Garbolino on 23/03/23.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

NS_SWIFT_NAME(Glassfy.InitializeOptions)
@interface GYInitializeOptions : NSObject

@property(nonatomic, assign) BOOL watcherMode;
@property(nonatomic, readonly, strong) NSString *apiKey;
@property(nonatomic, strong, nullable) NSString *crossPlatformSdkFramework;
@property(nonatomic, strong, nullable) NSString *crossPlatformSdkVersion;

+ (instancetype)initializeOptionsWithAPIKey:(NSString *)apiKey;

- (GYInitializeOptions *)watcherMode:(BOOL)mode;

- (GYInitializeOptions *)crossPlatformSdkFramework:(NSString *_Nullable)framework;
- (GYInitializeOptions *)crossPlatformSdkVersion:(NSString *_Nullable)version;

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

@end

NS_ASSUME_NONNULL_END
9 changes: 9 additions & 0 deletions Source/Public/Glassfy.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#import <Glassfy/GYStoresInfo.h>
#import <Glassfy/GYStoreInfoPaddle.h>
#import <Glassfy/GYAttributionItem.h>
#import <Glassfy/GYInitializeOptions.h>
#else
#import "GYSku.h"
#import "GYSkuPaddle.h"
Expand All @@ -48,6 +49,7 @@
#import "GYStoresInfo.h"
#import "GYStoreInfoPaddle.h"
#import "GYAttributionItem.h"
#import "GYInitializeOptions.h"
#endif


Expand Down Expand Up @@ -85,6 +87,13 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (void)initializeWithAPIKey:(NSString *)apiKey watcherMode:(BOOL)watcherMode NS_SWIFT_NAME(initialize(apiKey:watcherMode:));

/**
Initialize the SDK
@param options Initialization options
*/
+ (void)initializeWithOptions:(GYInitializeOptions *)options NS_SWIFT_NAME(initialize(options:));

/**
Chek permissions status of the user
Expand Down

0 comments on commit eae4e00

Please sign in to comment.