Skip to content

Commit

Permalink
Fix #351: Identify Huawei MediaPad as tablet
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Dec 14, 2019
1 parent d260bcc commit e14dcd5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@
/(kindle)\/([\w\.]+)/i, // Kindle
/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer

// Trident based
/(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i,
// Avant/IEMobile/SlimBrowser
Expand Down Expand Up @@ -289,7 +288,7 @@
/(micromessenger)\/([\w\.]+)/i // WeChat
], [[NAME, 'WeChat'], VERSION], [

/(brave)\/([\w\.]+)/i // Brave browser
/(brave)\/([\w\.]+)/i // Brave browser
], [[NAME, 'Brave'], VERSION], [

/(qqbrowserlite)\/([\w\.]+)/i // QQBrowserLite
Expand All @@ -310,7 +309,7 @@
/(MetaSr)[\/\s]?([\w\.]+)/i // SouGouBrowser
], [NAME], [

/(LBBROWSER)/i // LieBao Browser
/(LBBROWSER)/i // LieBao Browser
], [NAME], [

/xiaomi\/miuibrowser\/([\w\.]+)/i // MIUI Browser
Expand Down Expand Up @@ -494,6 +493,9 @@
/(nexus\s6p|vog-l29|ane-lx1|eml-l29)/i // Huawei
], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [

/android.+(bah2?-a?[lw]\d{2})/i // Huawei MediaPad
], [MODEL, [VENDOR, 'Huawei'], [TYPE, TABLET]], [

/(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia
], [VENDOR, MODEL, [TYPE, MOBILE]], [

Expand Down
9 changes: 9 additions & 0 deletions test/device-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,15 @@
"type": "tablet"
}
},
{
"desc": "HUAWEI MediaPad M3 Lite 10",
"ua": "Mozilla/5.0 (Linux; Android 7.0; BAH-L09) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.80 Safari/537.36",
"expect": {
"vendor": "Huawei",
"model": "BAH-L09",
"type": "tablet"
}
},
{
"desc": "Huawei P30 Pro",
"ua": "Mozilla/5.0 (Linux; Android 9; VOG-L29) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.143 Mobile Safari/537.36",
Expand Down

0 comments on commit e14dcd5

Please sign in to comment.