[ 
https://issues.apache.org/jira/browse/CB-14234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16589377#comment-16589377
 ] 

ASF GitHub Bot commented on CB-14234:
-------------------------------------

jcesarmobile closed pull request #278: CB-14234: (ios) Don't call handleOpenURL 
for system URLs
URL: https://github.com/apache/cordova-plugin-inappbrowser/pull/278
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m
index 5bdb3e1eb..b0acc7a1d 100644
--- a/src/ios/CDVInAppBrowser.m
+++ b/src/ios/CDVInAppBrowser.m
@@ -298,8 +298,9 @@ - (void)openInCordovaWebView:(NSURL*)url 
withOptions:(NSString*)options
 
 - (void)openInSystem:(NSURL*)url
 {
-    [[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
-    [[UIApplication sharedApplication] openURL:url];
+    if ([[UIApplication sharedApplication] openURL:url] == NO) {
+        [[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
+    }
 }
 
 // This is a helper method for the inject{Script|Style}{Code|File} API calls, 
which


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> InAppBrowser iOS calls handleOpenURL in same app for _system URLs
> -----------------------------------------------------------------
>
>                 Key: CB-14234
>                 URL: https://issues.apache.org/jira/browse/CB-14234
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-inappbrowser
>    Affects Versions: 3.0.0
>            Reporter: Dan Polivy
>            Priority: Minor
>
> The change to fix CB-11178 has caused some undesirable behavior with 
> InAppBrowser on iOS. Now, whenever you try to open a URL in the system 
> browser, by calling `cordova.InAppBrowser.open(url, "_system")`, it opens the 
> system browser AND calls `handleOpenURL` _in your app_ with the same URL.
> In my case, my app is a URL handler for a corresponding web domain (app 
> links). I am trying to open a page on this web domain in the system browser 
> from within my app. If my app's handleOpenURL is called with a URL also on 
> the domain, then my handler thinks it is handling an app link and it causes 
> the app to navigate to another URL, which in this case is not desired or 
> expected.
> Prior to the fix for CB-11178, this worked perfectly. Is there any other way 
> to address the fix for CB-11178 without inheriting this incorrect and 
> undesirable behavior?
> [~jcesarmobile]: FYI as you committed the fix in question.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to