Skip to content

Commit

Permalink
Merge pull request #554 from qonversion/release/5.12.5
Browse files Browse the repository at this point in the history
Release 5.12.5
  • Loading branch information
SpertsyanKM authored Oct 18, 2024
2 parents 8ea6171 + 7b66927 commit b7f6441
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 32 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.4</string>
<string>5.12.5</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.4'
s.version = '5.12.5'
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.4";
static NSString *const kSDKVersion = @"5.12.5";

@interface QONConfiguration ()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ @interface QNUserPropertiesManager()

@property (nonatomic) QNInMemoryStorage *inMemoryStorage;

@property (nonatomic, strong) NSMutableArray<QONUserPropertiesEmptyCompletionHandler> *completionBlocks;
@property (atomic, strong) NSMutableArray<QONUserPropertiesEmptyCompletionHandler> *completionBlocks;

@property (nonatomic, assign, readwrite) BOOL sendingScheduled;
@property (nonatomic, assign, readwrite) BOOL updatingCurrently;
@property (atomic, assign, readwrite) BOOL sendingScheduled;
@property (atomic, assign, readwrite) BOOL updatingCurrently;
@property (nonatomic, assign, readwrite) NSUInteger retryDelay;
@property (nonatomic, assign, readwrite) NSUInteger retriesCounter;

Expand Down Expand Up @@ -94,25 +94,31 @@ - (void)forceSendProperties:(QONUserPropertiesEmptyCompletionHandler)completion
return;
}

[self.completionBlocks addObject:completion];
@synchronized (self) {
[self.completionBlocks addObject:completion];
}

[self sendProperties:YES];
}

- (void)sendPropertiesWithDelay:(NSUInteger)delay {
if (!_sendingScheduled) {
_sendingScheduled = YES;
__block __weak QNUserPropertiesManager *weakSelf = self;
[_backgroundQueue addOperationWithBlock:^{
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf performSelector:@selector(sendPropertiesInBackground) withObject:nil afterDelay:delay];
});
}];
@synchronized (self) {
if (!self.sendingScheduled) {
self.sendingScheduled = YES;
__block __weak QNUserPropertiesManager *weakSelf = self;
[self.backgroundQueue addOperationWithBlock:^{
dispatch_async(dispatch_get_main_queue(), ^{
[weakSelf performSelector:@selector(sendPropertiesInBackground) withObject:nil afterDelay:delay];
});
}];
}
}
}

- (void)sendPropertiesInBackground {
_sendingScheduled = NO;
@synchronized (self) {
self.sendingScheduled = NO;
}
[self sendProperties];
}

Expand All @@ -121,44 +127,52 @@ - (void)sendProperties {
}

- (void)sendProperties:(BOOL)force {
if ([QNUtils isEmptyString:_apiClient.apiKey]) {
if ([QNUtils isEmptyString:self.apiClient.apiKey]) {
QONVERSION_ERROR(@"ERROR: apiKey cannot be nil or empty, set apiKey with launchWithKey:");
return;
}

@synchronized (self) {
if (_updatingCurrently && !force) {
if (self.updatingCurrently && !force) {
return;
}
_updatingCurrently = YES;
self.updatingCurrently = YES;
}

[self runOnBackgroundQueue:^{
NSDictionary *properties = [self->_inMemoryStorage.storageDictionary copy];
NSDictionary *properties = [self.inMemoryStorage.storageDictionary copy];

if (!properties || ![properties respondsToSelector:@selector(valueForKey:)]) {
self->_updatingCurrently = NO;
@synchronized (self) {
self.updatingCurrently = NO;
}
return;
}

if (properties.count == 0) {
self->_updatingCurrently = NO;
@synchronized (self) {
self.updatingCurrently = NO;
}
return;
}

self.inMemoryStorage.storageDictionary = @{};
__block __weak QNUserPropertiesManager *weakSelf = self;
[self.apiClient sendProperties:properties
completion:^(NSDictionary * _Nullable dict, NSError * _Nullable error) {
weakSelf.updatingCurrently = NO;

NSArray *completions = [weakSelf.completionBlocks copy];
NSArray *completions = @[];
@synchronized (self) {
weakSelf.updatingCurrently = NO;

completions = [weakSelf.completionBlocks copy];
[weakSelf.completionBlocks removeAllObjects];
}

for (QONUserPropertiesEmptyCompletionHandler storedCompletion in completions) {
storedCompletion();
}

[weakSelf.completionBlocks removeAllObjects];

if (error) {
// copy of an existing array to prevent erasing properties set while the current request is in progress
NSMutableDictionary *allProperties = [self.inMemoryStorage.storageDictionary mutableCopy];
Expand Down Expand Up @@ -210,7 +224,7 @@ - (BOOL)runOnBackgroundQueue:(void (^)(void))block {
block();
return NO;
} else {
[_backgroundQueue addOperationWithBlock:block];
[self.backgroundQueue addOperationWithBlock:block];
return YES;
}
}
Expand All @@ -223,18 +237,18 @@ - (void)collectIntegrationsData {
}

- (void)collectIntegrationsDataInBackground {
[_device adjustUserIDWithCompletion:^(NSString * _Nullable userId) {
[self.device adjustUserIDWithCompletion:^(NSString * _Nullable userId) {
if (![QNUtils isEmptyString:userId]) {
[self setUserProperty:@"_q_adjust_adid" value:userId];
}
}];

NSString *fbAnonID = _device.fbAnonID;
NSString *fbAnonID = self.device.fbAnonID;
if (![QNUtils isEmptyString:fbAnonID]) {
[self setUserProperty:@"_q_fb_anon_id" value:fbAnonID];
}

NSString *afUserID = _device.afUserID;
NSString *afUserID = self.device.afUserID;
if (![QNUtils isEmptyString:afUserID]) {
[self setUserProperty:@"_q_appsflyer_user_id" value:afUserID];
}
Expand Down
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.008335">
<testcase classname="fastlane.lanes" name="0: update_plist" time="0.007282">

</testcase>


<testcase classname="fastlane.lanes" name="1: version_bump_podspec" time="0.000673">
<testcase classname="fastlane.lanes" name="1: version_bump_podspec" time="0.000657">

</testcase>

Expand Down

0 comments on commit b7f6441

Please sign in to comment.