Skip to content

Commit

Permalink
Detect new brand BMXC and Detect devices for exist brands (matomo-org…
Browse files Browse the repository at this point in the history
…#7345)

* feat(device) detect new brand BMXC: 800
feat(device) detect brand Yandex: Module
feat(device) detect brand DEXP
feat(device) detect brand Vontar: X4, X2
feat(device) detect brand ZTE: Blade V40 Vita (8045), Blade L370
feat(device) detect brand POCO: M5s, C40, F4
feat(device) detect brand UMIDIGI: A1 Pro
feat(device) detect brand Huawei: Ascend P6 (P6 S-U06)
feat(device) detect brand Revomovil: S21 (S6523)
feat(device) detect brand Huawei: Mate 50 (CET-LX9)

* feat(device) detect brand Digma: Optima 1245C 4G, Optima 1411D 4G
feat(device) detect brand Leff: 32H550T
feat(device) detect brand Irbis: 43F1YDX000BS2
feat(device) detect brand Hartens: HTY-32HDR06G
feat(device) detect brand Hyundai: H-LED40GS5003

* feat(device) detect brand DEXP: H32F8000QG, H32H8001C

* feat(device) detect brand Digma: DM-LED55UR31

* feat(device) detect brand Dell: Chromebook 13 (7310)
feat(device) detect brand Xiaomi: Redmi Note 11T 5G, Redmi Note 10T 5G
feat(device) detect brand FireFly Mobile: Aurii Razor Plus

* feat(device) detect brand AllDocube: iPlay 50

* feat(device) detect brand Sigma: Tab A1015

* feat(device) detect brand TCL: Tab 10 FHD 4G (9161G)
feat(device) detect brand Hotwav: W10
  • Loading branch information
sanchezzzhak authored Jan 31, 2023
1 parent b088070 commit c4f7bee
Show file tree
Hide file tree
Showing 11 changed files with 713 additions and 35 deletions.
2 changes: 1 addition & 1 deletion DeviceDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ protected function parseDevice(): void
/**
* All devices that contain Andr0id in string are assumed to be a tv
*/
if ($this->matchUserAgent('Andr0id|Android TV')) {
if ($this->matchUserAgent('Andr0id|Android TV|\(lite\) TV')) {
$this->device = AbstractDeviceParser::DEVICE_TYPE_TV;
}

Expand Down
1 change: 1 addition & 0 deletions Parser/Device/AbstractDeviceParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ abstract class AbstractDeviceParser extends AbstractParser
'BLI' => 'BLISS',
'BM' => 'Bmobile',
'Y5' => 'BMAX',
'BMX' => 'BMXC',
'B9' => 'Bobarry',
'B4' => 'bogo',
'BW' => 'Boway',
Expand Down
14 changes: 14 additions & 0 deletions Tests/DeviceDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,20 @@ public function testGetClient(): void
$this->assertEquals($expected, $dd->getClient());
}

public function testCommonDetectTypeTv(): void
{
$userAgents = [
'Mozilla/5.0 (Linux; Android 9; XXXXXXXXX Build/PPR2.180905.006.A1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.120 YaBrowser/22.8.0.12 (lite) TV Safari/537.36',
];
$dd = new DeviceDetector();

foreach ($userAgents as $userAgent) {
$dd->setUserAgent($userAgent);
$dd->parse();
$this->assertEquals(true, $dd->isTV());
}
}

public function testGetBrandName(): void
{
$dd = new DeviceDetector('Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.136 Mobile Safari/537.36');
Expand Down
18 changes: 18 additions & 0 deletions Tests/fixtures/desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8953,3 +8953,21 @@
model: TravelMate 8371
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; x86; Android 9; Dell Chromebook 13 (7310)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.125 YaBrowser/22.7.0.144.01 Safari/537.36
os:
name: Android
version: "9"
platform: x86
client:
type: browser
name: Yandex Browser
version: 22.7.0.144.01
engine: Blink
engine_version: 102.0.5005.125
device:
type: desktop
brand: Dell
model: Chromebook 13 (7310)
os_family: Android
browser_family: Unknown
36 changes: 36 additions & 0 deletions Tests/fixtures/phablet-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -627,3 +627,39 @@
model: Redmi Note 11E
os_family: Android
browser_family: Android Browser
-
user_agent: Mozilla/5.0 (Linux; U; Android 12; ru-ru; Redmi Note 11T 5G Build/SP1A.210812.016) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.127 Mobile Safari/537.36 XiaoMi/MiuiBrowser/13.19.2-gn
os:
name: Android
version: "12"
platform: ""
client:
type: browser
name: MIUI Browser
version: 13.19.2
engine: WebKit
engine_version: "537.36"
device:
type: phablet
brand: Xiaomi
model: Redmi Note 11T 5G
os_family: Android
browser_family: Android Browser
-
user_agent: Mozilla/5.0 (Linux; U; Android 12; ru-ru; Redmi Note 10T 5G Build/SP1A.210812.016) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.127 Mobile Safari/537.36 XiaoMi/MiuiBrowser/13.17.0-gn
os:
name: Android
version: "12"
platform: ""
client:
type: browser
name: MIUI Browser
version: 13.17.0
engine: WebKit
engine_version: "537.36"
device:
type: phablet
brand: Xiaomi
model: Redmi Note 10T 5G
os_family: Android
browser_family: Android Browser
234 changes: 234 additions & 0 deletions Tests/fixtures/smartphone-34.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6073,3 +6073,237 @@
model: RX460
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 11; ZTE 8045) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Mobile Safari/537.36
os:
name: Android
version: "11"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 109.0.0.0
engine: Blink
engine_version: 109.0.0.0
device:
type: smartphone
brand: ZTE
model: Blade V40 Vita
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; U; Android 12; ru-ru; POCO M5s Build/SP1A.210812.016) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.127 Mobile Safari/537.36 XiaoMi/MiuiBrowser/13.16.1-gn
os:
name: Android
version: "12"
platform: ""
client:
type: browser
name: MIUI Browser
version: 13.16.1
engine: WebKit
engine_version: "537.36"
device:
type: smartphone
brand: POCO
model: M5s
os_family: Android
browser_family: Android Browser
-
user_agent: Mozilla/5.0 (Linux; Android 8.1.0; A1_PRO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Mobile Safari/537.36
os:
name: Android
version: 8.1.0
platform: ""
client:
type: browser
name: Chrome Mobile
version: 107.0.0.0
engine: Blink
engine_version: 107.0.0.0
device:
type: smartphone
brand: UMIDIGI
model: A1 Pro
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 4.4.2; HUAWEI P6 S-U06) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36 OPR/58.6.2878.68030
os:
name: Android
version: 4.4.2
platform: ""
client:
type: browser
name: Opera Mobile
version: 58.6.2878.68030
engine: Blink
engine_version: 81.0.4044.138
device:
type: smartphone
brand: Huawei
model: Ascend P6
os_family: Android
browser_family: Opera
-
user_agent: Mozilla/5.0 (Linux; Android 4.4.2; ZTE Blade L370) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36
os:
name: Android
version: 4.4.2
platform: ""
client:
type: browser
name: Chrome Mobile
version: 81.0.4044.138
engine: Blink
engine_version: 81.0.4044.138
device:
type: smartphone
brand: ZTE
model: Blade L370
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; U; Android 11; ru-ru; POCO C40 Build/RD2A.211001.002) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.127 Mobile Safari/537.36 XiaoMi/MiuiBrowser/13.14.1-gn
os:
name: Android
version: "11"
platform: ""
client:
type: browser
name: MIUI Browser
version: 13.14.1
engine: WebKit
engine_version: "537.36"
device:
type: smartphone
brand: POCO
model: C40
os_family: Android
browser_family: Android Browser
-
user_agent: Mozilla/5.0 (Linux; Android 4.4.2; HTC Desire 620G dual sim) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36
os:
name: Android
version: 4.4.2
platform: ""
client:
type: browser
name: Chrome Mobile
version: 81.0.4044.138
engine: Blink
engine_version: 81.0.4044.138
device:
type: smartphone
brand: HTC
model: Desire 620G Dual SIM
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 11; S6523) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.210 Mobile Safari/537.36
os:
name: Android
version: "11"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 90.0.4430.210
engine: Blink
engine_version: 90.0.4430.210
device:
type: smartphone
brand: Revomovil
model: S21
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; arm_64; Android 12; CET-LX9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 YaBrowser/22.11.6.43.00 SA/3 Mobile Safari/537.36
os:
name: Android
version: "12"
platform: ARM
client:
type: browser
name: Yandex Browser
version: 22.11.6.43.00
engine: Blink
engine_version: 106.0.0.0
device:
type: smartphone
brand: Huawei
model: Mate 50
os_family: Android
browser_family: Unknown
-
user_agent: Mozilla/5.0 (Linux; U; Android 12; ru-ru; POCO F4 Build/SKQ1.211006.001) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.127 Mobile Safari/537.36 XiaoMi/MiuiBrowser/13.19.2-gn
os:
name: Android
version: "12"
platform: ""
client:
type: browser
name: MIUI Browser
version: 13.19.2
engine: WebKit
engine_version: "537.36"
device:
type: smartphone
brand: POCO
model: F4
os_family: Android
browser_family: Android Browser
-
user_agent: Mozilla/5.0 (Linux; Android 10; EVE-LX9N Build/HUAWEIEVE-LX9N; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/88.0.4324.93 Mobile Safari/537.36 YandexSearch/7.52 YandexSearchBrowser/7.52
os:
name: Android
version: "10"
platform: ""
client:
type: browser
name: Yandex Browser
version: "7.52"
engine: Blink
engine_version: 88.0.4324.93
device:
type: smartphone
brand: Huawei
model: Nova Y61
os_family: Android
browser_family: Unknown
-
user_agent: Mozilla/5.0 (Linux; Android 7.0; RAZOR_PLUS_4G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.92 Mobile Safari/537.36
os:
name: Android
version: "7.0"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 77.0.3865.92
engine: Blink
engine_version: 77.0.3865.92
device:
type: smartphone
brand: FireFly Mobile
model: Aurii Razor Plus
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 12; W10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36
os:
name: Android
version: "12"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 99.0.4844.88
engine: Blink
engine_version: 99.0.4844.88
device:
type: smartphone
brand: Hotwav
model: W10
os_family: Android
browser_family: Chrome
18 changes: 18 additions & 0 deletions Tests/fixtures/tablet-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9978,3 +9978,21 @@
model: AirTab M75t
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 6.0; BMXC 800) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.58 Safari/537.36
os:
name: Android
version: "6.0"
platform: ""
client:
type: browser
name: Chrome
version: 99.0.4844.58
engine: Blink
engine_version: 99.0.4844.58
device:
type: tablet
brand: BMXC
model: "800"
os_family: Android
browser_family: Chrome
Loading

0 comments on commit c4f7bee

Please sign in to comment.