Skip to content

Commit

Permalink
INTENG-21106 Fix for double opens (#1425)
Browse files Browse the repository at this point in the history
* INTENG-21106 Fix for double opens
initSceneSessionWithLaunchOptions will call initUserSessionAndCallCallback method only is there is a push URL or BRANCH_DEFER_INIT_FOR_PLUGIN_RUNTIME_KEY is true.
In rest of the use cases initUserSessionAndCallCallback will be called by function - handleDeepLink(universal links or custom URIs ) or appDidBecomeActive (organic Opens)
* Updated fix for deffered init.
* Updated Version and ChangeLog for Release 3.6.2
  • Loading branch information
NidhiDixit09 authored Sep 9, 2024
1 parent ff03e3a commit 800ea81
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion BranchSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "BranchSDK"
s.version = "3.6.1"
s.version = "3.6.2"
s.summary = "Create an HTTP URL for any piece of content in your app"
s.description = <<-DESC
- Want the highest possible conversions on your sharing feature?
Expand Down
12 changes: 6 additions & 6 deletions BranchSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
OTHER_LDFLAGS = (
"-weak_framework",
LinkPresentation,
Expand Down Expand Up @@ -2009,7 +2009,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
OTHER_LDFLAGS = (
"-weak_framework",
LinkPresentation,
Expand Down Expand Up @@ -2215,7 +2215,7 @@
"@loader_path/Frameworks",
);
MACH_O_TYPE = staticlib;
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
OTHER_LDFLAGS = (
"-weak_framework",
LinkPresentation,
Expand Down Expand Up @@ -2254,7 +2254,7 @@
"@loader_path/Frameworks",
);
MACH_O_TYPE = staticlib;
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
OTHER_LDFLAGS = (
"-weak_framework",
LinkPresentation,
Expand Down Expand Up @@ -2291,7 +2291,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
OTHER_LDFLAGS = (
"-weak_framework",
LinkPresentation,
Expand Down Expand Up @@ -2326,7 +2326,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.6.1;
MARKETING_VERSION = 3.6.2;
OTHER_LDFLAGS = (
"-weak_framework",
LinkPresentation,
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Branch iOS SDK Change Log

v.3.6.2
- Fix for issue which was sending an extra open request on cold app launch.
- Updated fix for cold link launch when using deferred initialization and an AppDelegate only app.

v.3.6.1
- Fixed issues where external_intent_uri was incorrectly set in certain cases

Expand Down
2 changes: 1 addition & 1 deletion Sources/BranchSDK/BNCConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "BNCConfig.h"

NSString * const BNC_SDK_VERSION = @"3.6.1";
NSString * const BNC_SDK_VERSION = @"3.6.2";
NSString * const BNC_LINK_URL = @"https://bnc.lt";
NSString * const BNC_CDN_URL = @"https://cdn.branch.io";

Expand Down
13 changes: 11 additions & 2 deletions Sources/BranchSDK/Branch.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
NSString * const BRANCH_INIT_KEY_IS_FIRST_SESSION = @"+is_first_session";
NSString * const BRANCH_INIT_KEY_CLICKED_BRANCH_LINK = @"+clicked_branch_link";
static NSString * const BRANCH_PUSH_NOTIFICATION_PAYLOAD_KEY = @"branch";
static NSString * const BRANCH_DEFER_INIT_FOR_PLUGIN_RUNTIME_KEY = @"deferInitForPluginRuntime";

NSString * const BNCCanonicalIdList = @"$canonical_identifier_list";
NSString * const BNCPurchaseAmount = @"$amount";
Expand Down Expand Up @@ -615,9 +616,15 @@ - (void)initSessionWithLaunchOptions:(NSDictionary *)options isReferrable:(BOOL)

- (void)initSceneSessionWithLaunchOptions:(NSDictionary *)options isReferrable:(BOOL)isReferrable explicitlyRequestedReferrable:(BOOL)explicitlyRequestedReferrable automaticallyDisplayController:(BOOL)automaticallyDisplayController
registerDeepLinkHandler:(void (^)(BNCInitSessionResponse * _Nullable initResponse, NSError * _Nullable error))callback {
NSMutableDictionary * optionsWithDeferredInit = [[NSMutableDictionary alloc ] initWithDictionary:options];
if (self.deferInitForPluginRuntime) {
[optionsWithDeferredInit setObject:@1 forKey:@"BRANCH_DEFER_INIT_FOR_PLUGIN_RUNTIME_KEY"];
} else {
[optionsWithDeferredInit setObject:@0 forKey:@"BRANCH_DEFER_INIT_FOR_PLUGIN_RUNTIME_KEY"];
}
[self deferInitBlock:^{
self.sceneSessionInitWithCallback = callback;
[self initSessionWithLaunchOptions:options isReferrable:isReferrable explicitlyRequestedReferrable:explicitlyRequestedReferrable automaticallyDisplayController:automaticallyDisplayController];
[self initSessionWithLaunchOptions:(NSDictionary *)optionsWithDeferredInit isReferrable:isReferrable explicitlyRequestedReferrable:explicitlyRequestedReferrable automaticallyDisplayController:automaticallyDisplayController];
}];
}

Expand All @@ -642,7 +649,9 @@ - (void)initSessionWithLaunchOptions:(NSDictionary *)options
}
#endif

[self initUserSessionAndCallCallback:YES sceneIdentifier:nil urlString:pushURL reset:NO];
if(pushURL || [[options objectForKey:@"BRANCH_DEFER_INIT_FOR_PLUGIN_RUNTIME_KEY"] isEqualToNumber:@1] || (![options.allKeys containsObject:UIApplicationLaunchOptionsURLKey] && ![options.allKeys containsObject:UIApplicationLaunchOptionsUserActivityDictionaryKey]) ) {
[self initUserSessionAndCallCallback:YES sceneIdentifier:nil urlString:pushURL reset:NO];
}
}

- (void)setDeepLinkDebugMode:(NSDictionary *)debugParams {
Expand Down
2 changes: 1 addition & 1 deletion scripts/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Options:
USAGE
}

version=3.6.1
version=3.6.2
prev_version="$version"

if (( $# == 0 )); then
Expand Down

0 comments on commit 800ea81

Please sign in to comment.