Skip to content

Commit 6074aa8

Browse files
Merge pull request #455 from BranchMetrics/install-request-delay
setInstallRequestDelay
2 parents 5117089 + 6b20d53 commit 6074aa8

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

Branch-SDK/Branch-SDK/BNCPreferenceHelper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
@property (assign, nonatomic) NSTimeInterval timeout;
3737
@property (strong, nonatomic) NSString *externalIntentURI;
3838
@property (strong, nonatomic) NSMutableDictionary *savedAnalyticsData;
39+
@property (assign, nonatomic) NSInteger installRequestDelay;
3940

4041
+ (BNCPreferenceHelper *)preferenceHelper;
4142

Branch-SDK/Branch-SDK/Branch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ typedef NS_ENUM(NSUInteger, BranchCreditHistoryOrder) {
468468

469469
- (void)resumeInit;
470470

471+
- (void)setInstallRequestDelay:(NSInteger)installRequestDelay;
472+
471473
#pragma mark - Session Item methods
472474

473475
///--------------------

Branch-SDK/Branch-SDK/Branch.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ - (void)resumeInit {
271271
}
272272
}
273273

274+
- (void)setInstallRequestDelay:(NSInteger)installRequestDelay {
275+
self.preferenceHelper.installRequestDelay = installRequestDelay;
276+
}
274277

275278
#pragma mark - InitSession Permutation methods
276279

@@ -1367,4 +1370,4 @@ + (NSString *)kitDisplayVersion {
13671370
return @"0.12.10";
13681371
}
13691372

1370-
@end
1373+
@end

Branch-SDK/Branch-SDK/Requests/BranchInstallRequest.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ - (void)makeRequest:(BNCServerInterface *)serverInterface key:(NSString *)key ca
3636
params[BRANCH_REQUEST_KEY_DEBUG] = @(preferenceHelper.isDebug);
3737

3838
if ([[BNCStrongMatchHelper strongMatchHelper] shouldDelayInstallRequest]) {
39-
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(750 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
39+
NSInteger delay = 750;
40+
if (preferenceHelper.installRequestDelay) {
41+
delay = preferenceHelper.installRequestDelay;
42+
}
43+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
4044
[serverInterface postRequest:params url:[preferenceHelper getAPIURL:BRANCH_REQUEST_ENDPOINT_INSTALL] key:key callback:callback];
4145
});
4246
}

0 commit comments

Comments
 (0)