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

feat: add Mastodon Redirect support and "Open Link" share target #365

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

zacharee
Copy link

Very similar to tuskyapp/Tusky#4194. Modified description below.

This PR adds auto-detect support for Mastodon Redirect, so Pachli can be chosen for opening Mastodon links. It also adds an "Open Link" share target which uses the same logic path Mastodon Redirect does.

To test:

  1. Download Mastodon Redirect from https://github.com/zacharee/MastodonRedirect.
  2. Install Pachli from this PR's code.
  3. Open and log into Pachli.
  4. Find a post and copy its link. Paste the link somewhere it'll be clickable, such as in Telegram's "Saved messages" channel.
  5. Remove Pachli from Recents.
  6. Open Mastodon Redirect and select Pachli in the "Discovered" section.
  7. Tap the pasted link. It should launch Pachli and then resolve to the post.
  8. Back out to the main feed in Pachli and go back to the link, without removing Pachli from Recents this time. The link should open Pachli and resolve to the post.

To test the share target:

  1. Install Pachli from this PR's code.
  2. Find a post and copy its link into an app that supports sharing links, like Discord.
  3. Share the link.
  4. In the share sheet, choose Pachli's "Open Link" target. The previous/existing share target should also show as "Compose".
  5. Pachli should open and resolve the link.

@CLAassistant
Copy link

CLAassistant commented Jan 18, 2024

CLA assistant check
All committers have signed the CLA.

@zacharee zacharee changed the title Add Mastodon Redirect support and "Open Link" share target @zacharee feat: add Mastodon Redirect support and "Open Link" share target Jan 20, 2024
@zacharee zacharee changed the title @zacharee feat: add Mastodon Redirect support and "Open Link" share target feat: add Mastodon Redirect support and "Open Link" share target Jan 20, 2024
@nikclayton
Copy link
Contributor

Hi, thanks for the PR. I've been a bit sidetracked this week bug fixing ahead of the 2.2 release, but I'll look at this properly next week.

@nikclayton
Copy link
Contributor

Hi,

First, sorry for the delay in getting to reviewing this, I've been a bit wrapped up in cleaning up the bugs exposed by the migration to Moshi.

I've merged main in to the PR and resolved conflicts, so it builds correctly.

I've got a couple of specific questions about the approach.

  1. MastodonRedirect appears to only be available on GitHub. Is there a plan to include it in the Play Store and F-Droid at minimum? I'm wary of recommending Pachli's users should install APKs they find on GitHub.

  2. If I've understood the approach correctly you'll need to push new releases of MastodonRedirect pretty regularly to account for new servers popping up. How frequently are you intending to do this? At the time of writing the last release on GitHub was Jan. 18, more than a month ago.

And a more general architecture point:

The UX for this as a user seems quite hostile; download an app from GitHub, download additional apps, one of which (LinkSheet) has a non-standard license.

So what if, instead of the current approach:

  • Mastodon Redirect was installed as an intent receiver for all URLs
  • Mastodon Redirect allowed the user to configure their preferred browser for non-Mastodon URLs
  • On receipt of an intent with a URL, Mastodon Redirect determines if it's a Mastodon URL. If it is it swallows the intent and sends off a new intent with one of the "web+..." schemes you have in the current AndroidManifest.xml
  • If it's not a Mastodon URL then Mastodon Redirect forwards it to whatever browser the user set as their preferred default in the Mastodon Redirect configuration

If I've understood LinkSheet properly this might be quite similar to what LinkSheet is already doing.

@zacharee
Copy link
Author

I don't think Google would accept the apps, and if they did, they'd only accept one variant since they're probably "too similar". The number of URLs especially Mastodon Redirect handles can cause Settings to crash when manually selecting URLs, which would probably lead to a rejection if the list alone didn't.

I think the apps should be F-DROID eligible, but I haven't looked into it too much. Right now, they're also available on IzzyOnDroid's F-DROID repo, so checking GitHub for new releases isn't necessary.

I don't have a set frequency for updates, but the variants are probably due for a domain refresh. The idea isn't necessarily to be super up-to-date on new single-user and small instances, just to be able to handle as many as possible and take that load off of individual clients.

In order to handle all links, Mastodon Redirect would need to be set as the default browser. On top of making it even less likely to be accepted by the Play Store, it'd add a lot of complexity to duplicate the URL validation that most clients already have, along with the complexity from duplicating LinkSheet's main function.

The upside is that most people will only need to do the setup after the initial install, since domains that are added in updates are mostly small or single-user that won't be having many (or any) links shared from them.

Mastodon Redirect's (and the variants') purpose is to hook into existing apps for the most part as simply as possible to add deep linking support to them without them having to add their own lists of domains. Moving to only web+ schemes would remove that flexibility and break compatibility with every manually-implemented client.

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.

3 participants