Fix #249 Detect Huawei devices

This commit is contained in:
Faisal Salman 2017-07-01 18:49:35 +07:00
parent 297c6538bc
commit fd46c4d2be
2 changed files with 36 additions and 5 deletions

View File

@ -517,8 +517,8 @@
], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [ ], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [
/(blackberry)[\s-]?(\w+)/i, // BlackBerry /(blackberry)[\s-]?(\w+)/i, // BlackBerry
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i,
// BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Huawei/Meizu/Motorola/Polytron // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron
/(hp)\s([\w\s]+\w)/i, // HP iPAQ /(hp)\s([\w\s]+\w)/i, // HP iPAQ
/(asus)-?(\w+)/i // Asus /(asus)-?(\w+)/i // Asus
], [VENDOR, MODEL, [TYPE, MOBILE]], [ ], [VENDOR, MODEL, [TYPE, MOBILE]], [
@ -552,14 +552,15 @@
/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC /(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC
/(zte)-(\w+)*/i, // ZTE /(zte)-(\w+)*/i, // ZTE
/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i /(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i
// Alcatel/GeeksPhone/Huawei/Lenovo/Nexian/Panasonic/Sony // Alcatel/GeeksPhone/Lenovo/Nexian/Panasonic/Sony
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [ ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
/(nexus\s9)/i // HTC Nexus 9 /(nexus\s9)/i // HTC Nexus 9
], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [
/(nexus\s6p)/i // Huawei Nexus 6P /d\/huawei([\w\s-]+)[;\)]/i,
/(nexus\s6p)/i // Huawei
], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [ ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [
/(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia /(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia

View File

@ -49,6 +49,16 @@
"type" : "tablet" "type" : "tablet"
} }
}, },
{
"desc" : "Huawei Honor",
"ua" : "Mozilla/5.0 (Linux; U; Android 2.3; xx-xx; U8860 Build/HuaweiU8860) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
"expect" :
{
"vendor" : "Huawei",
"model" : "U8860",
"type" : "mobile"
}
},
{ {
"desc" : "Huawei Nexus 6P", "desc" : "Huawei Nexus 6P",
"ua" : "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 6P Build/MTC19V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537", "ua" : "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 6P Build/MTC19V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537",
@ -59,6 +69,26 @@
"type" : "mobile" "type" : "mobile"
} }
}, },
{
"desc" : "Huawei P10",
"ua" : "Mozilla/5.0 (Linux; Android 7.0; VTR-L09 Build/HUAWEIVTR-L09; xx-xx) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/56.0.2924.87 Mobile Safari/537.36",
"expect" :
{
"vendor" : "Huawei",
"model" : "VTR-L09",
"type" : "mobile"
}
},
{
"desc" : "Huawei Y3II",
"ua" : "Mozilla/5.0 (Linux; U; Android 5.1; xx-xx; HUAWEI LUA-L03 Build/HUAWEILUA-L03) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/39.0.0.0 Mobile Safari/537.36",
"expect" :
{
"vendor" : "Huawei",
"model" : "LUA-L03",
"type" : "mobile"
}
},
{ {
"desc" : "iPod", "desc" : "iPod",
"ua" : "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53", "ua" : "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53",