Skip to content

Commit 5dd137d

Browse files
author
Edward Smith
committed
Merge QA.
2 parents 3a4c80f + bf3dac4 commit 5dd137d

File tree

13 files changed

+55
-46
lines changed

13 files changed

+55
-46
lines changed

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 = YES;
1313
NSString * const BNC_API_VERSION = @"v1";
1414
NSString * const BNC_LINK_URL = @"https://bnc.lt";
15-
NSString * const BNC_SDK_VERSION = @"0.25.2";
15+
NSString * const BNC_SDK_VERSION = @"0.25.3";

Branch-SDK/Branch-SDK/Branch.m

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ + (BranchLink*) linkWithUniversalObject:(BranchUniversalObject*)universalObject
115115

116116
#pragma mark - Branch
117117

118+
typedef NS_ENUM(NSInteger, BNCInitStatus) {
119+
BNCInitStatusUninitialized = 0,
120+
BNCInitStatusInitializing,
121+
BNCInitStatusInitialized
122+
};
123+
118124
@interface Branch() <BranchDeepLinkingControllerCompletionDelegate, FABKit> {
119125
NSInteger _networkCount;
120126
BNCURLBlackList *_userURLBlackList;
@@ -127,7 +133,7 @@ @interface Branch() <BranchDeepLinkingControllerCompletionDelegate, FABKit> {
127133
@property (copy, nonatomic) callbackWithBranchUniversalObject sessionInitWithBranchUniversalObjectCallback;
128134
@property (assign, atomic) NSInteger networkCount;
129135
@property (assign, nonatomic) NSInteger asyncRequestCount;
130-
@property (assign, nonatomic) BOOL isInitialized;
136+
@property (assign, nonatomic) BNCInitStatus initializationStatus;
131137
@property (assign, nonatomic) BOOL shouldCallSessionInitCallback;
132138
@property (assign, nonatomic) BOOL shouldAutomaticallyDeepLink;
133139
@property (strong, nonatomic) BNCLinkCache *linkCache;
@@ -242,7 +248,7 @@ - (id)initWithInterface:(BNCServerInterface *)interface
242248
_preferenceHelper = preferenceHelper;
243249

244250
_contentDiscoveryManager = [[BNCContentDiscoveryManager alloc] init];
245-
_isInitialized = NO;
251+
_initializationStatus = BNCInitStatusUninitialized;
246252
_shouldCallSessionInitCallback = YES;
247253
_processing_sema = dispatch_semaphore_create(1);
248254
_networkCount = 0;
@@ -452,7 +458,7 @@ - (void)validateSDKIntegration {
452458
}
453459

454460
- (void)resetUserSession {
455-
self.isInitialized = NO;
461+
self.initializationStatus = BNCInitStatusUninitialized;
456462
}
457463

458464
- (BOOL)isUserIdentified {
@@ -503,7 +509,7 @@ - (NSURL *)getUrlForOnboardingWithRedirectUrl:(NSString *)redirectUrl {
503509

504510
- (void)resumeInit {
505511
self.preferenceHelper.shouldWaitForInit = NO;
506-
if (self.isInitialized) {
512+
if (self.initializationStatus == BNCInitStatusInitialized) {
507513
BNCLogError(@"User session has already been initialized, so resumeInit is aborting.");
508514
}
509515
else if (![self.requestQueue containsInstallOrOpen]) {
@@ -534,7 +540,7 @@ + (void) setTrackingDisabled:(BOOL)disabled {
534540
[BNCPreferenceHelper preferenceHelper].trackingDisabled = YES;
535541
Branch *branch = Branch.getInstance;
536542
[branch clearNetworkQueue];
537-
branch.isInitialized = NO;
543+
branch.initializationStatus = BNCInitStatusUninitialized;
538544
[branch.linkCache clear];
539545
// Release the lock in case it's locked:
540546
[BranchOpenRequest releaseOpenResponseLock];
@@ -614,7 +620,7 @@ - (void)initSessionWithLaunchOptions:(NSDictionary *)options
614620

615621
// If the SDK is already initialized, this means that initSession is being called later in the app lifecycle
616622
// and that the developer is expecting to receive deep link parameters via the callback block immediately
617-
if (self.isInitialized) {
623+
if (self.initializationStatus == BNCInitStatusInitialized) {
618624
[self initUserSessionAndCallCallback:YES];
619625
}
620626

@@ -720,15 +726,10 @@ - (BOOL)handleDeepLink:(NSURL *)url fromSelf:(BOOL)isFromSelf {
720726
self.preferenceHelper.blacklistURLOpen = YES;
721727
self.preferenceHelper.externalIntentURI = blackListPattern;
722728
self.preferenceHelper.referringURL = blackListPattern;
723-
[self initUserSessionAndCallCallback:!self.isInitialized];
729+
[self initUserSessionAndCallCallback:(self.initializationStatus != BNCInitStatusInitialized)];
724730
return NO;
725731
}
726732

727-
self.preferenceHelper.blacklistURLOpen = NO;
728-
self.preferenceHelper.referringURL = nil;
729-
self.preferenceHelper.externalIntentURI = nil;
730-
self.preferenceHelper.universalLinkUrl = nil;
731-
732733
NSString *scheme = [url scheme];
733734
if ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"]) {
734735
return [self handleUniversalDeepLink_private:url.absoluteString fromSelf:isFromSelf];
@@ -772,7 +773,7 @@ - (BOOL)handleSchemeDeepLink_private:(NSURL*)url fromSelf:(BOOL)isFromSelf {
772773
self.preferenceHelper.linkClickIdentifier = params[@"link_click_id"];
773774
}
774775
}
775-
[self initUserSessionAndCallCallback:!self.isInitialized];
776+
[self initUserSessionAndCallCallback:(self.initializationStatus != BNCInitStatusInitialized)];
776777
return handled;
777778
}
778779

@@ -813,8 +814,10 @@ - (BOOL)handleUniversalDeepLink_private:(NSString*)urlString fromSelf:(BOOL)isFr
813814
[self resetUserSession];
814815
}
815816

816-
self.preferenceHelper.universalLinkUrl = urlString;
817-
self.preferenceHelper.referringURL = urlString;
817+
if (urlString.length) {
818+
self.preferenceHelper.universalLinkUrl = urlString;
819+
self.preferenceHelper.referringURL = urlString;
820+
}
818821
self.preferenceHelper.shouldWaitForInit = NO;
819822
[self initUserSessionAndCallCallback:YES];
820823

@@ -912,7 +915,7 @@ - (BOOL)isBranchLink: (NSString*)urlString {
912915
- (void)handlePushNotification:(NSDictionary *)userInfo {
913916
// look for a branch shortlink in the payload (shortlink because iOS7 only supports 256 bytes)
914917
NSString *urlStr = [userInfo objectForKey:BRANCH_PUSH_NOTIFICATION_PAYLOAD_KEY];
915-
if (urlStr) {
918+
if (urlStr.length) {
916919
// reusing this field, so as not to create yet another url slot on prefshelper
917920
self.preferenceHelper.universalLinkUrl = urlStr;
918921
self.preferenceHelper.referringURL = urlStr;
@@ -1032,7 +1035,7 @@ - (BOOL)checkAppleSearchAdsAttribution {
10321035

10331036
self.preferenceHelper.shouldWaitForInit = NO;
10341037
dispatch_async(dispatch_get_main_queue(), ^{
1035-
[self initUserSessionAndCallCallback:!self.isInitialized];
1038+
[self initUserSessionAndCallCallback:(self.initializationStatus != BNCInitStatusInitialized)];
10361039
});
10371040
}
10381041
};
@@ -1128,7 +1131,7 @@ - (void)logout {
11281131

11291132

11301133
- (void)logoutWithCallback:(callbackWithStatus)callback {
1131-
if (!self.isInitialized) {
1134+
if (self.initializationStatus == BNCInitStatusUninitialized) {
11321135
NSError *error =
11331136
(Branch.trackingDisabled)
11341137
? [NSError branchErrorWithCode:BNCTrackingDisabledError]
@@ -1788,7 +1791,7 @@ - (NSString *)generateShortUrl:(NSArray *)tags
17881791
linkData:linkData
17891792
linkCache:self.linkCache];
17901793

1791-
if (self.isInitialized && !self.preferenceHelper.trackingDisabled) {
1794+
if ((self.initializationStatus == BNCInitStatusInitialized) && !self.preferenceHelper.trackingDisabled) {
17921795
BNCLogDebug(@"Creating a custom URL synchronously.");
17931796
BNCServerResponse *serverResponse = [req makeRequest:self.serverInterface key:self.class.branchKey];
17941797
shortURL = [req processResponse:serverResponse];
@@ -1910,7 +1913,7 @@ - (void)registerViewWithParams:(NSDictionary *)params andCallback:(callbackWithP
19101913

19111914
- (void)applicationDidBecomeActive {
19121915
if (!Branch.trackingDisabled) {
1913-
if (!self.isInitialized &&
1916+
if ((self.initializationStatus != BNCInitStatusInitialized) &&
19141917
!self.preferenceHelper.shouldWaitForInit &&
19151918
![self.requestQueue containsInstallOrOpen]) {
19161919
[self initUserSessionAndCallCallback:YES];
@@ -1930,9 +1933,9 @@ - (void)applicationWillResignActive {
19301933
}
19311934

19321935
- (void)callClose {
1933-
if (self.isInitialized) {
1934-
self.isInitialized = NO;
1935-
1936+
if (self.initializationStatus != BNCInitStatusUninitialized) {
1937+
self.initializationStatus = BNCInitStatusUninitialized;
1938+
19361939
BranchContentDiscoverer *contentDiscoverer = [BranchContentDiscoverer getInstance];
19371940
if (contentDiscoverer) [contentDiscoverer stopDiscoveryTask];
19381941

@@ -2091,7 +2094,7 @@ - (void) clearNetworkQueue {
20912094
#pragma mark - Session Initialization
20922095

20932096
- (void)initSessionIfNeededAndNotInProgress {
2094-
if (!self.isInitialized &&
2097+
if (self.initializationStatus == BNCInitStatusUninitialized &&
20952098
!self.preferenceHelper.shouldWaitForInit &&
20962099
![self.requestQueue containsInstallOrOpen]) {
20972100
[self initUserSessionAndCallCallback:NO];
@@ -2122,7 +2125,7 @@ - (void)initUserSessionAndCallCallback:(BOOL)callCallback {
21222125
}
21232126
}
21242127
// If the session is not yet initialized
2125-
if (!self.isInitialized) {
2128+
if (self.initializationStatus != BNCInitStatusInitialized) {
21262129
[self initializeSession];
21272130
}
21282131
// If the session was initialized, but callCallback was specified, do so.
@@ -2184,6 +2187,7 @@ - (void)initializeSession {
21842187
[BranchOpenRequest setWaitNeededForOpenResponseLock];
21852188
BranchOpenRequest *req = [[clazz alloc] initWithCallback:initSessionCallback];
21862189
[self insertRequestAtFront:req];
2190+
self.initializationStatus = BNCInitStatusInitializing;
21872191
[self processNextQueueItem];
21882192
}
21892193
}
@@ -2200,7 +2204,7 @@ - (BOOL) removeInstallOrOpen {
22002204

22012205
- (void)handleInitSuccess {
22022206

2203-
self.isInitialized = YES;
2207+
self.initializationStatus = BNCInitStatusInitialized;
22042208
NSDictionary *latestReferringParams = [self getLatestReferringParams];
22052209

22062210
if ([latestReferringParams[@"_branch_validate"] isEqualToString:@"060514"]) {
@@ -2416,7 +2420,8 @@ -(void)presentSharingViewController: (UIViewController <BranchDeepLinkingControl
24162420
}
24172421

24182422
- (void)handleInitFailure:(NSError *)error {
2419-
self.isInitialized = NO;
2423+
self.initializationStatus = BNCInitStatusUninitialized;
2424+
24202425
if (self.shouldCallSessionInitCallback) {
24212426
if (self.sessionInitWithParamsCallback) {
24222427
self.sessionInitWithParamsCallback([[NSDictionary alloc] init], error);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,16 @@ - (void)processResponse:(BNCServerResponse *)response error:(NSError *)error {
232232
}
233233

234234
NSString *referringURL = nil;
235-
if (preferenceHelper.universalLinkUrl) {
235+
if (preferenceHelper.universalLinkUrl.length) {
236236
referringURL = preferenceHelper.universalLinkUrl;
237237
}
238-
else if (preferenceHelper.externalIntentURI) {
238+
else if (preferenceHelper.externalIntentURI.length) {
239239
referringURL = preferenceHelper.externalIntentURI;
240240
}
241241
else {
242242
NSDictionary *sessionDataDict = [BNCEncodingUtils decodeJsonStringToDictionary:sessionData];
243243
NSString *link = sessionDataDict[BRANCH_RESPONSE_KEY_BRANCH_REFERRING_LINK];
244-
if (link) referringURL = link;
244+
if (link.length) referringURL = link;
245245
}
246246

247247
// Clear link identifiers so they don't get reused on the next open

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.25.2</string>
20+
<string>0.25.3</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>0.25.2</string>
24+
<string>0.25.3</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.25.2</string>
20+
<string>0.25.3</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleVersion</key>
24-
<string>0.25.2</string>
24+
<string>0.25.3</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
2727
<key>NSHumanReadableCopyright</key>

Branch.framework/Versions/A/Branch

1.42 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.25.2"
3+
s.version = "0.25.3"
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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
Branch iOS SDK Change Log
22

3+
- v0.25.3
4+
* _*Master Release*_ - August 13, 2018
5+
* Fixed an occasional double app open from being sent to Branch.
6+
* Warning: Fabric no longer distributes third party kits like Branch. If you used Fabric to
7+
integrate and update the Branch SDK, use one of the other methods for integrating Branch
8+
as described [here, in our online documentation.](https://docs.branch.io/pages/apps/ios/#install-branch)
9+
310
- v0.25.2
411
* _*Master Release*_ - August 3, 2018
512
* IDFA is no longer sent when in debug mode for v2/events. DEVEX-685

Examples/UITestBed/UITestBed/TBAppDelegate.m

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ - (BOOL)application:(UIApplication *)application
2929
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
3030
BNCLogSetDisplayLevel(BNCLogLevelAll);
3131

32-
// Set to YES for testing GDPR compliance.
33-
// [Branch setTrackingDisabled:YES];
34-
3532
#if 0
3633
// This simulates tracking opt-in, rather than tracking opt-out.
3734
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"hasRunBefore"]) {

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.25.2</string>
18+
<string>0.25.3</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>0.25.2</string>
22+
<string>0.25.3</string>
2323
<key>NSPrincipalClass</key>
2424
<string></string>
2525
</dict>

0 commit comments

Comments
 (0)