Skip to content

Commit 29b63f7

Browse files
Merge pull request #976 from BranchMetrics/staging
v0.30.1
2 parents 93af5bc + 7f976e5 commit 29b63f7

File tree

10 files changed

+65
-25
lines changed

10 files changed

+65
-25
lines changed

Branch-SDK-Tests/BNCFacebookAppLinksTests.m

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,24 @@
99
#import <XCTest/XCTest.h>
1010
#import "BNCFacebookMock.h"
1111
#import "BNCFacebookAppLinks.h"
12+
#import "Branch.h"
1213

1314
@interface BNCFacebookAppLinks()
1415
- (BOOL)isDeepLinkingClassAvailable;
1516
@end
1617

1718
@interface BNCFacebookAppLinksTests : XCTestCase
1819
@property (nonatomic, strong, readwrite) BNCFacebookAppLinks *applinks;
20+
@property (nonatomic, strong, readwrite) Branch *branch;
21+
@property (nonatomic, strong, readwrite) BNCPreferenceHelper *preferenceHelper;
1922
@end
2023

2124
@implementation BNCFacebookAppLinksTests
2225

2326
- (void)setUp {
27+
self.branch = [Branch getInstance];
2428
self.applinks = [BNCFacebookAppLinks new];
29+
self.preferenceHelper = [BNCPreferenceHelper preferenceHelper];
2530
}
2631

2732
- (void)tearDown {
@@ -56,4 +61,32 @@ - (void)testFetchFacebookAppLink {
5661
}];
5762
}
5863

64+
// check if FBSDKAppLinkUtility.fetchDeferredAppLink is called on the main thread
65+
// https://developers.facebook.com/docs/reference/ios/current/class/FBSDKAppLinkUtility
66+
- (void)testCheckFacebookAppLinks {
67+
__block XCTestExpectation *expectation = [self expectationWithDescription:@""];
68+
69+
[self.branch registerFacebookDeepLinkingClass:[BNCFacebookMock new]];
70+
71+
// checkFacebookAppLinks is not public, so use reflection to call it
72+
SEL selector = NSSelectorFromString(@"checkFacebookAppLinks");
73+
((void (*)(id, SEL))[self.branch methodForSelector:selector])(self.branch, selector);
74+
75+
// wait 2 secs, then fulfill expectation, if checkFacebookAppLinks succeeded in setting
76+
// BNCPreferenceHelper's property 'faceBookAppLink'
77+
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
78+
if ([self.preferenceHelper faceBookAppLink]) {
79+
XCTAssertTrue([[self.preferenceHelper faceBookAppLink].absoluteString isEqualToString:@"https://branch.io"]);
80+
[expectation fulfill];
81+
} else {
82+
XCTFail(@"BNCPreferenceHelper.faceBookAppLink is nil after 2 seconds");
83+
}
84+
});
85+
86+
// wait 3 secs, then check if expectation's been fulfilled
87+
[self waitForExpectationsWithTimeout:3 handler:^(NSError * _Nullable error) {
88+
NSLog(@"%@", error);
89+
}];
90+
}
91+
5992
@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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ - (void)fetchFacebookAppLinkWithCompletion:(void (^_Nullable)(NSURL *__nullable
6363
}
6464
};
6565

66+
dispatch_async(dispatch_get_main_queue(), ^{
6667
((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.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

carthage-files/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>0.30.0</string>
18+
<string>0.30.1</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>0.30.0</string>
22+
<string>0.30.1</string>
2323
<key>NSPrincipalClass</key>
2424
<string></string>
2525
</dict>

scripts/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Options:
3131
USAGE
3232
}
3333

34-
version=0.30.0
34+
version=0.30.1
3535

3636
if (( $# == 0 )); then
3737
echo $version

0 commit comments

Comments
 (0)