diff --git a/Classes/LinphoneManager.h b/Classes/LinphoneManager.h index a986a04c7..e6df3db59 100644 --- a/Classes/LinphoneManager.h +++ b/Classes/LinphoneManager.h @@ -157,6 +157,7 @@ typedef struct _LinphoneManagerSounds { - (void)configureVbrCodecs; + (BOOL)copyFile:(NSString*)src destination:(NSString*)dst override:(BOOL)override; ++ (PHFetchResult *)getPHAssets:(NSString *)key; + (NSString*)bundleFile:(NSString*)file; + (NSString*)documentFile:(NSString*)file; + (NSString*)cacheDirectory; diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index fa225a499..b326b52e0 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -2844,6 +2844,16 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { } #pragma mark - Misc Functions ++ (PHFetchResult *)getPHAssets:(NSString *)key { + PHFetchResult *assets; + if ([key hasPrefix:@"assets-library"]) { + // compability with previous linphone version + assets = [PHAsset fetchAssetsWithALAssetURLs:@[[NSURL URLWithString:key]] options:nil]; + } else { + assets = [PHAsset fetchAssetsWithLocalIdentifiers:[NSArray arrayWithObject:key] options:nil]; + } + return assets; +} + (NSString *)bundleFile:(NSString *)file { return [[NSBundle mainBundle] pathForResource:[file stringByDeletingPathExtension] ofType:[file pathExtension]]; diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m index e3ab512e7..07dd7152f 100644 --- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m +++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m @@ -215,7 +215,7 @@ - (void)loadFirstImage:(NSString *)key type:(PHAssetMediaType)type { [_messageImageView startLoading]; - PHFetchResult *assets = [PHAsset fetchAssetsWithLocalIdentifiers:[NSArray arrayWithObject:key] options:nil]; + PHFetchResult *assets = [LinphoneManager getPHAssets:key]; UIImage *img = nil; img = [chatTableView.imagesInChatroom objectForKey:key]; diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index 12dcb811d..b7aa3eaf4 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -333,7 +333,8 @@ [_chatRoomDelegate startImageUpload:img assetId:localImage withQuality:(uploadQuality ? [uploadQuality floatValue] : 0.9)]; }); } else { - PHFetchResult *assets = [PHAsset fetchAssetsWithLocalIdentifiers:[NSArray arrayWithObject:localImage] options:nil]; + PHFetchResult *assets = [LinphoneManager getPHAssets:localImage]; + if (![assets firstObject]) return; PHAsset *asset = [assets firstObject]; @@ -505,7 +506,7 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 44; // 44; } PHFetchResult *assets; if(localImage) - assets = [PHAsset fetchAssetsWithLocalIdentifiers:[NSArray arrayWithObject:localImage] options:nil]; + assets = [LinphoneManager getPHAssets:localImage]; else assets = [PHAsset fetchAssetsWithLocalIdentifiers:[NSArray arrayWithObject:localVideo] options:nil]; if (![assets firstObject]) {