mastodon / mastodon-ios

Official iOS app for Mastodon
https://app.joinmastodon.org/ios
GNU General Public License v3.0
2.09k stars 269 forks source link

Support opening any Mastodon URL directly in the app #968

Open sindresorhus opened 1 year ago

sindresorhus commented 1 year ago

Description

Support for custom URL schemes was added in https://github.com/mastodon/mastodon-ios/pull/847, but they require the user to manually transform the URL.

Suggested Solution

It would be useful if you could simply open a link like https://mastodon.social/@sindresorhus/109983299847844086 with Mastodon and the app would show the post in the app.

This is especially useful when running the app on macOS as you could run something like:

open -a 'Mastodon' 'https://mastodon.social/@sindresorhus/109983299847844086'

My specific use-case is that I'm adding support for Mastodon in my browser picker app.

Other Mastodon clients like Ice Cubes and Mammoth already support this.

Alternatives

No response

Additional Context

If the app does not handle the given URL (for example, URL to settings or something), simply open it in a web view instead. This is what Ivory does.

Don't forget to declare support for URLs by adding this to Info.plist:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Viewer</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>https</string>
        </array>
    </dict>
</array>
mvan231 commented 1 year ago

Agreed! This would be great!

cryofault commented 10 months ago

I’d also love to see this if it’s the reason why me clicking “open using mastodon” just does nothing at all leaving me staring at safari. Other apps seem to work without issue so it left me confused and I had to copy/paste the link into mastodon search.

chovanecadam commented 4 months ago

I wish this was given a higher priority. People quite often RT someone or link to another post. Clicking on the link in the App opens web browser, even if it is a Mastodon post.

chockenberry commented 3 months ago

The current URL scheme structure is unusable in practice.

With mastodon://status/:id, you can't know what instance the app is currently signed into, so it's impossible to be selective about which :id parameters you send. And if you try to use an :id from another instance, you get an endless spinner in the UI.

I'd really love to include support for the official Mastodon app in a new project, but at this point I have to limit support to Feditext, Ice Cubes, Ivory, Mammoth, and Mona. These apps can open statuses across instances.