Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mumuy/browser
Browse files Browse the repository at this point in the history
zhenghaole committed Sep 24, 2024
2 parents 8420695 + 31e1972 commit 776da84
Showing 3 changed files with 23 additions and 15 deletions.
4 changes: 2 additions & 2 deletions dist/browser.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/browser.min.mjs

Large diffs are not rendered by default.

30 changes: 19 additions & 11 deletions src/module/system/HarmonyOS.js
Original file line number Diff line number Diff line change
@@ -3,19 +3,27 @@ import userAgent from '../runtime/userAgent.js';
export default {
name:'HarmonyOS',
parse(ua = userAgent){
let v = +ua.match(/HMSCore (\d+.\d+)/)?.[1]||0;
let version = '';
if(v>=6.1){
version = '4.0';
}else if(v>=6.0){
version = '3.0';
}else if(v>=5.0){
version = '2.0';
}else if(v>=4.0){
version = '1.0';
let version = ua.match(/HarmonyOS (\d+.\d+)/)?.[1]||'';
if(!version){
let v = +ua.match(/HMSCore (\d+.\d+)/)?.[1]||0;
if(v>=6.1){
version = '4.0';
}else if(v>=6.0){
version = '3.0';
}else if(v>=5.0){
version = '2.0';
}else if(v>=4.0){
version = '1.0';
}
let av = ua.match(/Android (\d+);/)?.[1]||0;
let androidMap = {
'10':'3.0',
'12':'4.0'
};
version = androidMap[av]??version;
}
return {
is:ua.includes('HarmonyOS'),
is:ua.includes('HarmonyOS')||ua.includes('ArkWeb'),
version
};
}

0 comments on commit 776da84

Please sign in to comment.