Skip to content

Commit 361f943

Browse files
committed
refactor: 💡 device 增加鸿蒙和LightOS的标识
1 parent 5569ed1 commit 361f943

File tree

2 files changed

+9
-4233
lines changed

2 files changed

+9
-4233
lines changed

‎src/core/getDevice.js

+9
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ function getDevice () {
2121
var ipad = deviceInfo.model === 'iPad';
2222
var ipod = deviceInfo.model === 'iPod';
2323
var iphone = deviceInfo.model === 'iPhone';
24+
var hms = ua.toLowerCase().indexOf('arkweb') !== -1;
25+
var isLightOS = ua.toLowerCase().indexOf('lightos') !== -1;
2426

2527
device.android = android;
2628
device.iphone = iphone;
2729
device.ipad = ipad;
30+
device.hms = hms;
31+
device.isLightOS = isLightOS;
2832

2933
device.result = result;
3034
device.osVersion = os.version;
@@ -39,6 +43,11 @@ function getDevice () {
3943
device.ios = true;
4044
}
4145

46+
// HarmonyOS
47+
if (hms) {
48+
device.os = 'HarmonyOS';
49+
}
50+
4251
// Webview
4352
device.webView = (iphone || ipad || ipod) && ua.match(/.*AppleWebKit(?!.*Safari)/i);
4453

0 commit comments

Comments
 (0)