Skip to content

Commit

Permalink
Backport - Fix #743 - Improve device detection for Xiaomi
Browse files Browse the repository at this point in the history
(cherry picked from commit b9f1bf6)
  • Loading branch information
faisalman committed Sep 10, 2024
1 parent a931582 commit c25e22f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@
/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi
/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi
/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, // Xiaomi Redmi 'numeric' models
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i // Xiaomi Mi
], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [
/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i, // Redmi Pad
/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i // Mi Pad tablets
Expand Down
9 changes: 9 additions & 0 deletions test/device-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -2807,6 +2807,15 @@
"type": "mobile"
}
},
{
"desc": "Xiaomi Mi 10 Pro",
"ua": "Linux; U; Android 13; Mi 10 Pro Build/TKQ1.221114.001",
"expect": {
"vendor": "Xiaomi",
"model": "Mi 10 Pro",
"type": "mobile"
}
},
{
"desc": "Xiaomi Mi 5s Plus",
"ua": "Mozilla/5.0 (Linux; U; Android 6.0.1; zh-cn; MI 5s Plus Build/MXB48T) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.146 Mobile Safari/537.36 XiaoMi/MiuiBrowser/8.7.1",
Expand Down

0 comments on commit c25e22f

Please sign in to comment.