Improve device detection for Generic device: capture its device model instead of its Android version

This commit is contained in:
Faisal Salman 2024-12-16 11:05:24 +07:00
parent 93552e0172
commit 6c6ff97e0c
2 changed files with 12 additions and 4 deletions

View File

@ -19,8 +19,8 @@
// Constants
/////////////
var LIBVERSION = '2.0.0', // UAParser.version
UA_MAX_LENGTH = 500, // UA string over this length will be trimmed
var LIBVERSION = '2.0.0',
UA_MAX_LENGTH = 500,
USER_AGENT = 'user-agent',
EMPTY = '',
UNKNOWN = '?',
@ -864,7 +864,7 @@
], [[TYPE, TABLET]], [
/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
], [[TYPE, MOBILE]], [
/(android[-\w\. ]{0,9});.+buil/i // Generic Android Device
/droid .+?; ([\w\. -]+)( bui|\))/i // Generic Android Device
], [MODEL, [VENDOR, 'Generic']]
],

View File

@ -1,10 +1,18 @@
[
{
"desc": "Generic Android Device",
"ua": "Dalvik/2.1.0 (Linux; U; Android 9; X96mini_RP Build/X96mini_RP)",
"expect": {
"vendor": "Generic",
"model": "X96mini_RP"
}
},
{
"desc": "Generic Android Device",
"ua": "Mozilla/5.0 (Linux; U; Android 6.0.1; i980 Build/MRA58K)",
"expect": {
"vendor": "Generic",
"model": "Android 6.0.1"
"model": "i980"
}
},
{