Skip to content

Commit a982eb2

Browse files
committed
GH-Issue-1212 Fix - Removed calls to callback from completion handler of updatePostbackConversionValue.
1 parent d011a9a commit a982eb2

File tree

2 files changed

+2
-35
lines changed

2 files changed

+2
-35
lines changed

Branch-SDK/BranchEvent.m

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ - (void)processResponse:(BNCServerResponse*)response error:(NSError*)error {
8080
NSDictionary *dictionary = ([response.data isKindOfClass:[NSDictionary class]])
8181
? (NSDictionary*) response.data : nil;
8282

83-
BOOL callCompletionHandler = YES;
84-
8583
if (dictionary && [dictionary[BRANCH_RESPONSE_KEY_UPDATE_CONVERSION_VALUE] isKindOfClass:NSNumber.class]) {
8684
NSNumber *conversionValue = (NSNumber *)dictionary[BRANCH_RESPONSE_KEY_UPDATE_CONVERSION_VALUE];
8785
// Regardless of SKAN opted-in in dashboard, we always get conversionValue, so adding check to find out if install/open response had "invoke_register_app" true
@@ -94,11 +92,7 @@ - (void)processResponse:(BNCServerResponse*)response error:(NSError*)error {
9492
BNCLogDebug([NSString stringWithFormat:@"SKAN 4.0 params - conversionValue:%@ coarseValue:%@, locked:%d, shouldCallPostback:%d, currentWindow:%d, firstAppLaunchTime: %@", conversionValue, coarseConversionValue, lockWin, shouldCallUpdatePostback, (int)[BNCPreferenceHelper sharedInstance].skanCurrentWindow, [BNCPreferenceHelper sharedInstance].firstAppLaunchTime]);
9593

9694
if(shouldCallUpdatePostback){
97-
callCompletionHandler = NO;
9895
[[BNCSKAdNetwork sharedInstance] updatePostbackConversionValue: conversionValue.longValue coarseValue:coarseConversionValue lockWindow:lockWin completionHandler:^(NSError * _Nullable error) {
99-
if (self.completion) {
100-
self.completion(dictionary, error);
101-
}
10296
if (error) {
10397
BNCLogError([NSString stringWithFormat:@"Update conversion value failed with error - %@", [error description]]);
10498
} else {
@@ -109,11 +103,7 @@ - (void)processResponse:(BNCServerResponse*)response error:(NSError*)error {
109103
}
110104

111105
} else if (@available(iOS 15.4, *)) {
112-
callCompletionHandler = NO;
113106
[[BNCSKAdNetwork sharedInstance] updatePostbackConversionValue:conversionValue.intValue completionHandler: ^(NSError *error){
114-
if (self.completion) {
115-
self.completion(dictionary, error);
116-
}
117107
if (error) {
118108
BNCLogError([NSString stringWithFormat:@"Update conversion value failed with error - %@", [error description]]);
119109
} else {
@@ -128,7 +118,7 @@ - (void)processResponse:(BNCServerResponse*)response error:(NSError*)error {
128118
}
129119
}
130120

131-
if (self.completion && callCompletionHandler) {
121+
if (self.completion) {
132122
self.completion(dictionary, error);
133123
}
134124
}

Branch-SDK/BranchOpenRequest.m

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -291,35 +291,22 @@ - (void)processResponse:(BNCServerResponse *)response error:(NSError *)error {
291291
[[BNCAppGroupsData shared] saveAppClipData];
292292
}
293293

294-
BOOL callCalback = YES;
295-
296294
if ([data[BRANCH_RESPONSE_KEY_INVOKE_REGISTER_APP] isKindOfClass:NSNumber.class]) {
297295
NSNumber *invokeRegister = (NSNumber *)data[BRANCH_RESPONSE_KEY_INVOKE_REGISTER_APP];
298296
preferenceHelper.invokeRegisterApp = invokeRegister.boolValue;
299297
if (invokeRegister.boolValue && self.isInstall) {
300298
if (@available(iOS 16.1, *)){
301-
callCalback = NO;
302299
NSString *defaultCoarseConValue = [[BNCSKAdNetwork sharedInstance] getCoarseConversionValueFromDataResponse:@{}];
303300
[[BNCSKAdNetwork sharedInstance] updatePostbackConversionValue:0 coarseValue:defaultCoarseConValue
304301
lockWindow:NO completionHandler:^(NSError * _Nullable error) {
305-
306-
if(self.callback){
307-
self.callback(YES, error);
308-
}
309-
310302
if (error) {
311303
BNCLogError([NSString stringWithFormat:@"Update conversion value failed with error - %@", [error description]]);
312304
} else {
313305
BNCLogDebug([NSString stringWithFormat:@"Update conversion value was successful for INSTALL Event"]);
314306
}
315307
}];
316308
} else if (@available(iOS 15.4, *)){
317-
callCalback = NO;
318309
[[BNCSKAdNetwork sharedInstance] updatePostbackConversionValue:0 completionHandler:^(NSError * _Nullable error) {
319-
if(self.callback){
320-
self.callback(YES, error);
321-
}
322-
323310
if (error) {
324311
BNCLogError([NSString stringWithFormat:@"Update conversion value failed with error - %@", [error description]]);
325312
} else {
@@ -348,13 +335,8 @@ - (void)processResponse:(BNCServerResponse *)response error:(NSError *)error {
348335
BNCLogDebug([NSString stringWithFormat:@"SKAN 4.0 params - conversionValue:%@ coarseValue:%@, locked:%d, shouldCallPostback:%d, currentWindow:%d, firstAppLaunchTime: %@", conversionValue, coarseConversionValue, lockWin, shouldCallUpdatePostback, (int)preferenceHelper.skanCurrentWindow, preferenceHelper.firstAppLaunchTime]);
349336

350337
if(shouldCallUpdatePostback){
351-
callCalback = NO;
352338
[[BNCSKAdNetwork sharedInstance] updatePostbackConversionValue: conversionValue.longValue coarseValue:coarseConversionValue lockWindow:lockWin completionHandler:^(NSError * _Nullable error) {
353339

354-
if(self.callback){
355-
self.callback(YES, error);
356-
}
357-
358340
if (error) {
359341
BNCLogError([NSString stringWithFormat:@"Update conversion value failed with error - %@", [error description]]);
360342
} else {
@@ -363,13 +345,8 @@ - (void)processResponse:(BNCServerResponse *)response error:(NSError *)error {
363345
}];
364346
}
365347
} else if (@available(iOS 15.4, *)) {
366-
callCalback = NO;
367348
[[BNCSKAdNetwork sharedInstance] updatePostbackConversionValue:conversionValue.intValue completionHandler: ^(NSError *error){
368349

369-
if(self.callback){
370-
self.callback(YES, error);
371-
}
372-
373350
if (error) {
374351
BNCLogError([NSString stringWithFormat:@"Update conversion value failed with error - %@", [error description]]);
375352
} else {
@@ -385,7 +362,7 @@ - (void)processResponse:(BNCServerResponse *)response error:(NSError *)error {
385362
}
386363

387364

388-
if (self.callback && callCalback) {
365+
if (self.callback) {
389366
self.callback(YES, nil);
390367
}
391368
}

0 commit comments

Comments
 (0)