Skip to content

Commit a916fd6

Browse files
committed
Adopt to MacOS openURL event sending from LinkingManager
1 parent 23e169e commit a916fd6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Libraries/LinkingIOS/RCTLinkingManager.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ - (void)setBridge:(RCTBridge *)bridge
2525
{
2626
_bridge = bridge;
2727

28+
[[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(getUrl:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL];
29+
2830
[[NSNotificationCenter defaultCenter] addObserver:self
2931
selector:@selector(handleOpenURLNotification:)
3032
name:RCTOpenURLNotification
@@ -54,6 +56,14 @@ + (BOOL)application:(NSApplication *)application
5456
return YES;
5557
}
5658

59+
- (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
60+
{
61+
NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
62+
NSDictionary *payload = @{@"url": url};
63+
[_bridge.eventDispatcher sendDeviceEventWithName:@"openURL"
64+
body:payload];
65+
}
66+
5767
+ (BOOL)application:(NSApplication *)application
5868
continueUserActivity:(NSUserActivity *)userActivity
5969
restorationHandler:(void (^)(NSArray *))restorationHandler

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-desktop",
3-
"version": "0.6.3",
3+
"version": "0.6.4",
44
"description": "A framework for building native desktop apps using React",
55
"license": "BSD-3-Clause",
66
"repository": {

0 commit comments

Comments
 (0)