Skip to content

Commit

Permalink
Removed extra variables and initialized missing params.referringURL
Browse files Browse the repository at this point in the history
  • Loading branch information
NidhiDixit09 committed Dec 4, 2024
1 parent 2d63de1 commit 440bb30
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions Sources/BranchSDK/Branch.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 440bb30

Please sign in to comment.