diff --git a/Glassfy.podspec b/Glassfy.podspec index 57e7040..abfee76 100644 --- a/Glassfy.podspec +++ b/Glassfy.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "Glassfy" - s.version = "1.4.0" + s.version = "1.4.1" 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 42934b2..7cd5ecb 100644 --- a/Glassfy.xcodeproj/project.pbxproj +++ b/Glassfy.xcodeproj/project.pbxproj @@ -68,6 +68,8 @@ 816EF28D26611C5900513FB1 /* GYAPIPropertiesResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 816EF28B26611C5900513FB1 /* GYAPIPropertiesResponse.h */; settings = {ATTRIBUTES = (Private, ); }; }; 816EF28E26611C5900513FB1 /* GYAPIPropertiesResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 816EF28C26611C5900513FB1 /* GYAPIPropertiesResponse.m */; }; 816EF29026611CF700513FB1 /* GYUserProperties+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 816EF28F26611CF100513FB1 /* GYUserProperties+Private.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 817876862B8658DC00E3FC58 /* GYStoreInfoStripe.m in Sources */ = {isa = PBXBuildFile; fileRef = 817876852B8658DC00E3FC58 /* GYStoreInfoStripe.m */; }; + 817876882B8658E600E3FC58 /* GYStoreInfoStripe.h in Headers */ = {isa = PBXBuildFile; fileRef = 817876872B8658E600E3FC58 /* GYStoreInfoStripe.h */; settings = {ATTRIBUTES = (Public, ); }; }; 8179459026565E32000EAA47 /* GYUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 8179458E26565E32000EAA47 /* GYUtils.h */; settings = {ATTRIBUTES = (Private, ); }; }; 8179459126565E32000EAA47 /* GYUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 8179458F26565E32000EAA47 /* GYUtils.m */; }; 817A1C3E258CC9EA00D1BA10 /* GYOffering.m in Sources */ = {isa = PBXBuildFile; fileRef = 817A1C3C258CC9EA00D1BA10 /* GYOffering.m */; }; @@ -199,6 +201,8 @@ 816EF28B26611C5900513FB1 /* GYAPIPropertiesResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GYAPIPropertiesResponse.h; sourceTree = ""; }; 816EF28C26611C5900513FB1 /* GYAPIPropertiesResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GYAPIPropertiesResponse.m; sourceTree = ""; }; 816EF28F26611CF100513FB1 /* GYUserProperties+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GYUserProperties+Private.h"; sourceTree = ""; }; + 817876852B8658DC00E3FC58 /* GYStoreInfoStripe.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GYStoreInfoStripe.m; sourceTree = ""; }; + 817876872B8658E600E3FC58 /* GYStoreInfoStripe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GYStoreInfoStripe.h; path = Public/GYStoreInfoStripe.h; sourceTree = ""; }; 8179458E26565E32000EAA47 /* GYUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GYUtils.h; sourceTree = ""; }; 8179458F26565E32000EAA47 /* GYUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GYUtils.m; sourceTree = ""; }; 817A1C3C258CC9EA00D1BA10 /* GYOffering.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GYOffering.m; sourceTree = ""; }; @@ -389,6 +393,8 @@ 81C9AF562805BAB1004A36A1 /* GYStoreInfo.m */, 81C9AF652805C386004A36A1 /* GYStoreInfoPaddle.h */, 81C9AF622805C36B004A36A1 /* GYStoreInfoPaddle.m */, + 817876872B8658E600E3FC58 /* GYStoreInfoStripe.h */, + 817876852B8658DC00E3FC58 /* GYStoreInfoStripe.m */, 81C9AF5D2805BB82004A36A1 /* GYStoresInfo.h */, 81C9AF5A2805BB5B004A36A1 /* GYStoresInfo.m */, 81951CD826443FAA003901F1 /* GYTransaction.h */, @@ -524,6 +530,7 @@ 812C842929B5FAD400A3F736 /* GYAPIPurchaseHistoryResponse.h in Headers */, 811F322E2631CC6C00777020 /* Glassfy+Private.h in Headers */, 81951CD626443F94003901F1 /* GYOffering.h in Headers */, + 817876882B8658E600E3FC58 /* GYStoreInfoStripe.h in Headers */, 8166504228DB6B2700E5B985 /* GYAccountableSku.h in Headers */, 811F31C126317ED800777020 /* GYSku+Private.h in Headers */, 81EFB54425A772D900706FCB /* GYAPIPermissionsResponse.h in Headers */, @@ -666,6 +673,7 @@ 811BCDE12608DA90007742D9 /* GYSysInfo.m in Sources */, 81C9AF532805B665004A36A1 /* GYAPIStoreInfoResponse.m in Sources */, 81D18D792812AF5700C68558 /* GYSkuPaddle.m in Sources */, + 817876862B8658DC00E3FC58 /* GYStoreInfoStripe.m in Sources */, 8161C4992594DD2F009CA563 /* GYTransaction.m in Sources */, 8138BA8A25924B42005CB44E /* SKProduct+GYEncode.m in Sources */, 6478E63C2A0B80AB006FE38E /* GYPaywallNoCodeJsonProvider.m in Sources */, @@ -865,7 +873,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.4.0; + MARKETING_VERSION = 1.4.1; PRODUCT_BUNDLE_IDENTIFIER = net.glassfy.sdk; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -893,7 +901,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 1.4.0; + MARKETING_VERSION = 1.4.1; PRODUCT_BUNDLE_IDENTIFIER = net.glassfy.sdk; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/README.md b/README.md index f537177..73866d7 100644 --- a/README.md +++ b/README.md @@ -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.4.0'``` +```pod 'Glassfy', '~> 1.4.1'``` Then, run the following command: diff --git a/Source/GYStoreInfo.m b/Source/GYStoreInfo.m index 14fab4c..7c5685a 100644 --- a/Source/GYStoreInfo.m +++ b/Source/GYStoreInfo.m @@ -7,6 +7,7 @@ #import "GYStoreInfo.h" #import "GYStoreInfoPaddle.h" +#import "GYStoreInfoStripe.h" #import "GYLogger.h" @interface GYStoreInfo() @@ -27,6 +28,9 @@ - (instancetype)initWithObject:(NSDictionary *)obj error:(NSError ** _Nullable)e case GYStorePaddle: self = [GYStoreInfoPaddle new]; break; + case GYStoreStripe: + self = [GYStoreInfoStripe new]; + break; case GYStoreAppStore || GYStorePlayStore: self = [super init]; break; diff --git a/Source/GYStoreInfoPaddle.m b/Source/GYStoreInfoPaddle.m index c21c2f5..b2d8964 100644 --- a/Source/GYStoreInfoPaddle.m +++ b/Source/GYStoreInfoPaddle.m @@ -7,13 +7,19 @@ #import "GYStoreInfoPaddle.h" +#define kUserId @"userid" +#define kPlanId @"planid" +#define kSubscriptionId @"subscriptionid" +#define kUpdateURL @"updateurl" +#define kCancelURL @"cancelurl" + @implementation GYStoreInfoPaddle - (NSString *)userId { NSString *userId = nil; - if ([self.rawInfo[@"userid"] isKindOfClass:NSString.class]) { - userId = self.rawInfo[@"userid"]; + if ([self.rawInfo[kUserId] isKindOfClass:NSString.class]) { + userId = self.rawInfo[kUserId]; } return userId; } @@ -21,8 +27,8 @@ - (NSString *)userId - (NSString *)planId { NSString *planId = nil; - if ([self.rawInfo[@"planid"] isKindOfClass:NSString.class]) { - planId = self.rawInfo[@"planid"]; + if ([self.rawInfo[kPlanId] isKindOfClass:NSString.class]) { + planId = self.rawInfo[kPlanId]; } return planId; } @@ -30,8 +36,8 @@ - (NSString *)planId - (NSString *)subscriptionId { NSString *subscriptionId = nil; - if ([self.rawInfo[@"subscriptionid"] isKindOfClass:NSString.class]) { - subscriptionId = self.rawInfo[@"subscriptionid"]; + if ([self.rawInfo[kSubscriptionId] isKindOfClass:NSString.class]) { + subscriptionId = self.rawInfo[kSubscriptionId]; } return subscriptionId; } @@ -39,8 +45,8 @@ - (NSString *)subscriptionId - (NSURL *)updateURL { NSURL *updateURL = nil; - if ([self.rawInfo[@"updateurl"] isKindOfClass:NSString.class]) { - updateURL = [NSURL URLWithString:self.rawInfo[@"updateurl"]]; + if ([self.rawInfo[kUpdateURL] isKindOfClass:NSString.class]) { + updateURL = [NSURL URLWithString:self.rawInfo[kUpdateURL]]; } return updateURL; } @@ -48,8 +54,8 @@ - (NSURL *)updateURL - (NSURL *)cancelURL { NSURL *cancelURL = nil; - if ([self.rawInfo[@"cancelurl"] isKindOfClass:NSString.class]) { - cancelURL = [NSURL URLWithString:self.rawInfo[@"cancelurl"]]; + if ([self.rawInfo[kCancelURL] isKindOfClass:NSString.class]) { + cancelURL = [NSURL URLWithString:self.rawInfo[kCancelURL]]; } return cancelURL; } diff --git a/Source/GYStoreInfoStripe.m b/Source/GYStoreInfoStripe.m new file mode 100644 index 0000000..14f112a --- /dev/null +++ b/Source/GYStoreInfoStripe.m @@ -0,0 +1,43 @@ +// +// GYStoreInfoStripe.m +// Glassfy +// +// Created by Luca Garbolino on 21/02/24. +// + +#import "GYStoreInfoStripe.h" + +#define kProductId @"productid" +#define kSubscriptionId @"subscriptionid" +#define kCustomerId @"customerid" + +@implementation GYStoreInfoStripe + +- (NSString *)customerId +{ + NSString *customerId = nil; + if ([self.rawInfo[kCustomerId] isKindOfClass:NSString.class]) { + customerId = self.rawInfo[kCustomerId]; + } + return customerId; +} + +- (NSString *)subscriptionId +{ + NSString *subscriptionId = nil; + if ([self.rawInfo[kSubscriptionId] isKindOfClass:NSString.class]) { + subscriptionId = self.rawInfo[kSubscriptionId]; + } + return subscriptionId; +} + +- (NSString *)producId +{ + NSString *producId = nil; + if ([self.rawInfo[kProductId] isKindOfClass:NSString.class]) { + producId = self.rawInfo[kProductId]; + } + return producId; +} + +@end diff --git a/Source/Glassfy.m b/Source/Glassfy.m index 52143f7..281759a 100644 --- a/Source/Glassfy.m +++ b/Source/Glassfy.m @@ -40,7 +40,7 @@ + (Glassfy *)shared + (NSString *)sdkVersion { - return @"1.4.0"; + return @"1.4.1"; } + (void)initializeWithAPIKey:(NSString *)apiKey diff --git a/Source/Public/GYStoreInfoStripe.h b/Source/Public/GYStoreInfoStripe.h new file mode 100644 index 0000000..758b2d2 --- /dev/null +++ b/Source/Public/GYStoreInfoStripe.h @@ -0,0 +1,25 @@ +// +// GYStoreInfoStripe.h +// Glassfy +// +// Created by Luca Garbolino on 21/02/24. +// + +#import +#if __has_include() +#import +#else +#import "GYStoreInfo.h" +#endif + + +NS_ASSUME_NONNULL_BEGIN + +NS_SWIFT_NAME(Glassfy.StoreInfoStripe) +@interface GYStoreInfoStripe : GYStoreInfo +@property(nonatomic, nullable, readonly) NSString *customerId; +@property(nonatomic, nullable, readonly) NSString *subscriptionId; +@property(nonatomic, nullable, readonly) NSString *producId; +@end + +NS_ASSUME_NONNULL_END diff --git a/Source/Public/Glassfy.h b/Source/Public/Glassfy.h index fd17c09..fe92977 100644 --- a/Source/Public/Glassfy.h +++ b/Source/Public/Glassfy.h @@ -28,6 +28,7 @@ #import #import #import +#import #import #import #else @@ -50,6 +51,7 @@ #import "GYPurchaseDelegate.h" #import "GYStoresInfo.h" #import "GYStoreInfoPaddle.h" +#import "GYStoreInfoStripe.h" #import "GYAttributionItem.h" #import "GYInitializeOptions.h" #endif