diff --git a/Glassfy.podspec b/Glassfy.podspec index 40ee8d8..abb0112 100644 --- a/Glassfy.podspec +++ b/Glassfy.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Glassfy" - s.version = "1.1.5" + s.version = "1.1.6" 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 } diff --git a/Glassfy.xcodeproj/project.pbxproj b/Glassfy.xcodeproj/project.pbxproj index 39bfbb4..be5d5b1 100644 --- a/Glassfy.xcodeproj/project.pbxproj +++ b/Glassfy.xcodeproj/project.pbxproj @@ -424,7 +424,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1240; - LastUpgradeCheck = 1240; + LastUpgradeCheck = 1310; TargetAttributes = { 8168309E258B6D9C00565968 = { CreatedOnToolsVersion = 12.3; @@ -668,7 +668,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.1.5; + MARKETING_VERSION = 1.1.6; PRODUCT_BUNDLE_IDENTIFIER = net.glassfy.sdk; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -695,7 +695,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.1.5; + MARKETING_VERSION = 1.1.6; PRODUCT_BUNDLE_IDENTIFIER = net.glassfy.sdk; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Glassfy.xcodeproj/xcshareddata/xcschemes/Glassfy.xcscheme b/Glassfy.xcodeproj/xcshareddata/xcschemes/Glassfy.xcscheme index e7a82fc..7af9e15 100644 --- a/Glassfy.xcodeproj/xcshareddata/xcschemes/Glassfy.xcscheme +++ b/Glassfy.xcodeproj/xcshareddata/xcschemes/Glassfy.xcscheme @@ -1,6 +1,6 @@ , NSError *); diff --git a/Source/GYAPIPermissionsResponse.m b/Source/GYAPIPermissionsResponse.m index 1be0e51..22a8bf7 100644 --- a/Source/GYAPIPermissionsResponse.m +++ b/Source/GYAPIPermissionsResponse.m @@ -19,11 +19,11 @@ - (instancetype _Nullable)initWithObject:(NSDictionary *)obj error:(NSError **)e } if (self) { - NSMutableArray *permissions = [NSMutableArray array]; + NSMutableArray *permissions = [NSMutableArray array]; if ([obj[@"permissions"] isKindOfClass:NSArray.class]) { NSArray *permissionsJSON = obj[@"permissions"]; for (NSDictionary *permissionJSON in permissionsJSON) { - if (![permissionJSON isKindOfClass:[NSDictionary class]]) { + if (![permissionJSON isKindOfClass:NSDictionary.class]) { continue; } @@ -36,9 +36,22 @@ - (instancetype _Nullable)initWithObject:(NSDictionary *)obj error:(NSError **)e if ([dateJSON isKindOfClass:NSNumber.class] && dateJSON.integerValue > 0) { expireDate = [NSDate dateWithTimeIntervalSince1970:dateJSON.integerValue]; } + + NSMutableSet *skuIds = [NSMutableSet set]; + NSArray *skuidsJSON = permissionJSON[@"skuarray"]; + if ([skuidsJSON isKindOfClass:NSArray.class]) { + for (NSString *skuId in skuidsJSON) { + if (![skuId isKindOfClass:NSString.class]) { + continue; + } + [skuIds addObject:skuId]; + } + } + GYPermission *permission = [GYPermission permissionWithIdentifier:identifier entitlement:entitlementJSON.integerValue - expire:expireDate]; + expire:expireDate + accountableSkus:skuIds]; [permissions addObject:permission]; } } diff --git a/Source/GYOffering+Private.h b/Source/GYOffering+Private.h index e7cf064..b5b1233 100644 --- a/Source/GYOffering+Private.h +++ b/Source/GYOffering+Private.h @@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN @interface GYOffering (Private) -@property(nonatomic, nullable, strong) NSString *name; +//@property(nonatomic, nullable, strong) NSString *name; @property(nonatomic, strong) NSString *identifier; @property(nonatomic, strong) NSArray *skus; @end diff --git a/Source/GYOffering.m b/Source/GYOffering.m index decffa4..9ec3092 100644 --- a/Source/GYOffering.m +++ b/Source/GYOffering.m @@ -10,7 +10,7 @@ #import "GYError.h" @interface GYOffering() -@property(nonatomic, nullable, strong) NSString *name; +//@property(nonatomic, nullable, strong) NSString *name; @property(nonatomic, strong) NSString *identifier; @property(nonatomic, strong) NSArray *skus; @end @@ -23,10 +23,10 @@ - (instancetype)initWithObject:(nonnull NSDictionary *)obj error:(NSError **)err if ([obj[@"identifier"] isKindOfClass:NSString.class]) { identifier = obj[@"identifier"]; } - NSString *name; - if ([obj[@"name"] isKindOfClass:NSString.class]) { - name = obj[@"name"]; - } +// NSString *name; +// if ([obj[@"name"] isKindOfClass:NSString.class]) { +// name = obj[@"name"]; +// } NSMutableArray *skus = [NSMutableArray array]; if ([obj[@"skus"] isKindOfClass:NSArray.class]) { @@ -54,7 +54,7 @@ - (instancetype)initWithObject:(nonnull NSDictionary *)obj error:(NSError **)err self = [super init]; if (self) { - self.name = name; +// self.name = name; self.identifier = identifier; self.skus = skus; } diff --git a/Source/GYPermission+Private.h b/Source/GYPermission+Private.h index 12f3d72..967c6ca 100644 --- a/Source/GYPermission+Private.h +++ b/Source/GYPermission+Private.h @@ -11,7 +11,10 @@ NS_ASSUME_NONNULL_BEGIN @interface GYPermission (Private) -+ (instancetype)permissionWithIdentifier:(NSString *)identifier entitlement:(GYEntitlement)entitlement expire:(nullable NSDate *)date; ++ (instancetype)permissionWithIdentifier:(NSString *)identifier + entitlement:(GYEntitlement)entitlement + expire:(nullable NSDate *)date + accountableSkus:(NSSet *)skuIds; @end NS_ASSUME_NONNULL_END diff --git a/Source/GYPermission.m b/Source/GYPermission.m index 5c07be6..5d25935 100644 --- a/Source/GYPermission.m +++ b/Source/GYPermission.m @@ -11,16 +11,21 @@ @interface GYPermission() @property(nonatomic, readwrite, strong) NSString *permissionIdentifier; @property(nonatomic, assign) GYEntitlement entitlement; @property(nonatomic, readwrite, strong) NSDate *expireDate; +@property(nonatomic, readwrite, strong) NSSet *accountableSkus; @end @implementation GYPermission (Private) -+ (instancetype)permissionWithIdentifier:(NSString *)identifier entitlement:(GYEntitlement)entitlement expire:(NSDate *)date ++ (instancetype)permissionWithIdentifier:(NSString *)identifier + entitlement:(GYEntitlement)entitlement + expire:(NSDate *)date + accountableSkus:(NSSet *)skuIds { GYPermission *permission = [[self alloc] init]; permission.permissionIdentifier = identifier; permission.entitlement = entitlement; permission.expireDate = date; + permission.accountableSkus = skuIds; return permission; } diff --git a/Source/Glassfy.m b/Source/Glassfy.m index d981ec5..fb636db 100644 --- a/Source/Glassfy.m +++ b/Source/Glassfy.m @@ -40,7 +40,7 @@ + (Glassfy *)shared + (NSString *)sdkVersion { - return @"1.1.5"; + return @"1.1.6"; } + (void)initializeWithAPIKey:(NSString *)apiKey diff --git a/Source/Public/GYOffering.h b/Source/Public/GYOffering.h index 6c67f6c..e599de5 100644 --- a/Source/Public/GYOffering.h +++ b/Source/Public/GYOffering.h @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN NS_SWIFT_NAME(Glassfy.Offering) @interface GYOffering : NSObject -@property(nullable, readonly, strong) NSString *name; +//@property(nullable, readonly, strong) NSString *name; @property(readonly, strong) NSString *identifier; @property(readonly, strong) NSArray *skus; @end diff --git a/Source/Public/GYPermission.h b/Source/Public/GYPermission.h index 0c2db92..0f3260b 100644 --- a/Source/Public/GYPermission.h +++ b/Source/Public/GYPermission.h @@ -20,6 +20,7 @@ NS_SWIFT_NAME(Glassfy.Permission) @property(nonatomic, readonly, assign) GYEntitlement entitlement; @property(nonatomic, readonly, assign) BOOL isValid; @property(nonatomic, readonly, strong, nullable) NSDate *expireDate; +@property(nonatomic, readonly, strong) NSSet *accountableSkus; @end NS_ASSUME_NONNULL_END diff --git a/Source/Public/Glassfy.h b/Source/Public/Glassfy.h index 9cb7cff..9049470 100644 --- a/Source/Public/Glassfy.h +++ b/Source/Public/Glassfy.h @@ -51,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN /** Initialize the SDK - @note For more details, follow instruction at https://docs.glassfy.net/get-started/configuration + @note For more details, follow instruction at https://docs.glassfy.io/get-started/configuration @param apiKey API Key */ @@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN /** Initialize the SDK - @note For more details, follow instruction at https://docs.glassfy.net/get-started/configuration + @note For more details, follow instruction at https://docs.glassfy.io/get-started/configuration @param apiKey API Key @param watcherMode Take advantage of our charts and stats without change your existing code @@ -85,7 +85,7 @@ NS_ASSUME_NONNULL_BEGIN /** Chek permissions status of the user - @note For more details, check the documentation https://docs.glassfy.net/dashboard/configure-permissions.html + @note For more details, check the documentation https://docs.glassfy.io/dashboard/configure-permissions.html @param block Completion block with results */ @@ -94,7 +94,7 @@ NS_ASSUME_NONNULL_BEGIN /** Fetch offerings - @note For more details, check the documentation https://docs.glassfy.net/dashboard/configure-offerings + @note For more details, check the documentation https://docs.glassfy.io/dashboard/configure-offerings @param block Completion block with results */ @@ -103,7 +103,7 @@ NS_ASSUME_NONNULL_BEGIN /** Fetch Sku - @note For more details, check the documentation https://docs.glassfy.net/dashboard/configure-products + @note For more details, check the documentation https://docs.glassfy.io/dashboard/configure-products @param skuid Sku's identifier @param block Completion block with result @@ -121,7 +121,7 @@ NS_ASSUME_NONNULL_BEGIN /** Make a purchase applying a Promotional Offers. Introductory offers are automatically applied to the purchase if user is eligible (new subscriber) while, Promotional Offers can be applied to lapsed/current subscribers - @note Be sure to load Subscription p8 Key File/ID on https://dashboard.glassfy.net so we that we can sign the purchase on your behalf + @note Be sure to load Subscription p8 Key File/ID on https://dashboard.glassfy.io so we that we can sign the purchase on your behalf @param sku Reference to the sku to buy. To get a reference call our offering API @param discount The discount to apply diff --git a/Source/SKProductDiscount+GYEncode.m b/Source/SKProductDiscount+GYEncode.m index 4175aac..d891c43 100644 --- a/Source/SKProductDiscount+GYEncode.m +++ b/Source/SKProductDiscount+GYEncode.m @@ -10,6 +10,7 @@ @implementation SKProductDiscount (GYEncode) +API_AVAILABLE(ios(11.2), macos(10.13.2), watchos(6.2)) NSString *GYProductDiscountPaymentMode(SKProductDiscountPaymentMode type) { NSString *discountPaymentMode; switch (type) { @@ -23,7 +24,7 @@ @implementation SKProductDiscount (GYEncode) discountPaymentMode = @"freetrial"; break; default: - discountPaymentMode = @ "unknow"; + discountPaymentMode = @"unknow"; } return discountPaymentMode; }