Fix sending attachments from the camera.

// FREEBIE
pull/1/head
Matthew Chen 9 years ago
parent 1e3f0fffeb
commit b9705cfe06

@ -1916,6 +1916,8 @@ typedef enum : NSUInteger {
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary<NSString *, id> *)info
{
OWSAssert([NSThread isMainThread]);
[UIUtil modalCompletionBlock]();
[self resetFrame];
@ -1928,11 +1930,19 @@ typedef enum : NSUInteger {
// Video picked from library or captured with camera
NSURL *videoURL = info[UIImagePickerControllerMediaURL];
[self dismissViewControllerAnimated:YES
completion:^{
[self sendQualityAdjustedAttachmentForVideo:videoURL];
}];
} else if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) {
// Static Image captured from camera
UIImage *imageFromCamera = [info[UIImagePickerControllerOriginalImage] normalizedImage];
[self dismissViewControllerAnimated:YES
completion:^{
OWSAssert([NSThread isMainThread]);
if (imageFromCamera) {
SignalAttachment *attachment = [SignalAttachment imageAttachmentWithImage:imageFromCamera
dataUTI:(NSString *) kUTTypeJPEG];
@ -1949,6 +1959,7 @@ typedef enum : NSUInteger {
} else {
failedToPickAttachment(nil);
}
}];
} else {
// Non-Video image picked from library

Loading…
Cancel
Save