Just saw this here: Platform detection issue for desktops (Windows-touchscreen)
Our issue is similar in that we have an issue where this code:
this.platform.is('cordova')
returns true
but yet this code:
if (this.platform.is('android')) {
// do android stuff
} else if (this.platform.is('ios')) {
// do apple stuff
} else {
this.rollbar.error('Invalid platform.', {platforms: this.platform.platforms()});
return [];
}
The rollbar error is called and the array passed in looks like this:
{
"0": "tablet",
"1": "cordova",
"2": "desktop",
"3": "hybrid"
}
The platform detection code uses a mix of user agent tests + some “internal” tests. IOW I know that window['cordova']
exists because Cordova
is a selected item.
The “user agent” here appears to be this:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
When I go to Safari and load the app, it shows:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5.2 Safari/605.1.15
Which is very similar but not exactly.
The URL in our app shows that it is an ionic://
link.