Skip to content

Commit c25e22f

Browse files
committed
Backport - Fix #743 - Improve device detection for Xiaomi
(cherry picked from commit b9f1bf6)
1 parent a931582 commit c25e22f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/ua-parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@
438438
/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, // Xiaomi Hongmi
439439
/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, // Xiaomi Redmi
440440
/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, // Xiaomi Redmi 'numeric' models
441-
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i // Xiaomi Mi
441+
/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i // Xiaomi Mi
442442
], [[MODEL, /_/g, ' '], [VENDOR, XIAOMI], [TYPE, MOBILE]], [
443443
/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i, // Redmi Pad
444444
/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i // Mi Pad tablets

test/device-test.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,6 +2807,15 @@
28072807
"type": "mobile"
28082808
}
28092809
},
2810+
{
2811+
"desc": "Xiaomi Mi 10 Pro",
2812+
"ua": "Linux; U; Android 13; Mi 10 Pro Build/TKQ1.221114.001",
2813+
"expect": {
2814+
"vendor": "Xiaomi",
2815+
"model": "Mi 10 Pro",
2816+
"type": "mobile"
2817+
}
2818+
},
28102819
{
28112820
"desc": "Xiaomi Mi 5s Plus",
28122821
"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",

0 commit comments

Comments
 (0)