Skip to content

Commit

Permalink
refactor: add back CDVWebViewNavigationTypeOther but defined as -1
Browse files Browse the repository at this point in the history
  • Loading branch information
erisu committed Feb 7, 2020
1 parent fca8c06 commit cab13af
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ - (CDVIntentAndNavigationFilterValue) filterUrl:(NSURL*)url
}

#define CDVWebViewNavigationTypeLinkClicked 0
#define CDVWebViewNavigationTypeLinkOther -1

+ (BOOL)shouldOpenURLRequest:(NSURLRequest*)request navigationType:(CDVWebViewNavigationType)navigationType
{
return (CDVWebViewNavigationTypeLinkClicked == navigationType);
return (
navigationType == CDVWebViewNavigationTypeLinkClicked ||
navigationType == CDVWebViewNavigationTypeLinkOther
);
}

+ (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request navigationType:(CDVWebViewNavigationType)navigationType filterValue:(CDVIntentAndNavigationFilterValue)filterValue
Expand All @@ -113,7 +117,7 @@ + (BOOL)shouldOverrideLoadWithRequest:(NSURLRequest*)request navigationType:(CDV
case CDVIntentAndNavigationFilterValueNavigationAllowed:
return YES;
case CDVIntentAndNavigationFilterValueIntentAllowed:
// only allow-intent if it's a CDVWebViewNavigationTypeLinkClicked (anchor tag) and it's an internal link
// only allow-intent if it's a CDVWebViewNavigationTypeLinkClicked (anchor tag) or CDVWebViewNavigationTypeOther and it's an internal link
if ([[self class] shouldOpenURLRequest:request navigationType:navigationType]){
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
}
Expand Down

0 comments on commit cab13af

Please sign in to comment.