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

Fix for BlackBerry devices #104

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions user_agents/devices.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"is_mobile": true,
"is_pc": false,
"is_tablet": false,
"is_touch_capable": false,
"is_touch_capable": true,
"ua_string": "Mozilla/5.0 (BlackBerry; U; BlackBerry 9930; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.241 Mobile Safari/534.11+",
"str": "BlackBerry 9930 / BlackBerry OS 7 / BlackBerry WebKit 7"
},
Expand All @@ -31,7 +31,7 @@
"is_mobile": true,
"is_pc": false,
"is_tablet": false,
"is_touch_capable": false,
"is_touch_capable": true,
"ua_string": "Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; zh-TW) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.448 Mobile Safari/534.8+",
"str": "BlackBerry 9800 / BlackBerry OS 6 / BlackBerry WebKit 6"
},
Expand Down
7 changes: 5 additions & 2 deletions user_agents/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,12 @@ def _is_android_tablet(self):
def _is_blackberry_touch_capable_device(self):
# A helper to determine whether a BB phone has touch capabilities
# Blackberry Bold Touch series begins with 99XX
if 'Blackberry 99' in self.device.family:
if 'blackberry 99' in self.device.family.lower():
return True
if 'Blackberry 95' in self.device.family: # BB Storm devices
# Blackberry Torch series begins with 98XX
if 'blackberry 98' in self.device.family.lower():
return True
if 'blackberry 95' in self.device.family.lower(): # BB Storm devices
return True
return False

Expand Down
4 changes: 2 additions & 2 deletions user_agents/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ def test_is_touch_property(self):
self.assertTrue(nexus_7_ua.is_touch_capable)
self.assertTrue(windows_phone_ua.is_touch_capable)
self.assertTrue(ie_touch_ua.is_touch_capable)
self.assertTrue(blackberry_bold_touch_ua.is_mobile)
self.assertTrue(blackberry_torch_ua.is_mobile)
self.assertTrue(blackberry_bold_touch_ua.is_touch_capable)
self.assertTrue(blackberry_torch_ua.is_touch_capable)
self.assertFalse(j2me_opera_ua.is_touch_capable)
self.assertFalse(ie_ua.is_touch_capable)
self.assertFalse(blackberry_bold_ua.is_touch_capable)
Expand Down