NiklasMerz commented on a change in pull request #1030:
URL: https://github.com/apache/cordova-ios/pull/1030#discussion_r533501666
##########
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:
Yeah the other comment ist still valid. We would need to fix more places
though.
Would be nice if you could provide a pull request for the existing places. I
am not am ObjC expert.
----------------------------------------------------------------
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]