Wp-calypso: Hide all overlays from within the mobile app

Created on 2 Mar 2019  路  9Comments  路  Source: Automattic/wp-calypso

There are a few elements we want to hide within the mobile view:

  1. Masterbar
  2. Cookie warnings
  3. Action bar (follow bar)
  4. App banners

The approach we want to take is not set in stone yet, and there are a few varying ways we already do accomplish some of this (1) (2)

We'll want to consolidate this logic into a single option so there aren't multiple flags we have to keep track of.

Most helpful comment

All 9 comments

@kwonye @elibud Do you think we could insert a common identifier in the user agent in both apps that we could test for?

@obenland - This is the default user agent for a mobile web view in iOS:

Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16B91

And this is the custom one we're using in WPiOS (the difference is in that final wp-mobile/12.1 from what I see). That last number being the App version:

Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16B91 wp-iphone/12.1

I'll add the Android user agents as soon as I know them.

This is the default user agent for a mobile web view in iOS

Just for my understanding, this iOS Safari and we wouldn't have to test for that?

I provided the default one for context only, so spotting the custom part is easier.

The part that allows you to check for WPiOS is wp-mobile/12.1.

Right now WP Android is launching the site through an external browser when pressing the "View site" option of the mobile dashboard (instead of opening a web view as in iOS).

That'll need to change. I'll push that.

That said, @obenland... I believe the custom user agent part used above (wp-mobile/12.1) should work for Android too.

Perfect, I'll check for that then, thanks! I assume 12.1 is the iOS version number?

Oh, one more question, in the user agent string you pasted it says wp-iphone, not wp-mobile. I assume we should check for both?

Perfect, I'll check for that then, thanks! I assume 12.1 is the iOS version number?

Yes.

Oh, one more question, in the user agent string you pasted it says wp-iphone, not wp-mobile. I assume we should check for both?

Actually that was a typo on my end, sorry about that. Let's stick with just wp-iphone/12.1 for now.

Once it's up I'll do the testing in iOS to see how that goes, since Android will probably require some work on my end.

Can we leave the option open to add another identifier for Android?

Was this page helpful?
0 / 5 - 0 ratings