Skip to content

Commit

Permalink
Detect new brand NoviSea and Detect devices for exist brands (#7670)
Browse files Browse the repository at this point in the history
feat(device) detect brand Wileyfox: Swift 2 Plus
feat(device) detect brand Reeder: S19 Max L, S19 Max, S19 Max Pro
feat(device) detect brand iTel: P55 5G (P661N)
feat(device) detect brand OMIX: X700
feat(device) detect brand ONYX BOOX: Volta 4
feat(device) detect new brand NoviSea: A10
feat(device) detect brand Huawei: Honor Magic 5 (PGT-AN00)
feat(device) detect brand AllCall: Shine 12 Pro
feat(device) detect brand Blackview: BV4800
feat(device) detect brand Acer: Liquid Z500
feat(device) detect brand OPPO: A1i 5G (PJU110)
feat(device) detect brand ZTE: 5G UG Phone U23
feat(device) detect brand Doogee: S51
feat(device) detect brand TwinMOS: T103GQ1
feat(device) detect brand Pritom: M10
feat(device) detect brand DEXP: B31
feat(device) detect brand Explay: Tornado 8
feat(device) detect brand W&O: WO9
feat(device) detect brand Hyundai: H-LED50FU7001, H-LED55BU7003, H-DMP103
feat(device) detect brand Accesstyle: H32EY1500B
feat(device) detect brand NEXON: X3
feat(device) detect brand Hartens: HTY-43FHD06B-S2-T9
feat(device) detect brand SUNWIND: Sky 1264C 4G
feat(device) detect brand Samsung: Galaxy Tab S9 FE+ 12.4" 5G (SM-X616B)
feat(device) detect brand TCL: 303 (5131G)
  • Loading branch information
sanchezzzhak authored Apr 26, 2024
1 parent a31536f commit 191fa09
Show file tree
Hide file tree
Showing 7 changed files with 683 additions and 48 deletions.
1 change: 1 addition & 0 deletions Parser/Device/AbstractDeviceParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,7 @@ abstract class AbstractDeviceParser extends AbstractParser
'N1' => 'Noain',
'N6' => 'Nobby',
'NOC' => 'Novacom',
'NOS' => 'NoviSea',
'NOV' => 'Novey',
'NO1' => 'NOVO',
'57' => 'Nubia',
Expand Down
25 changes: 25 additions & 0 deletions Tests/DeviceDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ public function testDevicesYmlFiles(): void
$regex['regex']
));

$this->assertTrue($this->checkRegexRestrictionAndroidOsVersionCondition($regex['regex']), \sprintf(
'Detect `Android \d;` in regex, file %s, brand %s, common regex %s',
$file,
$brand,
$regex['regex']
));

