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

Stop showing mobile store banners for current users #14942

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

janbrasna
Copy link
Contributor

@janbrasna janbrasna commented Jul 31, 2024

One-line summary

Shows mobile store banners only to nonFX users.

(This picks up and supersedes #13331, updating it to current codebase.)

Significant changes and points to review

This was unable to be fixed for a while when FxiOS and Focus stopped identifying themselves beyond generic UIWebView, but the identifiers are back for some time now so they can be told apart from the system engine again.

(At least on phones, or unless asking for "request desktop version" when the UA mimics either desktop Safari or desktop Linux FX, on iPads that's most of the time and even manually requesting mobile site doesn't change it reliably. But that's not issue with this code or changeset just consuming Mozilla.Client and its limitations — the issues are with opinionated choices in the mobile products, as linked e.g. from #6875 (comment))

Firefox mobile and Focus can't be told apart as they both report alike (FxiOS and Firefox/Mobile on 🤖 respectively), so there is no way to e.g. offer the banner for the second app to user of the first etc., there's no app ID logic involved as it would be with native smartbanners — so it's all or nothing only, with Focus being even more fuzzy about its uastring showing up as various versions of Safari instead;)

This does not add any new logic. Only what Mozilla.Client.isMobile && !Mozilla.Client.isFirefox already sniff, know and provide. Better than nothing, but far from perfect when the browsers pretend they're something else completely.

Issue / Bugzilla link

Resolves #10571

Testing

prod fx PR fx PR nonfx
Focus iOS: (/firefox)
kl1IMG_5490 kl1IMG_5491
(/firefox/focus) Safari iOS:
kl2IMG_5492 kl2IMG_5493 kl2IMG_5501
(/) Safari iOS:
kl3IMG_5494 kl3IMG_5495 fx2IMG_5500
Firefox iOS: (/)
fx2IMG_5498 fx2IMG_5499
(/firefox/focus) Safari iOS:
fx1IMG_5497 fx1IMG_5496 kl2IMG_5501

Other platforms can be spoofed with just uastrings, I've used:

  • Mozilla/5.0 (Android 4.4; Mobile; rv:70.0) Gecko/70.0 Firefox/70.0 (gecko)
  • Mozilla/5.0 (Linux; Android 4.3; Nexus 7 Build/JSS15Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 (chromium tablet)
  • Mozilla/5.0 (Linux; Android 8.1.0; Pixel Build/OPM4.171019.021.D1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.109 Mobile Safari/537.36 EdgA/42.0.0.2057 (edge mobile)
  • Opera/12.02 (Android 4.1; Linux; Opera Mobi/ADR-1111101157; U; en-US) Presto/2.9.201 Version/12.02 (opera mobi)
  • Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Safari/536.2+ (bb tablet, not treated as isMobile)

@janbrasna janbrasna marked this pull request as ready for review August 6, 2024 15:18
@alexgibson alexgibson added P3 Third level priority - Nice to have Needs Review Awaiting code review Frontend HTML, CSS, JS... client side stuff labels Aug 19, 2024
Copy link
Contributor

@stephaniehobson stephaniehobson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R+ 🎏

@stephaniehobson stephaniehobson merged commit d32bb17 into mozilla:main Aug 27, 2024
5 checks passed
@janbrasna janbrasna deleted the fix/mobile-banner-nag branch August 27, 2024 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frontend HTML, CSS, JS... client side stuff Needs Review Awaiting code review P3 Third level priority - Nice to have
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not show the Firefox iOS App Store banner when using Firefox iOS
3 participants