Skip to content

Commit ad29340

Browse files
committed
Merge branch 'staging' into SDK-562-Additional-fields-for-Tune-compatibility
2 parents d8b9926 + ad3434c commit ad29340

File tree

13 files changed

+57
-30
lines changed

13 files changed

+57
-30
lines changed

Branch-SDK-Tests/BNCFacebookAppLinksTests.m

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ - (void)testFetchFacebookAppLink {
4848
[self.applinks registerFacebookDeepLinkingClass:[BNCFacebookMock new]];
4949
[self.applinks fetchFacebookAppLinkWithCompletion:^(NSURL * _Nullable appLink, NSError * _Nullable error) {
5050
XCTAssertTrue([[appLink absoluteString] isEqualToString:@"https://branch.io"]);
51+
XCTAssertTrue([NSThread isMainThread]);
5152
[expectation fulfill];
5253
}];
5354

@@ -56,4 +57,23 @@ - (void)testFetchFacebookAppLink {
5657
}];
5758
}
5859

60+
// check if FBSDKAppLinkUtility.fetchDeferredAppLink is called on the main thread
61+
// https://developers.facebook.com/docs/reference/ios/current/class/FBSDKAppLinkUtility
62+
- (void)testFetchFacebookAppLink_BackgroundThead {
63+
__block XCTestExpectation *expectation = [self expectationWithDescription:@""];
64+
65+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
66+
[self.applinks registerFacebookDeepLinkingClass:[BNCFacebookMock new]];
67+
[self.applinks fetchFacebookAppLinkWithCompletion:^(NSURL * _Nullable appLink, NSError * _Nullable error) {
68+
XCTAssertTrue([[appLink absoluteString] isEqualToString:@"https://branch.io"]);
69+
XCTAssertTrue([NSThread isMainThread]);
70+
[expectation fulfill];
71+
}];
72+
});
73+
74+
[self waitForExpectationsWithTimeout:2 handler:^(NSError * _Nullable error) {
75+
NSLog(@"%@", error);
76+
}];
77+
}
78+
5979
@end

Branch-SDK-Tests/BNCFacebookMock.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
//
88

99
#import "BNCFacebookMock.h"
10+
#import "NSError+Branch.h"
1011

1112
@implementation BNCFacebookMock
1213

1314
- (void)fetchDeferredAppLink:(void (^_Nullable)(NSURL *__nullable appLink, NSError * __nullable error))completion {
1415
if (completion) {
15-
NSURL *url = [NSURL URLWithString:@"https://branch.io"];
16-
completion(url, nil);
16+
if (![NSThread isMainThread]) {
17+
// fetchDeferredAppLink must be called from main thread
18+
// https://developers.facebook.com/docs/reference/ios/current/class/FBSDKAppLinkUtility
19+
completion(nil, [NSError branchErrorWithCode:BNCGeneralError localizedMessage:@"fetchDeferredAppLink must be called from main thread"]);
20+
} else {
21+
completion([NSURL URLWithString:@"https://branch.io"], nil);
22+
}
1723
}
1824
}
1925

