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

feat(quasar): Try to match as many mobile browsers as possible #4177

Merged
merged 1 commit into from May 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 24 additions & 3 deletions ui/src/plugins/Platform.js
Expand Up @@ -67,9 +67,19 @@ function getPlatform (userAgent) {
browser[matched.platform] = true
}

const knownMobiles = browser.android ||
browser.bb ||
browser.blackberry ||
browser.ipad ||
browser.iphone ||
browser.ipod ||
browser.kindle ||
browser.playbook ||
browser.silk ||
browser['windows phone']

// These are all considered mobile platforms, meaning they run a mobile browser
if (browser.android || browser.bb || browser.blackberry || browser.ipad || browser.iphone ||
browser.ipod || browser.kindle || browser.playbook || browser.silk || browser['windows phone']) {
if (knownMobiles === true || /mobile|opera\s*mobi/.test(userAgent) === true) {
browser.mobile = true
}
// If it's not mobile we should consider it's desktop platform, meaning it runs a desktop browser
Expand All @@ -90,7 +100,18 @@ function getPlatform (userAgent) {
}

// Chrome, Opera 15+, Vivaldi and Safari are webkit based browsers
if (browser.chrome || browser.opr || browser.safari || browser.vivaldi) {
if (
browser.chrome ||
browser.opr ||
browser.safari ||
browser.vivaldi ||
// we expect unknown, non iOS mobile browsers to be webkit based
(
browser.mobile === true &&
browser.ios !== true &&
knownMobiles !== true
)
) {
browser.webkit = true
}

Expand Down