github.com/secoba/wails/v2@v2.6.4/internal/frontend/desktop/darwin/CustomProtocol.m (about)

     1  #include "CustomProtocol.h"
     2  
     3  @implementation CustomProtocolSchemeHandler
     4  + (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
     5    [event paramDescriptorForKeyword:keyDirectObject];
     6  
     7     NSString *urlStr = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
     8  
     9     HandleCustomProtocol((char*)[[[event paramDescriptorForKeyword:keyDirectObject] stringValue] UTF8String]);
    10  }
    11  @end
    12  
    13  void StartCustomProtocolHandler(void) {
    14  	NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
    15  
    16  	[appleEventManager setEventHandler:[CustomProtocolSchemeHandler class]
    17  	    andSelector:@selector(handleGetURLEvent:withReplyEvent:)
    18  	    forEventClass:kInternetEventClass
    19  	    andEventID: kAEGetURL];
    20  }