Skip to content

Commit

Permalink
test(fix,ios): support background search.
Browse files Browse the repository at this point in the history
  • Loading branch information
asafkorem committed Jan 10, 2025
1 parent 0c9ae79 commit 8559c79
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions detox/test/ios/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "AppDelegate.h"

#import <CoreSpotlight/CoreSpotlight.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTLinkingManager.h>
#import <UserNotifications/UserNotifications.h>
Expand Down Expand Up @@ -116,11 +117,23 @@ - (BOOL)application:(UIApplication *)app
}

- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
return [RCTLinkingManager application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
if ([userActivity.activityType isEqualToString:CSSearchableItemActionType]) {
NSString *identifier = userActivity.userInfo[CSSearchableItemActivityIdentifier];
NSURL *url = identifier ? [NSURL URLWithString:identifier] : nil;

if (url) {
return [RCTLinkingManager application:application openURL:url options:@{
UIApplicationOpenURLOptionsSourceApplicationKey: @"",
UIApplicationOpenURLOptionsAnnotationKey: @{}
}];
}
return NO;
}

return [RCTLinkingManager application:application continueUserActivity:userActivity
restorationHandler:restorationHandler];
}

#pragma mark - Overlay Message
Expand Down

0 comments on commit 8559c79

Please sign in to comment.