Skip to content

Commit 855640f

Browse files
[release] 1.38.0
1 parent b42ae70 commit 855640f

32 files changed

+889
-666
lines changed

Branch-SDK/BNCConfig.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
NSString * const BNC_API_BASE_URL = @"https://api2.branch.io";
1212
NSString * const BNC_API_VERSION = @"v1";
1313
NSString * const BNC_LINK_URL = @"https://bnc.lt";
14-
NSString * const BNC_SDK_VERSION = @"0.37.0";
14+
NSString * const BNC_SDK_VERSION = @"1.38.0";

Branch-SDK/BNCPreferenceHelper.m

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -872,50 +872,12 @@ - (NSInteger)readIntegerFromDefaults:(NSString *)key {
872872

873873
#pragma mark - Preferences File URL
874874

875-
+ (NSString *)prefsFile_deprecated {
876-
NSString * path =
877-
[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)
878-
firstObject]
879-
stringByAppendingPathComponent:BRANCH_PREFS_FILE];
880-
return path;
881-
}
882-
883875
+ (NSURL* _Nonnull) URLForPrefsFile {
884876
NSURL *URL = BNCURLForBranchDirectory();
885877
URL = [URL URLByAppendingPathComponent:BRANCH_PREFS_FILE isDirectory:NO];
886878
return URL;
887879
}
888880

889-
+ (void) moveOldPrefsFile {
890-
NSString* oldPath = self.prefsFile_deprecated;
891-
NSURL *oldURL = (oldPath) ? [NSURL fileURLWithPath:self.prefsFile_deprecated] : nil;
892-
NSURL *newURL = [self URLForPrefsFile];
893-
894-
if (!oldURL || !newURL) { return; }
895-
896-
NSError *error = nil;
897-
[[NSFileManager defaultManager]
898-
moveItemAtURL:oldURL
899-
toURL:newURL
900-
error:&error];
901-
902-
if (error && error.code != NSFileNoSuchFileError) {
903-
if (error.code == NSFileWriteFileExistsError) {
904-
[[NSFileManager defaultManager]
905-
removeItemAtURL:oldURL
906-
error:&error];
907-
} else {
908-
BNCLogError([NSString stringWithFormat:@"Can't move prefs file: %@.", error]);
909-
}
910-
}
911-
}
912-
913-
+ (void) initialize {
914-
if (self == [BNCPreferenceHelper self]) {
915-
[self moveOldPrefsFile];
916-
}
917-
}
918-
919881
@end
920882

921883
#pragma mark - BNCURLForBranchDirectory

Branch-SDK/BNCServerInterface.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ - (void)genericHTTPRequest:(NSURLRequest *)request
244244
if (Branch.trackingDisabled) {
245245
NSString *endpoint = request.URL.absoluteString;
246246

247-
// if endpoint is not on the whitelist, fail it.
248-
if (![self whiteListContainsEndpoint:endpoint]) {
247+
// if endpoint is not linking related, fail it.
248+
if (![self isLinkingRelatedRequest:endpoint]) {
249249
[[BNCPreferenceHelper preferenceHelper] clearTrackingInformation];
250250
NSError *error = [NSError branchErrorWithCode:BNCTrackingDisabledError];
251251
BNCLogWarning([NSString stringWithFormat:@"Dropping Request %@: - %@", endpoint, error]);
@@ -269,7 +269,7 @@ - (void)genericHTTPRequest:(NSURLRequest *)request
269269
}
270270
}
271271

272-
- (BOOL)whiteListContainsEndpoint:(NSString *)endpoint {
272+
- (BOOL)isLinkingRelatedRequest:(NSString *)endpoint {
273273
BNCPreferenceHelper *prefs = [BNCPreferenceHelper preferenceHelper];
274274
BOOL hasIdentifier = (prefs.linkClickIdentifier.length > 0 ) || (prefs.spotlightIdentifier.length > 0 ) || (prefs.universalLinkUrl.length > 0);
275275

Branch-SDK/BNCServerRequestQueue.m

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -365,49 +365,12 @@ + (NSString *)exceptionString:(NSException *)exception {
365365
[exception.callStackSymbols componentsJoinedByString:@"\n\t"]];
366366
}
367367

368-
+ (NSString *)queueFile_deprecated {
369-
NSString *path =
370-
[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)
371-
firstObject]
372-
stringByAppendingPathComponent:BRANCH_QUEUE_FILE];
373-
return path;
374-
}
375-
376368
+ (NSURL* _Nonnull) URLForQueueFile {
377369
NSURL *URL = BNCURLForBranchDirectory();
378370
URL = [URL URLByAppendingPathComponent:BRANCH_QUEUE_FILE isDirectory:NO];
379371
return URL;
380372
}
381373

