fix(core): 修复goog.platform接口移动端设备判定异常
This commit is contained in:
@@ -70,9 +70,30 @@
|
||||
"pythonToBlockly": false,
|
||||
"web": {
|
||||
"devices": {
|
||||
"serial": true,
|
||||
"hid": true,
|
||||
"usb": true
|
||||
"serial": {
|
||||
"filters": [
|
||||
{
|
||||
"usbVendorId": 6790,
|
||||
"usbProductId": 65036
|
||||
}
|
||||
]
|
||||
},
|
||||
"hid": {
|
||||
"filters": [
|
||||
{
|
||||
"vendorId": 6790,
|
||||
"productId": 65036
|
||||
}
|
||||
]
|
||||
},
|
||||
"usb": {
|
||||
"filters": [
|
||||
{
|
||||
"vendorId": 6790,
|
||||
"productId": 65036
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"burn": {
|
||||
"erase": true,
|
||||
|
||||
@@ -77,7 +77,7 @@ LazyLoad.js([
|
||||
|
||||
goog.platform = () => {
|
||||
const userAgent = navigator.userAgent;
|
||||
if (!navigator.serial) return 'mobile';
|
||||
if (!navigator.hid) return 'mobile';
|
||||
if (userAgent.indexOf('Windows NT') !== -1) return 'win32';
|
||||
if (userAgent.indexOf('Mac') !== -1) return 'darwin';
|
||||
if (userAgent.indexOf('X11') !== -1) return 'linux';
|
||||
@@ -96,7 +96,7 @@ LazyLoad.js([
|
||||
else if (userAgent.indexOf('Windows NT 6.1') != -1) os = 'win7';
|
||||
else if (userAgent.indexOf('Windows NT 6.0') != -1) os = 'winvista';
|
||||
else if (userAgent.indexOf('Windows NT 5.1') != -1) os = 'winxp';
|
||||
} else if (!navigator.serial) {
|
||||
} else if (!navigator.hid) {
|
||||
os = 'android';
|
||||
} else if (platform.includes('iphone') || platform.includes('ipad') || platform.includes('ipod')) {
|
||||
os = 'ios';
|
||||
|
||||
Reference in New Issue
Block a user