fix: wrong OS judgment (#1525)

This commit is contained in:
JimmFly
2023-03-11 02:06:40 +08:00
committed by GitHub
parent 1239957446
commit 21bfec3402

View File

@@ -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');