diff --git a/Classes/ImagePickerView.m b/Classes/ImagePickerView.m index c5ee92daf..5a9d34f50 100644 --- a/Classes/ImagePickerView.m +++ b/Classes/ImagePickerView.m @@ -20,7 +20,6 @@ #import #import #import -#import #import "ImagePickerView.h" #import "PhoneMainView.h" @@ -166,9 +165,21 @@ static UICompositeViewDescription *compositeDescription = nil; if (image == nil) { image = [info objectForKey:UIImagePickerControllerOriginalImage]; } - if (image != nil && imagePickerDelegate != nil) { - [imagePickerDelegate imagePickerDelegateImage:image info:info]; - } + if (image != nil) { + if (![info objectForKey:UIImagePickerControllerReferenceURL]) { + //Saving image. Supports picture only, no video + //Maybe add a completion target to send the saved image to, like self, and we would call it manually if the image was not taken. + UIImageWriteToSavedPhotosAlbum(image, self, @selector(savedImage:didFinishSavingWithError:contextInfo:), (__bridge void *)info); + } else { + [self savedImage:image didFinishSavingWithError:nil contextInfo:(__bridge void *)info]; + } + } +} + +- (void)savedImage:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo { + if (imagePickerDelegate != nil) { + [imagePickerDelegate imagePickerDelegateImage:image info:(__bridge NSDictionary *)contextInfo]; + } } - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index 3b8650616..4bec1a351 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -226,6 +226,7 @@ typedef struct _LinphoneManagerSounds { @property (nonatomic, assign) BOOL speakerEnabled; @property (nonatomic, assign) BOOL bluetoothAvailable; @property (nonatomic, assign) BOOL bluetoothEnabled; +@property (readonly) ALAssetsLibrary *photoLibrary; @property (readonly) NSString* contactSipField; @property (readonly,copy) NSString* contactFilter; @property (copy) void (^silentPushCompletion)(UIBackgroundFetchResult); diff --git a/Classes/LinphoneUI/Base.lproj/UIChatCell.xib b/Classes/LinphoneUI/Base.lproj/UIChatCell.xib index 1a9c2b747..638f241be 100644 --- a/Classes/LinphoneUI/Base.lproj/UIChatCell.xib +++ b/Classes/LinphoneUI/Base.lproj/UIChatCell.xib @@ -67,7 +67,7 @@ - +