From 440bb30a649dba4176cefbd65cb63e9088d7b2cc Mon Sep 17 00:00:00 2001 From: NidhiDixit09 <93544270+NidhiDixit09@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:54:10 -0800 Subject: [PATCH] Removed extra variables and initialized missing params.referringURL --- Sources/BranchSDK/Branch.m | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Sources/BranchSDK/Branch.m b/Sources/BranchSDK/Branch.m index 236cde5d5..aa83e3928 100644 --- a/Sources/BranchSDK/Branch.m +++ b/Sources/BranchSDK/Branch.m @@ -681,19 +681,17 @@ - (void)initSessionWithLaunchOptions:(NSDictionary *)options self.shouldAutomaticallyDeepLink = automaticallyDisplayController; // Check for Branch link in a push payload - NSString *pushURL = nil; BranchOpenRequestLinkParams *params = [[BranchOpenRequestLinkParams alloc] init]; #if !TARGET_OS_TV if ([options objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) { id branchUrlFromPush = [options objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey][BRANCH_PUSH_NOTIFICATION_PAYLOAD_KEY]; if ([branchUrlFromPush isKindOfClass:[NSString class]]) { - params.referringURL = branchUrlFromPush; - pushURL = (NSString *)branchUrlFromPush; + params.referringURL = (NSString *)branchUrlFromPush; } } #endif - if(pushURL || [[options objectForKey:@"BRANCH_DEFER_INIT_FOR_PLUGIN_RUNTIME_KEY"] isEqualToNumber:@1] || (![options.allKeys containsObject:UIApplicationLaunchOptionsURLKey] && ![options.allKeys containsObject:UIApplicationLaunchOptionsUserActivityDictionaryKey]) ) { + if(params.referringURL || [[options objectForKey:@"BRANCH_DEFER_INIT_FOR_PLUGIN_RUNTIME_KEY"] isEqualToNumber:@1] || (![options.allKeys containsObject:UIApplicationLaunchOptionsURLKey] && ![options.allKeys containsObject:UIApplicationLaunchOptionsUserActivityDictionaryKey]) ) { [self initUserSessionAndCallCallback:YES sceneIdentifier:nil urlParams:params reset:NO]; } } @@ -742,15 +740,11 @@ - (BOOL)handleDeepLink:(NSURL *)url sceneIdentifier:(NSString *)sceneIdentifier pattern = [self.userURLFilter patternMatchingURL:url]; } - BranchOpenRequestLinkParams *params = [[BranchOpenRequestLinkParams alloc] init]; if (pattern) { + BranchOpenRequestLinkParams *params = [[BranchOpenRequestLinkParams alloc] init]; params.dropURLOpen = YES; - - NSString *urlString = [url absoluteString]; - params.referringURL = urlString; - + params.referringURL = [url absoluteString];; [self initUserSessionAndCallCallback:YES sceneIdentifier:sceneIdentifier urlParams:params reset:YES]; - return NO; } @@ -869,7 +863,7 @@ - (BOOL)continueUserActivity:(NSUserActivity *)userActivity sceneIdentifier:(NSS } } #endif - + params.referringURL = userActivity.webpageURL.absoluteString; [self initUserSessionAndCallCallback:YES sceneIdentifier:sceneIdentifier urlParams:params reset:YES]; return spotlightIdentifier != nil;