From ea1a627677e70aa4da1194ebf77ab32e07d27f4a Mon Sep 17 00:00:00 2001 From: echo Date: Mon, 22 Apr 2024 16:11:10 -0700 Subject: [PATCH 1/2] Fix issue with handlePushNotification --- BranchSDK.podspec | 2 +- BranchSDK.xcodeproj/project.pbxproj | 12 ++++++------ ChangeLog.md | 3 +++ Sources/BranchSDK/BNCConfig.m | 2 +- Sources/BranchSDK/Branch.m | 8 ++++++++ scripts/version.sh | 2 +- 6 files changed, 20 insertions(+), 9 deletions(-) diff --git a/BranchSDK.podspec b/BranchSDK.podspec index 57000aa0c..7a8018064 100644 --- a/BranchSDK.podspec +++ b/BranchSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "BranchSDK" - s.version = "3.4.2" + s.version = "3.4.3" 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? diff --git a/BranchSDK.xcodeproj/project.pbxproj b/BranchSDK.xcodeproj/project.pbxproj index 898d7983c..5991a7013 100644 --- a/BranchSDK.xcodeproj/project.pbxproj +++ b/BranchSDK.xcodeproj/project.pbxproj @@ -1974,7 +1974,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 3.4.2; + MARKETING_VERSION = 3.4.3; OTHER_LDFLAGS = ( "-weak_framework", LinkPresentation, @@ -2009,7 +2009,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 3.4.2; + MARKETING_VERSION = 3.4.3; OTHER_LDFLAGS = ( "-weak_framework", LinkPresentation, @@ -2215,7 +2215,7 @@ "@loader_path/Frameworks", ); MACH_O_TYPE = staticlib; - MARKETING_VERSION = 3.4.2; + MARKETING_VERSION = 3.4.3; OTHER_LDFLAGS = ( "-weak_framework", LinkPresentation, @@ -2254,7 +2254,7 @@ "@loader_path/Frameworks", ); MACH_O_TYPE = staticlib; - MARKETING_VERSION = 3.4.2; + MARKETING_VERSION = 3.4.3; OTHER_LDFLAGS = ( "-weak_framework", LinkPresentation, @@ -2291,7 +2291,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 3.4.2; + MARKETING_VERSION = 3.4.3; OTHER_LDFLAGS = ( "-weak_framework", LinkPresentation, @@ -2326,7 +2326,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 3.4.2; + MARKETING_VERSION = 3.4.3; OTHER_LDFLAGS = ( "-weak_framework", LinkPresentation, diff --git a/ChangeLog.md b/ChangeLog.md index 25634b69c..5a897be76 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,8 @@ Branch iOS SDK Change Log +v.3.4.3 +- Fix push notifications when app is backgrounded and the app uses `handlePushNotification` instead of `handleDeeplink` + v.3.4.2 - Fix tvOS when using SPM diff --git a/Sources/BranchSDK/BNCConfig.m b/Sources/BranchSDK/BNCConfig.m index f12410baf..b1bf233ed 100644 --- a/Sources/BranchSDK/BNCConfig.m +++ b/Sources/BranchSDK/BNCConfig.m @@ -8,7 +8,7 @@ #include "BNCConfig.h" -NSString * const BNC_SDK_VERSION = @"3.4.2"; +NSString * const BNC_SDK_VERSION = @"3.4.3"; NSString * const BNC_LINK_URL = @"https://bnc.lt"; NSString * const BNC_CDN_URL = @"https://cdn.branch.io"; diff --git a/Sources/BranchSDK/Branch.m b/Sources/BranchSDK/Branch.m index fc6484cfd..f1efced4f 100644 --- a/Sources/BranchSDK/Branch.m +++ b/Sources/BranchSDK/Branch.m @@ -837,8 +837,16 @@ + (BOOL)isBranchLink:(NSString *)urlString { #pragma mark - Push Notification support +// TODO: is there any benefit to the extra checks in this method over directly calling handleDeeplink? - (void)handlePushNotification:(NSDictionary *)userInfo { NSString *urlStr = [userInfo objectForKey:BRANCH_PUSH_NOTIFICATION_PAYLOAD_KEY]; + + // Saves URL into global storage for `applicationDidBecomeActive` + if (urlStr.length) { + // reusing this field, so as not to create yet another url slot on prefshelper + self.preferenceHelper.universalLinkUrl = urlStr; + self.preferenceHelper.referringURL = urlStr; + } // If app is active, then close out the session and start a new one. // Else the URL will be handled by `applicationDidBecomeActive`. diff --git a/scripts/version.sh b/scripts/version.sh index 62b048bfa..5ff89af15 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -30,7 +30,7 @@ Options: USAGE } -version=3.4.2 +version=3.4.3 prev_version="$version" if (( $# == 0 )); then From 603eb52e844a0b1d3d7fd29224574ad467ee3cd7 Mon Sep 17 00:00:00 2001 From: echo Date: Tue, 23 Apr 2024 08:00:18 -0700 Subject: [PATCH 2/2] Remove check for app state. Always assume new link data means we need to handle it. --- Sources/BranchSDK/Branch.m | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Sources/BranchSDK/Branch.m b/Sources/BranchSDK/Branch.m index f1efced4f..bae996c17 100644 --- a/Sources/BranchSDK/Branch.m +++ b/Sources/BranchSDK/Branch.m @@ -837,21 +837,10 @@ + (BOOL)isBranchLink:(NSString *)urlString { #pragma mark - Push Notification support -// TODO: is there any benefit to the extra checks in this method over directly calling handleDeeplink? - (void)handlePushNotification:(NSDictionary *)userInfo { NSString *urlStr = [userInfo objectForKey:BRANCH_PUSH_NOTIFICATION_PAYLOAD_KEY]; - // Saves URL into global storage for `applicationDidBecomeActive` if (urlStr.length) { - // reusing this field, so as not to create yet another url slot on prefshelper - self.preferenceHelper.universalLinkUrl = urlStr; - self.preferenceHelper.referringURL = urlStr; - } - - // If app is active, then close out the session and start a new one. - // Else the URL will be handled by `applicationDidBecomeActive`. - Class UIApplicationClass = NSClassFromString(@"UIApplication"); - if (urlStr && [[UIApplicationClass sharedApplication] applicationState] == UIApplicationStateActive) { NSURL *url = [NSURL URLWithString:urlStr]; if (url) { [self handleDeepLink:url sceneIdentifier:nil];