Skip to content

Commit

Permalink
Fixes for #83 and #82 (#84)
Browse files Browse the repository at this point in the history
* Fixes for #83 and #82

* Chaged it so row.value is set only Once
  • Loading branch information
joaodforce authored Oct 21, 2020
1 parent b1f9f0c commit 9e87f2c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Sources/ImagePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,17 @@ open class ImagePickerController: UIImagePickerController, TypedRowControllerTyp

open func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
(row as? ImagePickerProtocol)?.imageURL = info[UIImagePickerController.InfoKey.referenceURL] as? URL
(row as? ImagePickerProtocol)?.userPickerInfo = info
row.value = info[ (row as? ImagePickerProtocol)?.useEditedImage ?? false ? UIImagePickerController.InfoKey.editedImage : UIImagePickerController.InfoKey.originalImage] as? UIImage

var finalImage = info[UIImagePickerController.InfoKey.originalImage] as? UIImage

let editedImage = info[UIImagePickerController.InfoKey.editedImage] as? UIImage

if(((row as? ImagePickerProtocol)?.useEditedImage ?? false) && editedImage != nil) {
finalImage = editedImage
}

(row as? ImagePickerProtocol)?.userPickerInfo = info
row.value = finalImage
onDismissCallback?(self)
}

Expand Down

0 comments on commit 9e87f2c

Please sign in to comment.