Skip to content

Commit

Permalink
detect notebooks as desktop devices
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Aug 11, 2020
1 parent 7feb800 commit 2d039b6
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 63 deletions.
1 change: 0 additions & 1 deletion DeviceDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* @method boolean isTV()
* @method boolean isSmartDisplay()
* @method boolean isCamera()
* @method boolean isNotebook()
*
* Magic Client Type Methods
* @method boolean isBrowser()
Expand Down
4 changes: 1 addition & 3 deletions Parser/Device/DeviceParserAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ abstract class DeviceParserAbstract extends ParserAbstract
const DEVICE_TYPE_PHABLET = 10;
const DEVICE_TYPE_SMART_SPEAKER = 11;
const DEVICE_TYPE_WEARABLE = 12; // including set watches, headsets
const DEVICE_TYPE_NOTEBOOK = 13;

/**
* Detectable device types
Expand All @@ -56,7 +55,6 @@ abstract class DeviceParserAbstract extends ParserAbstract
'phablet' => self::DEVICE_TYPE_PHABLET,
'smart speaker' => self::DEVICE_TYPE_SMART_SPEAKER,
'wearable' => self::DEVICE_TYPE_WEARABLE,
'notebook' => self::DEVICE_TYPE_NOTEBOOK,
);

/**
Expand Down Expand Up @@ -154,7 +152,7 @@ abstract class DeviceParserAbstract extends ParserAbstract
'CH' => 'Cherry Mobile',
'1C' => 'Chuwi',
'L8' => 'Clarmin',
'C0' => 'Clout',
'CZ' => 'Clout',
'CK' => 'Cricket',
'C1' => 'Crosscall',
'CL' => 'Compal',
Expand Down
4 changes: 2 additions & 2 deletions Parser/Device/Notebook.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Class Notebook
*
* Device parser for notebook detection
* Device parser for notebook detection in Facebook useragents
*
* @package DeviceDetector\Parser\Device
*/
Expand All @@ -21,7 +21,7 @@ class Notebook extends DeviceParserAbstract

public function parse()
{
if (!$this->preMatchOverall()) {
if (!$this->matchUserAgent('FBMD/')) {
return false;
}

Expand Down
1 change: 0 additions & 1 deletion Tests/DeviceDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ public function testMagicMMethods()
$this->assertFalse($dd->isConsole());
$this->assertFalse($dd->isPortableMediaPlayer());
$this->assertFalse($dd->isCamera());
$this->assertFalse($dd->isNotebook());

$this->assertTrue($dd->isBrowser());
$this->assertFalse($dd->isLibrary());
Expand Down
2 changes: 1 addition & 1 deletion Tests/Parser/Devices/fixtures/notebook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
-
user_agent: Mozilla/5.0 (Windows NT 10.0.16299.125; osmeta 10.3.3308) AppleWebKit/602.1.1 (KHTML, like Gecko) Version/9.0 Safari/602.1.1 osmeta/10.3.3308 Build/3308 [FBAN/FBW;FBAV/140.0.0.232.179;FBBV/83145113;FBDV/WindowsDevice;FBMD/80VR;FBSN/Windows;FBSV/10.0.16299.371;FBSS/1;FBCR/;FBID/desktop;FBLC/ru_RU;FBOP/45;FBRV/0]
device:
type: 13
type: 0
brand: LE
model: Legion Y720
Loading

0 comments on commit 2d039b6

Please sign in to comment.