Skip to content

Commit

Permalink
Fix #619 - Move Sharp up to be checked before Huawei
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Jan 26, 2023
1 parent ba0f25c commit 0b0c7ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@

//////////////////////////
// MOBILES & TABLETS
// Ordered by popularity
/////////////////////////

// Samsung
Expand All @@ -396,6 +395,10 @@
/(macintosh);/i
], [MODEL, [VENDOR, APPLE]], [

// Sharp
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i
], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [

// Huawei
/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i
], [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]], [
Expand Down Expand Up @@ -511,10 +514,6 @@
/\bmz-([-\w]{2,})/i
], [MODEL, [VENDOR, 'Meizu'], [TYPE, MOBILE]], [

// Sharp
/\b(sh-?[altvz]?\d\d[a-ekm]?)/i
], [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]], [

// MIXED
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,
// BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron
Expand Down
9 changes: 9 additions & 0 deletions test/device-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,15 @@
"type": "mobile"
}
},
{
"desc": "Sharp Aquos L2",
"ua": "Mozilla/5.0 (Linux; Android 7.0; SH-L02) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Mobile Safari/537.36",
"expect": {
"vendor": "Sharp",
"model": "SH-L02",
"type": "mobile"
}
},
{
"desc": "Sharp Aquos R2",
"ua": "Mozilla/5.0 (Linux; Android 8.0; SHV42) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.92 Mobile Safari/537.36",
Expand Down

0 comments on commit 0b0c7ff

Please sign in to comment.