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

Improve links behavior #1118

Merged
merged 4 commits into from
Oct 13, 2021
Merged

Improve links behavior #1118

merged 4 commits into from
Oct 13, 2021

Conversation

Fs00
Copy link
Contributor

@Fs00 Fs00 commented Sep 26, 2021

This PR improves the behavior of links in comments, releases etc. in several ways:

  • directly start the corresponding OctoDroid activity when possible, instead of asking the system to open the URL (which is the URLSpan behavior).
    This avoids the need to set OctoDroid as the default handler for GitHub links, in order to prevent the Android "Open with..." sheet from showing up every time.
  • when the clicked link is a GitHub link that can't be handled by OctoDroid, open it in a custom tab. In my opinion this helps reducing the perceived "switch of context" when viewing comment images.
    An alternative solution could be to open all links in custom tabs by default and add an option to toggle this behavior. I'm not sure on which of the two solutions is best.
  • open custom tabs in the same task as the application. I think this is one of the most useful benefits given by custom tabs (in this context, at least).

I've also added a missing <queries> intent filter needed to be able to detect which browser support custom tabs on Android 11+.

Implementation note: the refactoring in d2dd3e8 was done in order to be able to execute the loadTask in LinkSpan, without closing the activity in which the link was clicked.

We accomplish this through an external callback instead
Now links will be opened directly in-app if possible, without asking
the user to open them in another app.
Also, GitHub links that cannot be mapped to an OctoDroid activity
will be opened in a custom tab.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants