Github user shazron commented on a diff in the pull request:

    https://github.com/apache/cordova-ios/pull/232#discussion_r73432421
  
    --- Diff: 
CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.m
 ---
    @@ -95,23 +95,33 @@ - (CDVIntentAndNavigationFilterValue) 
filterUrl:(NSURL*)url
         return [[self class] filterUrl:url 
intentsWhitelist:self.allowIntentsWhitelist 
navigationsWhitelist:self.allowNavigationsWhitelist];
     }
     
    -- (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request 
navigationType:(UIWebViewNavigationType)navigationType
    ++ (BOOL)shouldOpenURLRequest:(NSURLRequest*)request 
navigationType:(UIWebViewNavigationType)navigationType
    +{
    +    return (UIWebViewNavigationTypeLinkClicked == navigationType ||
    +        (UIWebViewNavigationTypeOther == navigationType &&
    +         [[request.mainDocumentURL absoluteString] 
isEqualToString:[request.URL absoluteString]]
    +         )
    +        );
    +}
    +
    ++ (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request 
navigationType:(UIWebViewNavigationType)navigationType 
filterValue:(CDVIntentAndNavigationFilterValue)filterValue
     {
         NSString* allowIntents_whitelistRejectionFormatString = @"ERROR 
External navigation rejected - <allow-intent> not set for url='%@'";
         NSString* allowNavigations_whitelistRejectionFormatString = @"ERROR 
Internal navigation rejected - <allow-navigation> not set for url='%@'";
         
         NSURL* url = [request URL];
    -    CDVIntentAndNavigationFilterValue filterValue = [self filterUrl:url];
         
         switch (filterValue) {
             case CDVIntentAndNavigationFilterValueNavigationAllowed:
                 return YES;
             case CDVIntentAndNavigationFilterValueIntentAllowed:
    -            // only allow-intent if it's a 
UIWebViewNavigationTypeLinkClicked (anchor tag)
    -            if (UIWebViewNavigationTypeLinkClicked == navigationType) {
    +            // only allow-intent if it's a 
UIWebViewNavigationTypeLinkClicked (anchor tag) OR
    +            // it's a UIWebViewNavigationTypeOther, and it's an internal 
link
    +            if ([[self class] shouldOpenURLRequest:request 
navigationType:navigationType]){
                     [[UIApplication sharedApplication] openURL:url];
                 }
    -            // consume the request (i.e. no error) if it wasn't a 
UIWebViewNavigationTypeLinkClicked
    +            
    --- End diff --
    
    returning NO here signals to the WebView that it should not load the URL 
inside itself, so it is correct in this context since we open the url 
externally.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to