diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m index d5217c68e..65e0d4b9a 100644 --- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m +++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m @@ -191,29 +191,29 @@ [_messageImageView startLoading]; __block LinphoneChatMessage *achat = self.message; [LinphoneManager.instance.photoLibrary assetForURL:imageUrl resultBlock:^(ALAsset *asset) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL), ^(void) { - if (achat != self.message) // Avoid glitch and scrolling - return; - - if (asset) { - [self loadAsset:asset]; - } - else { - [LinphoneManager.instance.photoLibrary - enumerateGroupsWithTypes:ALAssetsGroupAll - usingBlock:^(ALAssetsGroup *group, BOOL *stop) { - [group enumerateAssetsWithOptions:NSEnumerationReverse - usingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) { - if([result.defaultRepresentation.url isEqual:imageUrl]) { - [self loadAsset:result]; - *stop = YES; - } - }]; - } - failureBlock:^(NSError *error) { - LOGE(@"Error: Cannot load asset from photo stream - %@", [error localizedDescription]); - }]; - } - }); + if (achat != self.message) // Avoid glitch and scrolling + return; + + if (asset) { + [self loadAsset:asset]; + } + else { + [LinphoneManager.instance.photoLibrary + enumerateGroupsWithTypes:ALAssetsGroupAll + usingBlock:^(ALAssetsGroup *group, BOOL *stop) { + [group enumerateAssetsWithOptions:NSEnumerationReverse + usingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) { + if([result.defaultRepresentation.url isEqual:imageUrl]) { + [self loadAsset:result]; + *stop = YES; + } + }]; + } + failureBlock:^(NSError *error) { + LOGE(@"Error: Cannot load asset from photo stream - %@", [error localizedDescription]); + }]; + } + }); } failureBlock:^(NSError *error) { LOGE(@"Can't read image"); }]; diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index 0aabc729c..b45ce2329 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -359,12 +359,12 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 52; // 44; LOGE(@"Can't read image"); dispatch_semaphore_signal(sema); }]; - }); - dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); + }); + dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); - size = [self getMediaMessageSizefromOriginalSize:originalImageSize withWidth:width]; - //This fixes the image being too small. I think the issue comes form the fact that the display is retina. This should probably be changed in the future. - size.height += CELL_MESSAGE_X_MARGIN; + size = [self getMediaMessageSizefromOriginalSize:originalImageSize withWidth:width]; + //This fixes the image being too small. I think the issue comes form the fact that the display is retina. This should probably be changed in the future. + size.height += CELL_MESSAGE_X_MARGIN; } }