@@ -39,14 +39,15 @@ @implementation BNCContentDiscoveryManager
3939#pragma mark - Launch handling
4040
4141- (NSString *)spotlightIdentifierFromActivity : (NSUserActivity *)userActivity {
42-
4342#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
44- // Matched if it has our prefix, then the link identifier is just the last piece of the identifier.
43+ // If it has our prefix, then the link identifier is just the last piece of the identifier.
4544 NSString *activityIdentifier = userActivity.userInfo [CSSearchableItemActivityIdentifier];
4645 BOOL isBranchIdentifier = [activityIdentifier hasPrefix: BRANCH_SPOTLIGHT_PREFIX];
4746
47+ // Checking for CSSearchableItemActionType in the activity for legacy spotlight indexing (pre 0.12.7)
48+ // Now we index NSUserActivies with type set to io.branch. + bundleId for better SEO
4849 if ([userActivity.activityType isEqualToString: CSSearchableItemActionType] || isBranchIdentifier) {
49- return activityIdentifier;
50+ return activityIdentifier;
5051 }
5152#endif
5253
@@ -446,7 +447,7 @@ - (void)indexContentWithUrl:(NSString *)url spotlightIdentifier:(NSString *)spot
446447 };
447448 [self indexUsingNSUserActivity: userActivityIndexingParams];
448449
449- // not handling error scenarios because they are already handled upstream by the caller
450+ // Not handling error scenarios because they are already handled upstream by the caller
450451 if (url) {
451452 if (callback) {
452453 callback (url, nil );
@@ -488,13 +489,14 @@ - (void)indexUsingNSUserActivity:(NSDictionary *)params {
488489
489490 UIViewController *activeViewController = [self getActiveViewController ];
490491 NSString *uniqueIdentifier = [NSString stringWithFormat: @" io.branch.%@ " , [[NSBundle mainBundle ] bundleIdentifier ]];
492+ // Can't create any weak references here to the userActivity, otherwise it will not index.
491493 activeViewController.userActivity = [[NSUserActivity alloc ] initWithActivityType: uniqueIdentifier];
492494 activeViewController.userActivity .delegate = self;
493495 activeViewController.userActivity .title = params[@" title" ];
494496 activeViewController.userActivity .webpageURL = [NSURL URLWithString: params[@" url" ]];
495497 activeViewController.userActivity .eligibleForSearch = YES ;
496498 activeViewController.userActivity .eligibleForPublicIndexing = params[@" publiclyIndexable" ];
497- activeViewController.userActivity .userInfo = self.userInfo ; // This alone doesn't pass userInfo thru
499+ activeViewController.userActivity .userInfo = self.userInfo ; // This alone doesn't pass userInfo through
498500 activeViewController.userActivity .requiredUserInfoKeys = [NSSet setWithArray: self .userInfo.allKeys]; // This along with the delegate method userActivityWillSave, however, seem to force the userInfo to come through.
499501 activeViewController.userActivity .keywords = params[@" keywords" ];
500502 SEL setContentAttributeSetSelector = NSSelectorFromString (@" setContentAttributeSet:" );
0 commit comments