Sha256: 525470716d8bda9991204c8396476848ebe12870a650e38a1ecd0a441fd8b041
Contents?: true
Size: 1.68 KB
Versions: 4
Compression:
Stored size: 1.68 KB
Contents
module BubbleWrap module Device module_function # Verifies that the device running the app is an iPhone. # @return [TrueClass, FalseClass] true will be returned if the device is an iPhone, false otherwise. def iphone?(idiom=UIDevice.currentDevice.userInterfaceIdiom) idiom == UIUserInterfaceIdiomPhone end # Verifies that the device running the app is an iPad. # @return [TrueClass, FalseClass] true will be returned if the device is an iPad, false otherwise. def ipad?(idiom=UIDevice.currentDevice.userInterfaceIdiom) idiom == UIUserInterfaceIdiomPad end # Verifies that the device running has a front facing camera. # @return [TrueClass, FalseClass] true will be returned if the device has a front facing camera, false otherwise. def front_camera?(picker=UIImagePickerController) picker.isCameraDeviceAvailable(UIImagePickerControllerCameraDeviceFront) end # Verifies that the device running has a rear facing camera. # @return [TrueClass, FalseClass] true will be returned if the device has a rear facing camera, false otherwise. def rear_camera?(picker=UIImagePickerController) picker.isCameraDeviceAvailable(UIImagePickerControllerCameraDeviceRear) end def simulator? @simulator_state ||= !(UIDevice.currentDevice.model =~ /simulator/i).nil? end # Shameless shorthand for accessing BubbleWrap::Screen def screen BubbleWrap::Device::Screen end # Delegates to BubbleWrap::Screen.retina? def retina? screen.retina? end # Delegates to BubbleWrap::Screen.orientation def orientation screen.orientation end end end ::Device = BubbleWrap::Device
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
bubble-wrap-1.0.0 | motion/core/device.rb |
bubble-wrap-1.0.0.pre.2 | motion/core/device.rb |
bubble-wrap-1.0.0.pre | motion/core/device.rb |
bubble-wrap-0.4.0 | motion/core/device.rb |