Skip to content

Commit

Permalink
Merge pull request #540 from qonversion/release/5.12.2
Browse files Browse the repository at this point in the history
Release 5.12.2
  • Loading branch information
suriksarkisyan authored Sep 9, 2024
2 parents 502841a + ffbbd17 commit 78f5099
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.12.1</string>
<string>5.12.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion Qonversion.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Pod::Spec.new do |s|
idfa_exclude_files = ['Sources/Qonversion/IDFA']
s.name = 'Qonversion'
s.swift_version = '5.5'
s.version = '5.12.1'
s.version = '5.12.2'
s.summary = 'qonversion.io'
s.description = <<-DESC
Deep Analytics for iOS Subscriptions
Expand Down
2 changes: 1 addition & 1 deletion Sources/Qonversion/Public/QONConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "QONConfiguration.h"
#import "QNAPIConstants.h"

static NSString *const kSDKVersion = @"5.12.1";
static NSString *const kSDKVersion = @"5.12.2";

@interface QONConfiguration ()

Expand Down
2 changes: 1 addition & 1 deletion Sources/Qonversion/Public/Qonversion.m
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ - (void)purchase:(NSString *)productID completion:(QONPurchaseCompletionHandler)
}

- (void)restore:(QNRestoreCompletionHandler)completion {
[self.productCenterManager restore:completion];
[self.productCenterManager restoreReceipt:completion];
}

- (void)products:(QONProductsCompletionHandler)completion {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)checkEntitlements:(QONEntitlementsCompletionHandler)completion;
- (void)purchase:(QONProduct * _Nonnull)product options:(QONPurchaseOptions * _Nullable)options completion:(nonnull QONPurchaseCompletionHandler)completion;
- (void)purchase:(NSString * _Nonnull)productID purchaseOptions:(QONPurchaseOptions * _Nullable)options completion:(nonnull QONPurchaseCompletionHandler)completion;
- (void)restore:(QNRestoreCompletionHandler)completion;
- (void)restoreTransactions:(QNRestoreCompletionHandler)completion;

- (void)products:(QONProductsCompletionHandler)completion;
- (void)checkTrialIntroEligibilityForProductIds:(NSArray<NSString *> *)productIds completion:(QONEligibilityCompletionHandler)completion;
Expand All @@ -38,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)userInfo:(QONUserInfoCompletionHandler)completion;

- (void)handlePurchases:(NSArray<QONStoreKit2PurchaseModel *> *)purchasesInfo completion:(QONDefaultCompletionHandler)completion;

- (void)restoreReceipt:(QNRestoreCompletionHandler)completion;
- (void)launch:(void (^)(QONLaunchResult * _Nullable result, NSError * _Nullable error))completion;
- (void)getPromotionalOfferForProduct:(QONProduct *)product
discount:(SKProductDiscount *)discount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ @interface QNProductCenterManager() <QNStoreKitServiceDelegate>

@property (nonatomic, strong) NSMutableDictionary<NSString *, QONPurchaseCompletionHandler> *purchasingBlocks;
@property (nonatomic, strong) NSMutableArray<QNRestoreCompletionHandler> *restorePurchasesBlocks;
@property (nonatomic, strong) NSMutableArray<QNRestoreCompletionHandler> *receiptRestoreBlocks;
@property (nonatomic, strong) NSMutableArray<QONEntitlementsCompletionHandler> *entitlementsBlocks;
@property (nonatomic, strong) NSMutableArray<QONProductsCompletionHandler> *productsBlocks;
@property (nonatomic, strong) NSMutableArray<QONOfferingsCompletionHandler> *offeringsBlocks;
Expand All @@ -67,6 +68,7 @@ @interface QNProductCenterManager() <QNStoreKitServiceDelegate>
@property (nonatomic, assign) BOOL launchingFinished;
@property (nonatomic, assign) BOOL productsLoading;
@property (nonatomic, assign) BOOL restoreInProgress;
@property (nonatomic, assign) BOOL receiptRestoreInProgress;
@property (nonatomic, assign) BOOL awaitingRestoreResult;
@property (nonatomic, assign) BOOL identityInProgress;
@property (nonatomic, assign) BOOL unhandledLogoutAvailable;
Expand Down Expand Up @@ -104,6 +106,7 @@ - (instancetype)initWithUserInfoService:(id<QNUserInfoServiceInterface>)userInfo

