fix: wrong OS judgment (#1525)
This commit is contained in:
4
packages/env/src/ua-helper.ts
vendored
4
packages/env/src/ua-helper.ts
vendored
@@ -12,6 +12,7 @@ export function getUaHelper() {
|
|||||||
(uas.indexOf('android') > -1 || uas.indexOf('linux') > -1)) ||
|
(uas.indexOf('android') > -1 || uas.indexOf('linux') > -1)) ||
|
||||||
uas.indexOf('adr') > -1;
|
uas.indexOf('adr') > -1;
|
||||||
const ios = mobile && !android && /Mac OS/i.test(ua);
|
const ios = mobile && !android && /Mac OS/i.test(ua);
|
||||||
|
const mac = !mobile && /Mac OS/i.test(ua);
|
||||||
const iphone = ios && uas.indexOf('iphone') > -1;
|
const iphone = ios && uas.indexOf('iphone') > -1;
|
||||||
const ipad = ios && !iphone;
|
const ipad = ios && !iphone;
|
||||||
const wx = /MicroMessenger/i.test(ua);
|
const wx = /MicroMessenger/i.test(ua);
|
||||||
@@ -33,6 +34,7 @@ export function getUaHelper() {
|
|||||||
mobile,
|
mobile,
|
||||||
android,
|
android,
|
||||||
ios,
|
ios,
|
||||||
|
mac,
|
||||||
wx,
|
wx,
|
||||||
chrome,
|
chrome,
|
||||||
iphone,
|
iphone,
|
||||||
@@ -73,7 +75,7 @@ export function getUaHelper() {
|
|||||||
|
|
||||||
private initUaFlags() {
|
private initUaFlags() {
|
||||||
this.isLinux = this.checkUseragent('linux');
|
this.isLinux = this.checkUseragent('linux');
|
||||||
this.isMacOs = this.checkUseragent('ios');
|
this.isMacOs = this.checkUseragent('mac');
|
||||||
this.isSafari = this.checkUseragent('safari');
|
this.isSafari = this.checkUseragent('safari');
|
||||||
this.isWindows = this.checkUseragent('win');
|
this.isWindows = this.checkUseragent('win');
|
||||||
this.isFireFox = this.checkUseragent('firefox');
|
this.isFireFox = this.checkUseragent('firefox');
|
||||||
|
|||||||
Reference in New Issue
Block a user