Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves detection for tablets #7689

Merged
merged 5 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DeviceDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ protected function getOsAttribute(string $attr): string
*/
protected function hasAndroidTableFragment(): bool
{
$regex = 'Android( [\.0-9]+)?; Tablet;|.*\-tablet$';
$regex = 'Android( [\.0-9]+)?; Tablet;|Tablet(?! PC)|.*\-tablet$';

return !!$this->matchUserAgent($regex);
}
Expand Down
18 changes: 0 additions & 18 deletions Tests/fixtures/desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -676,24 +676,6 @@
model: ""
os_family: GNU/Linux
browser_family: Unknown
-
user_agent: Mozilla/5.0 (X11; U; Linux armv7l; en-GB; rv:1.9.2a1pre) Gecko/20090514 Firefox/3.0 Tablet browser 0.9.7 RX-34
os:
name: GNU/Linux
version: ""
platform: ARM
client:
type: browser
name: MicroB
version: 0.9.7
engine: Gecko
engine_version: 1.9.2
device:
type: desktop
brand: ""
model: ""
os_family: GNU/Linux
browser_family: Firefox
-
user_agent: Mozilla/5.0 (X11; Linux) AppleWebKit/535.22 (KHTML, like Gecko) Chrome/18.0.1025.133 Safari/535.22 Midori/0.5
os:
Expand Down
36 changes: 35 additions & 1 deletion Tests/fixtures/unknown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,7 @@
engine: WebKit
engine_version: "534.30"
device:
type: ""
type: tablet
liviuconcioiu marked this conversation as resolved.
Show resolved Hide resolved
brand: ""
model: ""
os_family: Android
Expand Down Expand Up @@ -3395,3 +3395,37 @@
model: ""
os_family: iOS
browser_family: Unknown
-
user_agent: Mozilla/5.0 (X11; U; Linux armv7l; en-GB; rv:1.9.2a1pre) Gecko/20090514 Firefox/3.0 Tablet browser 0.9.7 RX-34
os:
name: GNU/Linux
version: ""
platform: ARM
client:
type: browser
name: MicroB
version: 0.9.7
engine: Gecko
engine_version: 1.9.2
device:
type: tablet
brand: ""
model: ""
os_family: GNU/Linux
browser_family: Firefox
-
user_agent: Pinterest for Android Tablet/11.42.2 (trona; 9)
os:
name: Android
version: "9"
platform: ""
client:
type: mobile app
name: Pinterest
version: 11.42.2
device:
type: tablet
brand: ""
model: ""
os_family: Android
browser_family: Unknown
Loading