Skip to content

Commit

Permalink
Fix device detection
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbok committed Mar 10, 2015
1 parent 3b25bba commit e6cd862
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion framer/DeviceView.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@ class exports.DeviceView extends BaseClass
if @deviceType is "fullscreen"
return true

if Utils.deviceType() is @_device.deviceType
if Utils.deviceType() is "phone" and Utils.deviceType() is @_device.deviceType
return true

if Utils.deviceType() is "tablet" and Utils.deviceType() is @_device.deviceType
return true

if Utils.deviceType() is "phone" and @_device.deviceType is "tablet"
return true

return false
Expand Down
6 changes: 3 additions & 3 deletions framer/Utils.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ Utils.deviceType = ->
# Taken from
# https://github.com/jeffmcmahan/device-detective/blob/master/bin/device-detect.js

if /(tablet)|(iPad)|(Nexus 9)/i.test(navigator.userAgent)
return "tablet"

if /(mobi)/i.test(navigator.userAgent)
return "phone"

if /(tablet)|(iPad)/i.test(navigator.userAgent)
return "tablet"

return "desktop"

Utils.pathJoin = ->
Expand Down

0 comments on commit e6cd862

Please sign in to comment.