Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CB-10795] Exclude current app from external intent list #154

Merged
merged 1 commit into from
Sep 20, 2018

Conversation

dpolivy
Copy link
Contributor

@dpolivy dpolivy commented Mar 9, 2016

On Android, if the app defines an intent-filter for a given URL, and
then tries to use inappbrowser to launch that URL via the _system
target, the default handler for that intent is the app itself.

That behavior can lead to circular loops, and ultimately is not what the
developer wants -- the link should be launched in a browser.

Because there is no easy way to find the "default" system browser on a
device, this solution will do two things:

  1. Check if the app is one of the targets for this intent
  2. If so, create a custom chooser with all other targets, excluding the
    current app.

If the app is not a target, then the current (existing) behavior is
preserved.

The only real "downside" to this approach is that a default handler can no longer be set for these URLs within the app, and a chooser will be shown each time the user taps a link that opens in a new browser.

Fixes https://issues.apache.org/jira/browse/CB-10795

@infil00p
Copy link
Member

infil00p commented Mar 9, 2016

LGTM

@cordova-qa
Copy link

Cordova CI Build has completed successfully.

Commit - Link
Dashboard - Link

Builder Name Console Output Test Report Device Logs
Windows 8.1 Store Link Link Link
Windows 10 Store Link Link Link
Windows 8.1 Phone Link Link Link
iOS Link Link Link
Android Mac Link Link Link

@janpio
Copy link
Member

janpio commented Sep 16, 2018

@dpolivy I know this has been quite some time ago, but there is a merge conflict now. Could you maybe resolve this? Thanks.

On Android, if the app defines an intent-filter for a given URL, and
then tries to use inappbrowser to launch that URL via the _system
target, the default handler for that intent is the app itself.

That behavior can lead to circular loops, and ultimately is not what the
developer wants -- the link should be launched in a browser.

Because there is no easy way to find the "default" system browser on a
device, this solution will do two things:
1) Check if the app is one of the targets for this intent
2) If so, create a custom chooser with all other targets, excluding the
current app.

If the app is not a target, then the current (existing) behavior is
preserved.

Fixes https://issues.apache.org/jira/browse/CB-10795
@dpolivy
Copy link
Contributor Author

dpolivy commented Sep 16, 2018

@janpio Wow, totally didn't realize this was never merged. I just rebased the commit off master so it should be good to go.

@janpio janpio added the bug label Sep 17, 2018
@dpolivy
Copy link
Contributor Author

dpolivy commented Sep 20, 2018

@janpio @infil00p This had previously been reviewed and marked as good to merge -- is it possible to get it merged in?

@janpio
Copy link
Member

janpio commented Sep 20, 2018

It is now in the "Ready for Review" pile - some maintainer will have to have a look at it again before deciding this can be merged. As it already has a LGTM comment from 2.5 years ago, this will probably be positive - but it still needs the eyes of a maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants