Skip to content

Commit

Permalink
Improve device detection for unknown VR device
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalman committed Dec 18, 2024
1 parent 852520f commit 20e8740
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,10 +856,8 @@
// MIXED (GENERIC)
///////////////////

/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i // Android Phones from Unidentified Vendors
], [MODEL, [TYPE, MOBILE]], [
/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i // Android Tablets from Unidentified Vendors
], [MODEL, [TYPE, TABLET]], [
/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i
], [MODEL, [TYPE, strMapper, { 'mobile' : 'Mobile', 'xr' : 'VR', '*' : TABLET }]], [
/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet
], [[TYPE, TABLET]], [
/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile
Expand Down
8 changes: 8 additions & 0 deletions test/data/ua/device/_others.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
"type": "mobile"
}
},
{
"desc": "Unknown VR Device",
"ua": "Mozilla/5.0 (Linux; Android 5.0.2; Unknown Build/LRX22G) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile VR Safari/537.36",
"expect": {
"model": "Unknown",
"type": "xr"
}
},
{
"desc": "Desktop (IE11 with Tablet string)",
"ua": "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; GWX:MANAGED; rv:11.0) like Gecko",
Expand Down

0 comments on commit 20e8740

Please sign in to comment.