382-
+ (void) moveOldQueueFile {
383-
NSURL *oldURL = [NSURL fileURLWithPath:self.queueFile_deprecated];
384-
NSURL *newURL = [self URLForQueueFile];
385-
386-
if (!oldURL || !newURL) { return; }
387-
388-
NSError *error = nil;
389-
[[NSFileManager defaultManager]
390-
moveItemAtURL:oldURL
391-
toURL:newURL
392-
error:&error];
393-
394-
if (error && error.code != NSFileNoSuchFileError) {
395-
if (error.code == NSFileWriteFileExistsError) {
396-
[[NSFileManager defaultManager]
397-
removeItemAtURL:oldURL
398-
error:&error];
399-
} else {
400-
BNCLogError([NSString stringWithFormat:@"Failed to move the queue file: %@.", error]);
401-
}
402-
}
403-
}
404-
405-
+ (void) initialize {
406-
if (self == [BNCServerRequestQueue self]) {
407-
[self moveOldQueueFile];
408-
}
409-
}
410-
411374
#pragma mark - Shared Method
412375

413376
+ (id)getInstance {

Branch-SDK/Branch.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -619,18 +619,18 @@ typedef NS_ENUM(NSUInteger, BranchCreditHistoryOrder) {
619619
-(void)setDeepLinkDebugMode:(nullable NSDictionary *)debugParams;
620620

621621
/**
622-
Add a scheme to a whitelist of URI schemes that will be tracked by Branch. Default to all schemes.
622+
Allow a URI scheme to be tracked by Branch. Default to all schemes.
623623
624-
@param scheme to add to the whitelist, i.e. @"http", @"https" or @"myapp"
624+
@param scheme URI scheme allowed to track, i.e. @"http", @"https" or @"myapp"
625625
*/
626-
-(void)addWhiteListedScheme:(nullable NSString *)scheme;
626+
-(void)addAllowedScheme:(nullable NSString *)scheme;
627627

628628
/**
629-
Add an array of schemes to a whitelist of URI schemes that will be tracked by Branch. Default to all schemes.
629+
Allow an array of URI schemes to be tracked by Branch. Default to all schemes.
630630
631-
@param schemes array to add to the whitelist, i.e. @[@"http", @"https", @"myapp"]
631+
@param schemes An array of URI schemes allowed to track, i.e. @[@"http", @"https", @"myapp"]
632632
*/
633-
-(void)setWhiteListedSchemes:(nullable NSArray *)schemes;
633+
-(void)setAllowedSchemes:(nullable NSArray *)schemes;
634634

635635
/**
636636
@brief Sets an array of regex patterns that match URLs for Branch to ignore.
@@ -1120,7 +1120,7 @@ typedef NS_ENUM(NSUInteger, BranchCreditHistoryOrder) {
11201120
@param window attribution window in days. If the window is 0, the server will use the server side default. If the window is outside the server supported range, it will default to 30 days.
11211121
@param completion callback with attribution data
11221122
*/
1123-
- (void)lastAttributedTouchDataWithAttributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData * _Nullable latd))completion;
1123+
- (void)lastAttributedTouchDataWithAttributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData * _Nullable latd, NSError * _Nullable error))completion;
11241124

11251125
#pragma mark - Short Url Sync methods
11261126

