msmtamburro commented on a change in pull request #1030:
URL: https://github.com/apache/cordova-ios/pull/1030#discussion_r533455050
##########
File path: CordovaLib/Classes/Public/CDVURLSchemeHandler.m
##########
@@ -39,45 +41,70 @@ - (void)webView:(WKWebView *)webView startURLSchemeTask:(id
<WKURLSchemeTask>)ur
NSURL * url = urlSchemeTask.request.URL;
NSString * stringToLoad = url.path;
NSString * scheme = url.scheme;
-
- if ([scheme isEqualToString:self.viewController.appScheme]) {
- if ([stringToLoad hasPrefix:@"/_app_file_"]) {
- startPath = [stringToLoad
stringByReplacingOccurrencesOfString:@"/_app_file_" withString:@""];
- } else {
- if ([stringToLoad isEqualToString:@""] || [url.pathExtension
isEqualToString:@""]) {
- startPath = [startPath
stringByAppendingPathComponent:self.viewController.startPage];
- } else {
- startPath = [startPath
stringByAppendingPathComponent:stringToLoad];
+
+ CDVViewController* vc = (CDVViewController*)self.viewController;
+
+ /*
+ * Give plugins the chance to handle the url
+ */
+ BOOL anyPluginsResponded = NO;
+ BOOL handledRequest = NO;
+
+ for (NSString* pluginName in vc.pluginObjects) {
+ CDVPlugin* plugin = [vc.pluginObjects objectForKey:pluginName];
+ SEL selector = NSSelectorFromString(@"handleSchemeURL:");
+ if ([plugin respondsToSelector:selector]) {
+ handledRequest = (((BOOL (*)(id, SEL, id
<WKURLSchemeTask>))objc_msgSend)(plugin, selector, urlSchemeTask));
+ NSLog(@"Handled: %d", handledRequest);
Review comment:
Ah, thanks for that-- (sorry) I googled in to the wrong place to begin
my review of your PR. Happy to discuss my other comment (which still applies),
if clarification is required.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]