zulip-flutter icon indicating copy to clipboard operation
zulip-flutter copied to clipboard

Try to control which external browser/app is used on opening a link

Open gnprice opened this issue 2 years ago • 3 comments

This will be a followup to:

  • #71

@terpimost writes:

I have Safari and Chrome - which browser will be used to open a link? And I have Apple Maps and Google Maps, which app will be used to open a link?

and adds:

It is a minor thing. We can just do system default app

gnprice avatar Apr 19 '23 02:04 gnprice

On Android, the experience I'm accustomed to as a user is that once I've decided to open something in another app, the app I'm coming from doesn't attempt to specify which particular app I use — instead I get a piece of system UI that asks me, and I choose there. (Including an "always use this app" option, but that's still between me and the system.) It looks like this: https://developer.android.com/training/basics/intents/sending#disambiguation-dialog

So I think we probably don't want to try to usurp that Android behavior.

On iOS I don't know what the right thing is, though.

gnprice avatar Apr 19 '23 02:04 gnprice

Hey, it could be that iOS acts similar and I just don't know about it. Lets see how it works just to be aware.

terpimost avatar Apr 19 '23 14:04 terpimost

On Android, the experience I'm accustomed to as a user is that once I've decided to open something in another app, the app I'm coming from doesn't attempt to specify which particular app I use — instead I get a piece of system UI that asks me, and I choose there.

Hmm, well — I'm no longer seeing that behavior! At least not when I open an https: or http: URL.

On that Android docs page, their own example shows a choice between two browsers: image which corroborates my recollection that that was how it routinely worked. But I guess it changed at some point. Most likely that means with Android 13 at the latest, though I've been using that for most of a year.

I first noticed that I wasn't getting this behavior when I implemented #71, using an external browser (LaunchMode.externalApplication) for the reason described at #279. I chalked it up to a quirk in the Flutter url_launcher implementation, which I was perhaps primed to do by that bug described at #279… but just now I looked at the implementation, and what it's doing for LaunchMode.externalApplication seems perfectly canonical. And then I went and tried a couple of other apps, including zulip-mobile with the "Open links with in-app browser" setting turned off, and none of them gave me that choose-which-browser UI.

Specifically, what I get is that the link leads directly to opening in the Chrome app. Which indeed I appear to have set as my default browser on the system.

Anyway, for this issue's purposes the bottom line is the same: on Android there's already a systemwide way to choose the browser, which is under the user's control, so I don't think we'll want to try to usurp that.

gnprice avatar Aug 17 '23 06:08 gnprice