Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Fixed BB10 detection
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielbull committed Jul 25, 2016
1 parent 8d96452 commit 356eb62
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 6.0.3 (released 2016-07-25)

- Fixed BB10 detection

## 6.0.2 (released 2016-06-30)

- Added Comodo Dragon detection
Expand Down
8 changes: 8 additions & 0 deletions src/BrowserDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ public static function checkBrowserBlackBerry()
}
self::$browser->setName(Browser::BLACKBERRY);

return true;
} elseif (stripos(self::$userAgentString, 'BB10') !== false) {
$aresult = explode('Version/10.', self::$userAgentString);
if (isset($aresult[1])) {
$aversion = explode(' ', $aresult[1]);
self::$browser->setVersion('10.' . $aversion[0]);
}
self::$browser->setName(Browser::BLACKBERRY);
return true;
}

Expand Down
12 changes: 12 additions & 0 deletions src/OsDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,18 @@ private static function checkBlackBerry(Os $os, UserAgent $userAgent)
$os->setName($os::BLACKBERRY);
$os->setIsMobile(true);

return true;
} elseif (stripos($userAgent->getUserAgentString(), 'BB10') !== false) {
$aresult = explode('Version/10.', $userAgent->getUserAgentString());
if (isset($aresult[1])) {
$aversion = explode(' ', $aresult[1]);
$os->setVersion('10.' . $aversion[0]);
} else {
$os->setVersion('10');
}
$os->setName($os::BLACKBERRY);
$os->setIsMobile(true);

return true;
}

Expand Down
11 changes: 11 additions & 0 deletions tests/BrowserDetector/Tests/_files/UserAgentStrings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,16 @@
Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Comodo_Dragon/4.1.1.11 Chrome/4.1.249.1042 Safari/532.5
</field>
</string>
<string>
<field name="browser">BlackBerry</field>
<field name="version">10.0.9.2372</field>
<field name="os">BlackBerry</field>
<field name="os_version">10.0.9.2372</field>
<field name="device">unknown</field>
<field name="device_version">unknown</field>
<field name="string">
Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+
</field>
</string>
</strings>
</document>

0 comments on commit 356eb62

Please sign in to comment.