Skip to content

Commit 7f48fbc

Browse files
committed
SDK-842 save progress on work. Need to sync with server team to nail down some details
1 parent 7d52a81 commit 7f48fbc

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

Branch-SDK/Branch-SDK/BNCPreferenceHelper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ NSURL* /* _Nonnull */ BNCURLForBranchDirectory(void);
4949
@property (nonatomic, strong, readwrite) NSString *branchBlacklistURL;
5050
@property (assign, atomic) BOOL limitFacebookTracking;
5151
@property (strong, atomic) NSDate *previousAppBuildDate;
52+
@property (assign, nonatomic, readwrite) BOOL disableAdNetworkCallouts;
5253

5354
@property (strong, nonatomic, readwrite) NSURL *faceBookAppLink;
5455

Branch-SDK/Branch-SDK/BNCPreferenceHelper.m

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,19 @@ + (BNCPreferenceHelper *)preferenceHelper {
9797
return preferenceHelper;
9898
}
9999

100-
- (id)init {
100+
- (instancetype)init {
101101
self = [super init];
102-
if (!self) return self;
102+
if (self) {
103+
_timeout = DEFAULT_TIMEOUT;
104+
_retryCount = DEFAULT_RETRY_COUNT;
105+
_retryInterval = DEFAULT_RETRY_INTERVAL;
106+
_isDebug = NO;
107+
_persistPrefsQueue = [[NSOperationQueue alloc] init];
108+
_persistPrefsQueue.maxConcurrentOperationCount = 1;
103109

104-
_timeout = DEFAULT_TIMEOUT;
105-
_retryCount = DEFAULT_RETRY_COUNT;
106-
_retryInterval = DEFAULT_RETRY_INTERVAL;
107-
_isDebug = NO;
108-
_persistPrefsQueue = [[NSOperationQueue alloc] init];
109-
_persistPrefsQueue.maxConcurrentOperationCount = 1;
110-
111-
self.branchBlacklistURL = @"https://cdn.branch.io";
112-
110+
self.branchBlacklistURL = @"https://cdn.branch.io";
111+
self.disableAdNetworkCallouts = NO;
112+
}
113113
return self;
114114
}
115115

Branch-SDK/Branch-SDK/Branch.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,11 @@ typedef NS_ENUM(NSUInteger, BranchCreditHistoryOrder) {
678678
*/
679679
- (void)setNetworkTimeout:(NSTimeInterval)timeout;
680680

681+
/**
682+
683+
*/
684+
- (void)disableAdNetworkCallouts:(BOOL)disableCallouts;
685+
681686
/**
682687
Specify that Branch should NOT use an invisible SFSafariViewController to attempt cookie-based matching upon install.
683688
If you call this method, we will fall back to using our pool of cookie-IDFA pairs for matching.

Branch-SDK/Branch-SDK/Branch.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,10 @@ - (BOOL)isUserIdentified {
464464
return self.preferenceHelper.userIdentity != nil;
465465
}
466466

467+
- (void)disableAdNetworkCallouts:(BOOL)disableCallouts {
468+
self.preferenceHelper.disableAdNetworkCallouts = disableCallouts;
469+
}
470+
467471
- (void)setNetworkTimeout:(NSTimeInterval)timeout {
468472
self.preferenceHelper.timeout = timeout;
469473
}

Branch-SDK/Branch-SDK/Networking/BNCServerInterface.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,13 @@ - (NSMutableDictionary *)prepareParamDict:(NSDictionary *)params
456456
if (self.preferenceHelper.instrumentationDictionary.count && [reqType isEqualToString:@"POST"]) {
457457
fullParamDict[BRANCH_REQUEST_KEY_INSTRUMENTATION] = self.preferenceHelper.instrumentationDictionary;
458458
}
459-
459+
460+
// TODO: follow up with server team to get format and value location correct
461+
BOOL disableAdNetworkCallouts = self.preferenceHelper.disableAdNetworkCallouts;
462+
if (disableAdNetworkCallouts) {
463+
[fullParamDict setObject:[NSNumber numberWithInt:1] forKey:@"disable_ad_network_callouts"];
464+
}
465+
460466
return fullParamDict;
461467
}
462468

0 commit comments

Comments
 (0)