Branch-SDK/Branch.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ @interface Branch() <BranchDeepLinkingControllerCompletionDelegate> {
140140
@property (strong, nonatomic) NSMutableDictionary *deepLinkControllers;
141141
@property (weak, nonatomic) UIViewController *deepLinkPresentingController;
142142
@property (strong, nonatomic) NSDictionary *deepLinkDebugParams;
143-
@property (strong, nonatomic) NSMutableArray *whiteListedSchemeList;
143+
@property (strong, nonatomic) NSMutableArray *allowedSchemeList;
144144
@property (strong, nonatomic) BNCURLFilter *urlFilter;
145145

146146
#if !TARGET_OS_TV
@@ -193,7 +193,7 @@ - (id)initWithInterface:(BNCServerInterface *)interface
193193
_processing_sema = dispatch_semaphore_create(1);
194194
_networkCount = 0;
195195
_deepLinkControllers = [[NSMutableDictionary alloc] init];
196-
_whiteListedSchemeList = [[NSMutableArray alloc] init];
196+
_allowedSchemeList = [[NSMutableArray alloc] init];
197197

198198
#if !TARGET_OS_TV
199199
_contentDiscoveryManager = [[BNCContentDiscoveryManager alloc] init];
@@ -665,12 +665,12 @@ - (void)setDeepLinkDebugMode:(NSDictionary *)debugParams {
665665
self.deepLinkDebugParams = debugParams;
666666
}
667667

668-
- (void)setWhiteListedSchemes:(NSArray *)schemes {
669-
self.whiteListedSchemeList = [schemes mutableCopy];
668+
- (void)setAllowedSchemes:(NSArray *)schemes {
669+
self.allowedSchemeList = [schemes mutableCopy];
670670
}
671671

672-
- (void)addWhiteListedScheme:(NSString *)scheme {
673-
[self.whiteListedSchemeList addObject:scheme];
672+
- (void)addAllowedScheme:(NSString *)scheme {
673+
[self.allowedSchemeList addObject:scheme];
674674
}
675675

676676
- (void)setUrlPatternsToIgnore:(NSArray<NSString*>*)urlsToIgnore {
@@ -731,8 +731,8 @@ - (BOOL)handleSchemeDeepLink_private:(NSURL*)url sceneIdentifier:(NSString *)sce
731731
NSString *urlScheme = [url scheme];
732732

733733
// save the incoming url in the preferenceHelper in the externalIntentURI field
734-
if ([self.whiteListedSchemeList count]) {
735-
for (NSString *scheme in self.whiteListedSchemeList) {
734+
if ([self.allowedSchemeList count]) {
735+
for (NSString *scheme in self.allowedSchemeList) {
736736
if (urlScheme && [scheme isEqualToString:urlScheme]) {
737737
self.preferenceHelper.externalIntentURI = [url absoluteString];
738738
self.preferenceHelper.referringURL = [url absoluteString];
@@ -1285,7 +1285,7 @@ - (void)crossPlatformIdDataWithCompletion:(void(^) (BranchCrossPlatformID * _Nul
12851285
});
12861286
}
12871287

1288-
- (void)lastAttributedTouchDataWithAttributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData * _Nullable latd))completion {
1288+
- (void)lastAttributedTouchDataWithAttributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData * _Nullable latd, NSError * _Nullable error))completion {
12891289
[self initSafetyCheck];
12901290
dispatch_async(self.isolationQueue, ^(){
12911291
[BranchLastAttributedTouchData requestLastTouchAttributedData:self.serverInterface key:self.class.branchKey attributionWindow:window completion:completion];

Branch-SDK/BranchLastAttributedTouchData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
2020

2121
+ (nullable BranchLastAttributedTouchData *)buildFromJSON:(NSDictionary *)json;
2222

23-
+ (void)requestLastTouchAttributedData:(BNCServerInterface *)serverInterface key:(NSString *)key attributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData *latd))completion;
23+
+ (void)requestLastTouchAttributedData:(BNCServerInterface *)serverInterface key:(NSString *)key attributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData *latd, NSError *error))completion;
2424

2525
@end
2626

Branch-SDK/BranchLastAttributedTouchData.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ + (BranchLastAttributedTouchData *)buildFromJSON:(NSDictionary *)json {
2626
return nil;
2727
}
2828

29-
+ (void)requestLastTouchAttributedData:(BNCServerInterface *)serverInterface key:(NSString *)key attributionWindow:(NSInteger)window completion:(void(^) (BranchLastAttributedTouchData *latd))completion {
29+
+ (void)requestLastTouchAttributedData:(BNCServerInterface *)serverInterface key:(NSString *)key attributionWindow:(NSInteger)window completion:(void (^)(BranchLastAttributedTouchData *__nullable latd, NSError *__nullable error))completion {
3030
BranchLATDRequest *request = [BranchLATDRequest new];
3131

3232
// Limit attribution range to about a year. Although the server only supports up to 90 days as of Nov. 2019, it will fail gracefully for higher values.
@@ -41,14 +41,14 @@ + (void)requestLastTouchAttributedData:(BNCServerInterface *)serverInterface key
4141
// error is logged by the network service, skip parsing on error
4242
if (error) {
4343
if (completion) {
44-
completion(nil);
44+
completion(nil, error);
4545
}
4646
return;
4747
}
4848

4949
BranchLastAttributedTouchData *latd = [self buildFromJSON:response.data];
5050
if (completion) {
51-
completion(latd);
51+
completion(latd, error);
5252
}
5353
}];
5454
}

Branch-SDK/NSError+Branch.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ + (NSString *) messageForCode:(BNCErrorCode)code {
4141
[messages setObject:@"Can't redeem zero credits." forKey:@(BNCRedeemZeroCreditsError)];
4242
[messages setObject:@"The Spotlight identifier is required to remove indexing from spotlight." forKey:@(BNCSpotlightIdentifierError)];
4343
[messages setObject:@"Spotlight cannot remove publicly indexed content." forKey:@(BNCSpotlightPublicIndexError)];
44-
[messages setObject:@"User tracking is disabled and the request is not on the whitelist" forKey:@(BNCTrackingDisabledError)];
44+
[messages setObject:@"User tracking is disabled and the request is not allowed" forKey:@(BNCTrackingDisabledError)];
4545
});
4646

4747
NSString *errorMessage = [messages objectForKey:@(code)];

Branch-TestBed/Branch-SDK-Tests/BNCUserAgentCollectorTests.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ - (void)testCollectUserAgent {
7070
[expectation fulfill];
7171
}];
7272

73-
[self waitForExpectationsWithTimeout:2.0 handler:^(NSError * _Nullable error) {
73+
[self waitForExpectationsWithTimeout:4.0 handler:^(NSError * _Nullable error) {
7474

7575
}];
7676
}

0 commit comments

Comments
 (0)