motion/core/device/ios/camera.rb in bubble-wrap-1.3.0 vs motion/core/device/ios/camera.rb in bubble-wrap-1.4.0

- old
+ new

@@ -15,10 +15,12 @@ Constants.register UIImagePickerControllerSourceTypePhotoLibrary, UIImagePickerControllerSourceTypeCamera, UIImagePickerControllerSourceTypeSavedPhotosAlbum MEDIA_TYPE_HASH = {movie: KUTTypeMovie, image: KUTTypeImage} + CAMERA_LOCATIONS = [:front, :rear, :none] + # The camera location; if :none, then we can't use source_type: :camera # in #picture # [:front, :rear, :none] attr_accessor :location @@ -40,11 +42,11 @@ def initialize(location = :none) self.location = location end def location=(location) - if not [:front, :rear, :none].member? location + if not CAMERA_LOCATIONS.member? location raise Error::INVALID_CAMERA_LOCATION, "#{location} is not a valid camera location" end @location = location end @@ -135,10 +137,9 @@ # Takes the default didFinishPickingMediaWithInfo hash, # transforms the keys to be nicer symbols of :this_form # instead of UIImagePickerControllerThisForm, and then sends it # to the callback def imagePickerController(picker, didFinishPickingMediaWithInfo: info) - delete_keys = [] callback_info = {} info.keys.each { |k| nice_key = k.gsub("UIImagePickerController", "").underscore.to_sym val = info[k]