$this->assertTrue($this->checkRegexVerticalLineClosingGroup($regex['regex']), \sprintf(
'Detect `|)` in regex, file %s, brand %s, common regex %s',
$file,
Expand Down Expand Up @@ -704,6 +711,24 @@ protected function checkRegexVerticalLineClosingGroup(string $regexString): bool
return true;
}
/**
* check the regular expression for regex `Android \d([\d.]*)? condition constraint
* (This needs to be checked since the version with client prompts is not trimmed)
*
* @param string $regexString
*
* @return bool
*/
protected function checkRegexRestrictionAndroidOsVersionCondition(string $regexString): bool
{
// check regex is condition android \d
if (\preg_match('~Android (\d|\[)~i', $regexString)) {
return !\preg_match('~android (\d|\[\d+\]);~', $regexString);
}

return true;
}

/**
* check the regular expression for end condition constraint (?:[);/ ]|$)
*
Expand Down
306 changes: 306 additions & 0 deletions Tests/fixtures/smartphone-38.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6958,3 +6958,309 @@
model: Galaxy A14
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 6.0.1; Wileyfox Swift 2 Plus) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Mobile Safari/537.36
os:
name: Android
version: 6.0.1
platform: ""
client:
type: browser
name: Chrome Mobile
version: 106.0.0.0
engine: Blink
engine_version: 106.0.0.0
device:
type: smartphone
brand: Wileyfox
model: Swift 2 Plus
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 13; S19 MaxL 128GB) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36
os:
name: Android
version: "13"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 123.0.0.0
engine: Blink
engine_version: 123.0.0.0
device:
type: smartphone
brand: Reeder
model: S19 Max L
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 13; S19 Max 32GB) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36
os:
name: Android
version: "13"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 123.0.0.0
engine: Blink
engine_version: 123.0.0.0
device:
type: smartphone
brand: Reeder
model: S19 Max
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 13; itel P661N Build/TP1A.220624.014) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.60 Mobile Safari/537.36
os:
name: Android
version: "13"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 114.0.5735.60
engine: Blink
engine_version: 114.0.5735.60
device:
type: smartphone
brand: iTel
model: P55 5G
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 11; S19 Max Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36
os:
name: Android
version: "11"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 123.0.0.0
engine: Blink
engine_version: 123.0.0.0
device:
type: smartphone
brand: Reeder
model: S19 Max Pro
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 12; X700) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36
os:
name: Android
version: "12"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 123.0.0.0
engine: Blink
engine_version: 123.0.0.0
device:
type: smartphone
brand: OMIX
model: X700
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; U; Android 14; zh-Hans-CN; PGT-AN00 Build/HONORPGT-AN00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/100.0.4896.58 Quark/6.11.0.530 Mobile Safari/537.36
os:
name: Android
version: "14"
platform: ""
client:
type: browser
name: Quark
version: 6.11.0.530
engine: Blink
engine_version: 100.0.4896.58
device:
type: smartphone
brand: Huawei
model: Honor Magic 5
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 11; SM-A526A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Mobile Safari/537.36
os:
name: Android
version: "11"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 85.0.4183.83
engine: Blink
engine_version: 85.0.4183.83
device:
type: smartphone
brand: Samsung
model: Galaxy A52 5G
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 14; SM-S9260) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36
os:
name: Android
version: "14"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 123.0.0.0
engine: Blink
engine_version: 123.0.0.0
device:
type: smartphone
brand: Samsung
model: Galaxy S24+
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 11; SHINE 12 PRO) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.98 Mobile Safari/537.36
os:
name: Android
version: "11"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 97.0.4692.98
engine: Blink
engine_version: 97.0.4692.98
device:
type: smartphone
brand: AllCall
model: Shine 12 Pro
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; arm; Android 13; BV4800) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.292 YaBrowser/24.4.0.292.00 SA/3 Mobile Safari/537.36
os:
name: Android
version: "13"
platform: ARM
client:
type: browser
name: Yandex Browser
version: 24.4.0.292.00
engine: Blink
engine_version: 122.0.6261.292
device:
type: smartphone
brand: Blackview
model: BV4800
os_family: Android
browser_family: Unknown
-
user_agent: Mozilla/5.0 (Linux; Android 4.4.2; Z500) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 YaBrowser/18.11.1.1011.00 Mobile Safari/537.36
os:
name: Android
version: 4.4.2
platform: ""
client:
type: browser
name: Yandex Browser
version: 18.11.1.1011.00
engine: Blink
engine_version: 70.0.3538.102
device:
type: smartphone
brand: Acer
model: Liquid Z500
os_family: Android
browser_family: Unknown
-
user_agent: Mozilla/5.0 (Linux; Android 12; S51) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36
os:
name: Android
version: "12"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 123.0.0.0
engine: Blink
engine_version: 123.0.0.0
device:
type: smartphone
brand: Doogee
model: S51
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 11; 5131G) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.119 Mobile Safari/537.36
os:
name: Android
version: "11"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 122.0.6261.119
engine: Blink
engine_version: 122.0.6261.119
device:
type: smartphone
brand: TCL
model: "303"
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 10; NoviSea A10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.6312.99 Mobile Safari/537.36
os:
name: Android
version: "10"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 123.0.6312.99
engine: Blink
engine_version: 123.0.6312.99
device:
type: smartphone
brand: NoviSea
model: A10
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 13; PJU110) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.6312.40 Mobile Safari/537.36
os:
name: Android
version: "13"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 123.0.6312.40
engine: Blink
engine_version: 123.0.6312.40
device:
type: smartphone
brand: OPPO
model: A1i 5G
os_family: Android
browser_family: Chrome
-
user_agent: Mozilla/5.0 (Linux; Android 13; 5G UG Phone U23) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.6312.99 Mobile Safari/537.36
os:
name: Android
version: "13"
platform: ""
client:
type: browser
name: Chrome Mobile
version: 123.0.6312.99
engine: Blink
engine_version: 123.0.6312.99
device:
type: smartphone
brand: ZTE
model: 5G UG Phone U23
os_family: Android
browser_family: Chrome
Loading

0 comments on commit 191fa09

Please sign in to comment.