diff --git a/src/ua-parser.js b/src/ua-parser.js index 24292f2..c4ba8ad 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -517,8 +517,8 @@ ], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [ /(blackberry)[\s-]?(\w+)/i, // BlackBerry - /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, - // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Huawei/Meizu/Motorola/Polytron + /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, + // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron /(hp)\s([\w\s]+\w)/i, // HP iPAQ /(asus)-?(\w+)/i // Asus ], [VENDOR, MODEL, [TYPE, MOBILE]], [ @@ -552,14 +552,15 @@ /(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC /(zte)-(\w+)*/i, // ZTE - /(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i - // Alcatel/GeeksPhone/Huawei/Lenovo/Nexian/Panasonic/Sony + /(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i + // Alcatel/GeeksPhone/Lenovo/Nexian/Panasonic/Sony ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [ /(nexus\s9)/i // HTC Nexus 9 ], [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]], [ /(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia diff --git a/test/device-test.json b/test/device-test.json index b2f5a9e..b211071 100644 --- a/test/device-test.json +++ b/test/device-test.json @@ -49,6 +49,16 @@ "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", "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" } }, + { + "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", "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",