Netnewswire: Implement option to deeplink into apps on link tap

Created on 12 Jan 2020  路  8Comments  路  Source: Ranchero-Software/NetNewsWire

Following this slack conversation: https://netnewswire.slack.com/archives/CPNED2D7Y/p1578781781063200

We can implement a deeplink handler for most common occurrences of services that have an iOS app and are linked to in articles.
The slack conversation mentions Twitter, I think YouTube is also a good candidate for the initial phase.

For every service there should be a resolver that knows how to remap a url into a deeplink.
For example, the Twitter one will remap https://twitter.com/pschiller/status/1194616375681015809 into twitter://status?id=1194616375681015809.

A feature flag should control wether we will deeplink into the app or just present SFSafariViewController.
For services with multiple popular apps, like Twitter, Maps, Reddit, we can include a setting for preferred option.

Most of the code should be in the Shared folder, as it can be easily reused between platforms. Each platform should on its own decide what to do with the resolved URL.

I'll pick this up for its initial phase. Let me know if you have any remarks.

All 8 comments

Do we know of any other iOS apps that do this? It鈥檚 important that we stick to platform conventions, so, before I approve it, I鈥檇 like to see some examples of other apps that do this.

If I'm understanding correctly, it might be possible to pass the universal links only option to UIApplication's open method. If open returns false, use SFSafariViewController to open the URL.

That's a really nice solution if it works as advertised.

Ideally it would probably be a setting:
"Open links in apps if installed" -> if True then do the universal link check, otherwise open SFSafariViewController.

The solution with changing the URL's is possible too but you are depending very much on the app keeping support for the custom URI Patterns.

Regarding what other apps do:

Most just go the SFSafariViewController

Some apps will give an option per service; so for example in the settings you would see:

Open twitter links in:

  • Safari
  • Chrome
  • Twitter
  • Tweetbot

UIApplication.shared.open(url, options: [.universalLinksOnly: true], completionHandler: {...}) is a very nice and straightforward approach.

I'm not sure if third party clients are able / allowed to handle twitter.com urls this way?

@brentsimmons I've seen this a couple of times, for example in YouTube for links. They present the option to open in safari / open in chrome plus a toggle whether you want the system to remember your choice (which never works for me).

I've also seen trip apps (TripAdvisor, iirc) allowing you to select which app to open when tapping on an address, similar to this
image

Given that default apps is something the community has wanted for the longest time, I think it will be a nice power user feature to have in place.

Yes exactly, it depends a little on the app in question though; so Google maps for instance has documentation available where they advertise this: https://developers.google.com/maps/documentation/urls/ios-urlscheme

In other cases it would be on the trust that the app in question wouldn't change it. I can imagine that certain well used third party apps we offer support (Tweetbot, Twitterrific come to mind).

This requires a bunch of research, thought, and design on my part, and it鈥檚 too late in the 5.0 cycle to decide what to do here. We鈥檒l come back to this after 5.0 ships.

It seems to me this issue could be separated into two: open universal links and MacGyvering universal links for third party clients.

I think at the very least NetNewsWire should handle the first because it seems that this is what Apple intends the platform convention to be by providing the . universalLinksOnly API -- prefer the native experience to the web one. I suspect users would expect this too (for example, YouTube links should really open in YouTube and not the browser so I don't have to log into SFSafariViewController to comment or save a video for later). Finally, it would provide a measurable demand for the MacGyvering option (Tweetbot or Chrome users unite and post in Slack or create issues in GitHub) justifying integration with some apps over others (or none at all, if a trivial number of people ask).

I'm going to close this issue as it has been resolved and superseded by #1625. Nice work @myurieff on pointing out this deficiency. I use this all the time now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

venkatasg picture venkatasg  路  5Comments

sgoodwin picture sgoodwin  路  7Comments

willhains picture willhains  路  4Comments

ucbsm picture ucbsm  路  7Comments

tinybot-ca picture tinybot-ca  路  7Comments