Skip to content

Commit

Permalink
Fix #448 Add AT&T & Vodafone devices
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Mar 23, 2021
1 parent effd766 commit 14e7dd3
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 6 deletions.
9 changes: 5 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ Vivaldi, Waterfox, WeChat, Weibo, Yandex, baidu, iCab, w3m, Whale Browser...
console, mobile, tablet, smarttv, wearable, embedded

# Possible 'device.vendor':
Acer, Alcatel, Amazon, Apple, Archos, Asus, BenQ, BlackBerry, Dell, Essential,
GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu, Microsoft, Motorola,
Nexian, Nintendo, Nokia, Nvidia, OnePlus, Ouya, Palm, Panasonic, Pebble, Polytron,
RIM, Samsung, Sharp, Siemens, Sony[Ericsson], Sprint, Xbox, Xiaomi, Zebra, ZTE, ...
Acer, Alcatel, Amazon, Apple, Archos, Asus, AT&T, BenQ, BlackBerry, Dell,
Essential, GeeksPhone, Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu,
Microsoft, Motorola, Nexian, Nintendo, Nokia, Nvidia, OnePlus, Ouya, Palm,
Panasonic, Pebble, Polytron, RIM, Samsung, Sharp, Siemens, Sony[Ericsson],
Sprint, Vodafone, Xbox, Xiaomi, Zebra, ZTE, ...

# 'device.model' determined dynamically
```
Expand Down
8 changes: 6 additions & 2 deletions src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,13 @@
/(dell)\s(strea[kpr\s\d]*[\dko])/i, // Dell Streak
/droid.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i, // Le Pan Tablets
/droid.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i, // Trinity Tablets
/droid.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i // Gigaset Tablets
/droid.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i, // Gigaset Tablets
/droid.+(vodafone)\s([\w\s]+)\)/i // Vodafone
], [VENDOR, MODEL, [TYPE, TABLET]], [


/\s(U304AA)\sbuild/i // AT&T
], [MODEL, [VENDOR, 'AT&T'], [TYPE, MOBILE]], [
/sie-(\w*)/i // Siemens
], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
/droid.+[;\/]\s*(RCT[\d\w]+)\s+build/i // RCA Tablets
Expand Down Expand Up @@ -603,7 +607,7 @@
], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [
/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i // HbbTV devices
], [[VENDOR, util.trim], [MODEL, util.trim], [TYPE, SMARTTV]], [
/[\s\/\(](android\stv|smart-?tv)[;\)\s]/i // SmartTV from Unidentified Vendors
/[\s\/\(](android\stv|smart[-\s]?tv)[;\)\s]/i // SmartTV from Unidentified Vendors
], [[TYPE, SMARTTV]], [

// WEARABLES
Expand Down
36 changes: 36 additions & 0 deletions test/device-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,42 @@
"type": "mobile"
}
},
{
"desc": "Amazon Fire 7",
"ua": "Mozilla/5.0 (Linux; Android 5.1.1; KFAUWI) AppleWebKit/537.36 (KHTML, like Gecko) Silk/80.5.3 like Chrome/80.0.3987.162 Safari/537.36",
"expect": {
"vendor": "Amazon",
"model": "KFAUWI",
"type": "tablet"
}
},
{
"desc": "AT&T Radiant Core U304AA",
"ua": "Dalvik/2.1.0 (Linux; U; Android 9; U304AA Build/P00610)",
"expect": {
"vendor": "AT&T",
"model": "U304AA",
"type": "mobile"
}
},
{
"desc": "Vodafone Smart Tab 4G",
"ua": "Mozilla/5.0 (Linux; Android 4.4.4; Vodafone Smart Tab 4G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
"expect": {
"vendor": "Vodafone",
"model": "Smart Tab 4G",
"type": "tablet"
}
},
{
"desc": "4ife 4K Smart TV Box",
"ua": "Mozilla/5.0 (Linux; Android 4.4.2; 4ife 4K Smart TV Box Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Safari/537.36 Vinebre",
"expect": {
"vendor": "undefined",
"model": "undefined",
"type": "smarttv"
}
},
{
"desc": "FaceBook Mobile App",
"ua": "[FBAN/FBIOS;FBAV/283.0.0.44.117;FBBV/238386386;FBDV/iPhone12,1;FBMD/iPhone;FBSN/iOS;FBSV/13.6.1;FBSS/2;FBID/phone;FBLC/en_US;FBOP/5;FBRV/240127608]",
Expand Down

0 comments on commit 14e7dd3

Please sign in to comment.