Branch-SDK-Tests/BranchDelegate.Test.m

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ - (void) testNotificationsSuccess {
3030

3131
self.expectFailure = NO;
3232
self.notificationOrder = 0;
33-
self.branchWillOpenURLExpectation =
34-
[self expectationWithDescription:@"branchWillOpenURLExpectation"];
35-
self.branchWillOpenURLNotificationExpectation =
36-
[self expectationWithDescription:@"branchWillOpenURLNotificationExpectation"];
37-
self.branchDidOpenURLExpectation =
38-
[self expectationWithDescription:@"branchDidOpenURLExpectation"];
39-
self.branchDidOpenURLNotificationExpectation =
40-
[self expectationWithDescription:@"branchDidOpenURLNotificationExpectation"];
4133

4234
[[NSNotificationCenter defaultCenter]
4335
addObserver:self
@@ -125,14 +117,6 @@ - (void) testNotificationsFailure {
125117

126118
self.expectFailure = YES;
127119
self.notificationOrder = 0;
128-
self.branchWillOpenURLExpectation =
129-
[self expectationWithDescription:@"branchWillOpenURLExpectation"];
130-
self.branchWillOpenURLNotificationExpectation =
131-
[self expectationWithDescription:@"branchWillOpenURLNotificationExpectation"];
132-
self.branchDidOpenURLExpectation =
133-
[self expectationWithDescription:@"branchDidOpenURLExpectation"];
134-
self.branchDidOpenURLNotificationExpectation =
135-
[self expectationWithDescription:@"branchDidOpenURLNotificationExpectation"];
136120

137121
[[NSNotificationCenter defaultCenter]
138122
addObserver:self
@@ -329,4 +313,15 @@ - (void) branchDidStartSessionNotification:(NSNotification*)notification {
329313
[self.branchDidOpenURLNotificationExpectation fulfill];
330314
}
331315

316+
- (void)setUp {
317+
self.branchWillOpenURLExpectation =
318+
[self expectationWithDescription:@"branchWillOpenURLExpectation"];
319+
self.branchWillOpenURLNotificationExpectation =
320+
[self expectationWithDescription:@"branchWillOpenURLNotificationExpectation"];
321+
self.branchDidOpenURLExpectation =
322+
[self expectationWithDescription:@"branchDidOpenURLExpectation"];
323+
self.branchDidOpenURLNotificationExpectation =
324+
[self expectationWithDescription:@"branchDidOpenURLNotificationExpectation"];
325+
}
326+
332327
@end

Branch-SDK/Branch-SDK/BNCConfig.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
BOOL const BNC_API_PINNED = NO;
1313
NSString * const BNC_API_VERSION = @"v1";
1414
NSString * const BNC_LINK_URL = @"https://bnc.lt";
15-
NSString * const BNC_SDK_VERSION = @"0.30.0";
15+
NSString * const BNC_SDK_VERSION = @"0.30.1";

Branch-SDK/Branch-SDK/BNCFacebookAppLinks.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ - (void)fetchFacebookAppLinkWithCompletion:(void (^_Nullable)(NSURL *__nullable
6363
}
6464
};
6565

66-
((void (*)(id, SEL, void (^ __nullable)(NSURL *__nullable appLink, NSError * __nullable error)))[self.appLinkUtility methodForSelector:self.fetchDeferredAppLink])(self.appLinkUtility, self.fetchDeferredAppLink, completionBlock);
66+
dispatch_async(dispatch_get_main_queue(), ^{
67+
((void (*)(id, SEL, void (^ __nullable)(NSURL *__nullable appLink, NSError * __nullable error)))[self.appLinkUtility methodForSelector:self.fetchDeferredAppLink])(self.appLinkUtility, self.fetchDeferredAppLink, completionBlock);
68+
});
6769
}
6870

6971
@end

Branch-TestBed/Framework-Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>FMWK</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>0.30.0</string>
20+
<string>0.30.1</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>0.30.0</string>
24+
<string>0.30.1</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
2727
<key>NSHumanReadableCopyright</key>

Branch.framework/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
<key>CFBundlePackageType</key>
1818
<string>FMWK</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>0.30.0</string>
20+
<string>0.30.1</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>0.30.0</string>
24+
<string>0.30.1</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
2727
<key>NSHumanReadableCopyright</key>

Branch.framework/Versions/A/Branch

60.8 KB
Binary file not shown.

Branch.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "Branch"
3-
s.version = "0.30.0"
3+
s.version = "0.30.1"
44
s.summary = "Create an HTTP URL for any piece of content in your app"
55
s.description = <<-DESC
66
- Want the highest possible conversions on your sharing feature?

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Branch iOS SDK Change Log
22

3+
- v0.30.1
4+
* _*Master Release*_ - Dec 3, 2019
5+
* SDK-679 Call FB SDK on the main thread
6+
37
- v0.30.0
48
* _*Master Release*_ - Nov 13, 2019
59
* SDK-513 update Apple Search Ads behavior and API

0 commit comments

Comments
 (0)