Skip to content

Commit 813c953

Browse files
authored
Limit app tracking (AIS-417) (#754)
* Added limit_app_tracking. * Updated variable names, added test. * Update test framework scheme. * Fixed merge error.
1 parent d599fca commit 813c953

File tree

9 files changed

+45
-3
lines changed

9 files changed

+45
-3
lines changed

Branch-SDK/Branch-SDK/BNCCommerceEvent.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ - (void)makeRequest:(BNCServerInterface *)serverInterface
354354
params[@"metadata"] = self.metadata;
355355
if (self.commerceDictionary)
356356
params[@"commerce_data"] = self.commerceDictionary;
357+
if (preferenceHelper.limitFacebookTracking)
358+
params[@"limit_facebook_tracking"] = CFBridgingRelease(kCFBooleanTrue);
357359

358360
NSString *URL = [preferenceHelper getAPIURL:BRANCH_REQUEST_ENDPOINT_USER_COMPLETED_ACTION];
359361
[serverInterface postRequest:params

Branch-SDK/Branch-SDK/BNCDeviceInfo.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ - (NSDictionary*) v2dictionary {
436436
addNumber(screenWidth, screen_width);
437437
addBoolean(unidentifiedDevice, unidentified_device);
438438
addString(localIPAddress, local_ip);
439-
439+
440440
#include "BNCFieldDefines.h"
441441

442442
if (!self.isAdTrackingEnabled)
@@ -451,6 +451,9 @@ - (NSDictionary*) v2dictionary {
451451
s = preferences.deviceFingerprintID;
452452
if (s.length) dictionary[@"device_fingerprint_id"] = s;
453453

454+
if (preferences.limitFacebookTracking)
455+
dictionary[@"limit_facebook_tracking"] = CFBridgingRelease(kCFBooleanTrue);
456+
454457
dictionary[@"sdk"] = @"ios";
455458
dictionary[@"sdk_version"] = BNC_SDK_VERSION;
456459

Branch-SDK/Branch-SDK/BNCPreferenceHelper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ NSURL* /* _Nonnull */ BNCURLForBranchDirectory(void);
4848
@property (strong, nonatomic) NSString *browserUserAgentString;
4949
@property (strong, atomic) NSString *referringURL;
5050
@property (strong, atomic) NSString *branchAPIURL;
51+
@property (assign, atomic) BOOL limitFacebookTracking;
5152

5253
+ (BNCPreferenceHelper *)preferenceHelper;
5354

Branch-SDK/Branch-SDK/BNCPreferenceHelper.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,18 @@ - (void)clearInstrumentationDictionary {
550550
}
551551
}
552552

553+
- (BOOL) limitFacebookTracking {
554+
@synchronized (self) {
555+
return [self readBoolFromDefaults:@"_limitFacebookTracking"];
556+
}
557+
}
558+
559+
- (void) setLimitFacebookTracking:(BOOL)limitFacebookTracking {
560+
@synchronized (self) {
561+
[self writeBoolToDefaults:@"_limitFacebookTracking" value:limitFacebookTracking];
562+
}
563+
}
564+
553565
#pragma mark - Credit Storage
554566

555567
- (NSMutableDictionary *)creditsDictionary {

Branch-SDK/Branch-SDK/Networking/Requests/BranchOpenRequest.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ - (void)makeRequest:(BNCServerInterface *)serverInterface key:(NSString *)key ca
6262
[self safeSetValue:preferenceHelper.spotlightIdentifier forKey:BRANCH_REQUEST_KEY_SPOTLIGHT_IDENTIFIER onDict:params];
6363
[self safeSetValue:preferenceHelper.universalLinkUrl forKey:BRANCH_REQUEST_KEY_UNIVERSAL_LINK_URL onDict:params];
6464
[self safeSetValue:preferenceHelper.externalIntentURI forKey:BRANCH_REQUEST_KEY_EXTERNAL_INTENT_URI onDict:params];
65+
if (preferenceHelper.limitFacebookTracking)
66+
params[@"limit_facebook_tracking"] = CFBridgingRelease(kCFBooleanTrue);
6567

6668
NSMutableDictionary *cdDict = [[NSMutableDictionary alloc] init];
6769
BranchContentDiscoveryManifest *contentDiscoveryManifest = [BranchContentDiscoveryManifest getInstance];

Branch-SDK/Branch-SDK/Networking/Requests/BranchUserCompletedActionRequest.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ - (void)makeRequest:(BNCServerInterface *)serverInterface
5353
params[BRANCH_REQUEST_KEY_DEVICE_FINGERPRINT_ID] = preferenceHelper.deviceFingerprintID;
5454
params[BRANCH_REQUEST_KEY_BRANCH_IDENTITY] = preferenceHelper.identityID;
5555
params[BRANCH_REQUEST_KEY_SESSION_ID] = preferenceHelper.sessionID;
56-
56+
if (preferenceHelper.limitFacebookTracking)
57+
params[@"limit_facebook_tracking"] = CFBridgingRelease(kCFBooleanTrue);
58+
5759
if (self.state) {
5860
params[BRANCH_REQUEST_KEY_STATE] = self.state;
5961
}

Branch-TestBed/Branch-TestBed-UITests/UITestBed.xcodeproj/xcshareddata/xcschemes/UITestBed.xcscheme

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0830"
3+
LastUpgradeVersion = "0910"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
2930
shouldUseLaunchSchemeArgsEnv = "YES">
3031
<Testables>
3132
</Testables>
@@ -45,6 +46,7 @@
4546
buildConfiguration = "Debug"
4647
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4748
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
49+
language = ""
4850
launchStyle = "0"
4951
useCustomWorkingDirectory = "NO"
5052
ignoresPersistentStateOnLaunch = "NO"

Branch-TestBed/Branch-TestBed-UITests/UITestBed/Assets.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
"idiom" : "ipad",
8585
"size" : "83.5x83.5",
8686
"scale" : "2x"
87+
},
88+
{
89+
"idiom" : "ios-marketing",
90+
"size" : "1024x1024",
91+
"scale" : "1x"
8792
}
8893
],
8994
"info" : {

Branch-TestBed/Branch-TestBed-UITests/UITestBed/TBBranchViewController.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ - (void)initializeTableData {
6969
row(@"Show Local IP Addess", showLocalIPAddress:);
7070
row(@"Show Current View Controller", showCurrentViewController:)
7171
row(@"Show App Dates", showDatesAction:)
72+
row(@"Toggle Facebook App Tracking", toggleFacebookAppTrackingAction:)
7273

7374
#undef section
7475
#undef row
@@ -317,6 +318,18 @@ - (IBAction) showCurrentViewController:(id)send {
317318
];
318319
}
319320

321+
- (IBAction) toggleFacebookAppTrackingAction:(id)sender {
322+
BNCPreferenceHelper *prefs = [BNCPreferenceHelper preferenceHelper];
323+
BOOL nextState = !prefs.limitFacebookTracking;
324+
prefs.limitFacebookTracking = nextState;
325+
[self showDataViewControllerWithObject:@{
326+
@"Limit Facebook App Tracking": (nextState) ? @"On" : @"Off"
327+
}
328+
title:@"Limit Facebook App Tracking"
329+
message:nil
330+
];
331+
}
332+
320333
- (IBAction) showDatesAction:(id)sender {
321334
NSDate *buildDate = [BNCSystemObserver appBuildDate];
322335
NSDate *installDate = [BNCSystemObserver appInstallDate];

0 commit comments

Comments
 (0)