_purchasingBlocks = [NSMutableDictionary new];
_restorePurchasesBlocks = [NSMutableArray new];
_receiptRestoreBlocks = [NSMutableArray new];
_entitlementsBlocks = [NSMutableArray new];
_productsBlocks = [NSMutableArray new];
_offeringsBlocks = [NSMutableArray new];
Expand Down Expand Up @@ -455,7 +458,34 @@ - (void)processProductPurchase:(QONProduct *)product options:(QONPurchaseOptions
run_block_on_main(completion, @{}, [QONErrors errorWithQONErrorCode:QONErrorProductNotFound], NO);
}

- (void)restore:(QNRestoreCompletionHandler)completion {
- (void)restoreReceipt:(QNRestoreCompletionHandler)completion {
if (completion) {
[self.receiptRestoreBlocks addObject:completion];
}

if (self.receiptRestoreInProgress) {
return;
}

self.receiptRestoreInProgress = YES;

__block __weak QNProductCenterManager *weakSelf = self;
[self.storeKitService receipt:^(NSString * _Nonnull receipt) {
[weakSelf launchWithCompletion:^(QONLaunchResult * _Nonnull result, NSError * _Nullable error) {
@synchronized (weakSelf) {
weakSelf.receiptRestoreInProgress = NO;
NSArray<QONEntitlementsCompletionHandler> *completions = [self.receiptRestoreBlocks copy];
[weakSelf.receiptRestoreBlocks removeAllObjects];

for (QONEntitlementsCompletionHandler block in completions) {
run_block_on_main(block, result.entitlements, error);
}
}
}];
}];
}

- (void)restoreTransactions:(QNRestoreCompletionHandler)completion {
if (completion != nil) {
[self.restorePurchasesBlocks addObject:completion];
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Qonversion/Qonversion/Mappers/QNMapper/QNMapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,13 @@ + (QNMapperObject *)mapperObjectFrom:(NSDictionary *)dict {
}

+ (NSInteger)mapInteger:(NSObject *)object orReturn:(NSInteger)defaultValue {
if (object == nil) {
if (!object) {
return defaultValue;
}

NSNumber *numberObject = (NSNumber *)object;

if ([numberObject isEqual:[NSNull null]]) {
if ([numberObject isEqual:[NSNull null]] || ![numberObject respondsToSelector:@selector(integerValue)]) {
return defaultValue;
} else {
return numberObject.integerValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ - (SKReceiptRefreshRequest *)buildReceiptRefreshRequest {

- (void)finishReceiptFetchRequest:(SKRequest *)request {
@synchronized(self) {
[self.receiptRefreshRequest cancel];
self.receiptRefreshRequest = nil;
NSArray<QNStoreKitServiceReceiptFetchCompletionHandler> *handlers = [self.receiptRefreshCompletionHandlers copy];
[self.receiptRefreshCompletionHandlers removeAllObjects];
Expand Down
14 changes: 11 additions & 3 deletions Sources/Qonversion/Qonversion/Utils/QNUserInfo/QNUserInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ + (NSDictionary *)overallData {
}

+ (nullable NSString *)appStoreReceipt {
NSURL *receiptURL = QNUserInfo.bundle.appStoreReceiptURL;
NSURL *tempReceiptURL = QNUserInfo.bundle.appStoreReceiptURL;
NSURL *receiptURL = tempReceiptURL ?: [NSBundle mainBundle].appStoreReceiptURL;

if (!receiptURL) {
return @"";
Expand All @@ -95,8 +96,15 @@ + (BOOL)isDebug {
}

+ (nullable NSBundle *)bundle {
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"appStoreReceiptURL != nil"];
return [NSBundle.allBundles filteredArrayUsingPredicate:predicate].firstObject;
NSArray *allBundles = [[NSBundle allBundles] copy];

for (NSBundle *bundle in allBundles) {
if (bundle.appStoreReceiptURL != nil) {
return bundle;
}
}

return nil;
}

@end
4 changes: 2 additions & 2 deletions fastlane/report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@



<testcase classname="fastlane.lanes" name="0: update_plist" time="0.021743">
<testcase classname="fastlane.lanes" name="0: update_plist" time="0.007243">

</testcase>


<testcase classname="fastlane.lanes" name="1: version_bump_podspec" time="0.001871">
<testcase classname="fastlane.lanes" name="1: version_bump_podspec" time="0.000652">

</testcase>

Expand Down

0 comments on commit 78f5099

Please sign in to comment.