Commit 6c48fe04 authored by Quentin Muret's avatar Quentin Muret Committed by Andreas Traczyk

picture taking: remove the edition mode when we take a picture in a conversation

- remove the edition mode when we take a picture in a conversation
- fix image orientation
- change the default camera device from front to rear

Change-Id: If34b898886e826b054210a3a314300207a3aaf68
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 0bb45ffc
......@@ -108,13 +108,20 @@ class ConversationViewController: UIViewController,
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.camera
imagePicker.cameraDevice = UIImagePickerControllerCameraDevice.front
imagePicker.allowsEditing = true
imagePicker.cameraDevice = UIImagePickerControllerCameraDevice.rear
imagePicker.modalPresentationStyle = .overFullScreen
self.present(imagePicker, animated: false, completion: nil)
}
}
func fixImageOrientation(image: UIImage)->UIImage {
UIGraphicsBeginImageContext(image.size)
image.draw(at: .zero)
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage ?? image
}
func importImage() {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
......@@ -147,7 +154,7 @@ class ConversationViewController: UIViewController,
if let img = info[UIImagePickerControllerEditedImage] as? UIImage {
image = img
} else if let img = info[UIImagePickerControllerOriginalImage] as? UIImage {
image = img
image = self.fixImageOrientation(image: img)
}
// copy image to tmp
let imageFileName = "IMG.png"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment