mozilla-mobile / firefox-ios

Firefox for iOS
Mozilla Public License 2.0
12.12k stars 2.89k forks source link

Add new option for blocking links to open in external apps #20076

Open data-sync-user opened 3 months ago

data-sync-user commented 3 months ago

After doing some test, it seems to be that sometimes this pop up appears, and sometimes it doesn’t. I would like to understand the logic, and define what should be the expected behavior.

!Screenshot 2024-04-30 at 09.26.12.png|width=398,height=214,alt="Screenshot 2024-04-30 at 09.26.12.png"!

Thanks!

┆Issue is synchronized with this Jira Spike

data-sync-user commented 3 months ago

➤ Alexandru Farcasanu commented:

Norberto Andres Furlan

Currently, we have three cases for displaying this snackBar:

  1. “// First special case are some schemes that are about Calling. We prompt the user to confirm this action. This gives us the exact same behaviour as Safari.“ - code comment
  2. Second case is when we have a URL scheme equal with “mailto“. “ // Handles custom mailto URL schemes.“
  3. And the last case, this snackBar is displayed when we have URLs like this: “youtube://m.youtube.com”. (in this case, the scheme is “youtube“)

For example we have this Open button from the Reddit website. It will not trigger the snackBar because the scheme is https and when we have schemes like “"http", "https", "blob", "file"“, the snackBar in not displayed.

In the YouTube Open button case, the scheme is “youtube“ and thats why the snackBar is visible.

Another example, paypal.com ( http://paypal.com ). We have on top, as exactly on youtube, a button to open the native paypal app. In this case, the scheme is “https“ and will not display the snackBar.

!reddit.jpg|width=946,height=2048,alt="reddit.jpg"!

!paypal.jpg|width=946,height=2048,alt="paypal.jpg"!

This is what I found.

willfs84 commented 3 months ago

Yes it is a bit confusing. There are deep links, there's also this https://developer.apple.com/ios/universal-links/

To make it even more confusing, apparently Apple has an OS level "intents" logic that learns/predicts if the user does or doesn't want links to open in the corresponding installed app, and it can change over time. Apparently this is based off of things such as "quick backs", meaning if a link the user tapped on in Safari opened the YouTube app and the user quickly tapped the "<Safari" that appears in the top-left corner of the screen because they didn't want to be in the Youtube app, iOS will eventually learn to stop opening links in the corresponding apps. It's all a bit of a black box though and it makes reproducing these types of issues difficult.

There are annoying issues like this one https://github.com/mozilla-mobile/firefox-ios/issues/20135 but the one I came across in Firefox's private mode is much more urgent and serious https://github.com/mozilla-mobile/firefox-ios/issues/20060

data-sync-user commented 2 months ago

➤ Alexandru Farcasanu commented:

For QA: Andrei Bodea

Added here a new setting in General Settings, in order to block opening external apps. When is enabled/ON, links like youtube.com ( http://youtube.com ) should no more open the external app.

data-sync-user commented 1 month ago

➤ Diana Andreea Barladeanu commented:

Validated on v128 (42870), with iPhone 15 (17.5).

Performed a sanity check around the new functionality.