mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 20:10:00 +08:00
20 lines
778 B
Objective-C
20 lines
778 B
Objective-C
#include "CustomProtocol.h"
|
|
|
|
@implementation CustomProtocolSchemeHandler
|
|
+ (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
|
|
[event paramDescriptorForKeyword:keyDirectObject];
|
|
|
|
NSString *urlStr = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
|
|
|
|
HandleCustomProtocol((char*)[[[event paramDescriptorForKeyword:keyDirectObject] stringValue] UTF8String]);
|
|
}
|
|
@end
|
|
|
|
void StartCustomProtocolHandler(void) {
|
|
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
|
|
|
|
[appleEventManager setEventHandler:[CustomProtocolSchemeHandler class]
|
|
andSelector:@selector(handleGetURLEvent:withReplyEvent:)
|
|
forEventClass:kInternetEventClass
|
|
andEventID: kAEGetURL];
|
|
} |