From a1e3989d0a22ef203f1cb9ecd7aaacfa65bda75c Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Wed, 12 May 2021 09:37:31 +0200 Subject: [PATCH] fix compability of display files with previous versions --- Classes/LinphoneUI/UIChatBubblePhotoCell.m | 40 ---------------------- 1 file changed, 40 deletions(-) diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m index 3c3e13e6e..7d27827aa 100644 --- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m +++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m @@ -331,48 +331,13 @@ if (_messageImageView.image == nil) { [self loadFirstImage:localImage type:PHAssetMediaTypeImage]; _imageGestureRecognizer.enabled = YES; - - dispatch_async(dispatch_get_main_queue(), ^ { - UIImage *image = [chatTableView.imagesInChatroom objectForKey:localImage]; - NSString *name = [NSString stringWithFormat:@"%li-%f.jpg", (long)image.hash, [NSDate timeIntervalSinceReferenceDate]]; - NSData *data = UIImageJPEGRepresentation(image, 1); - [ChatConversationView writeFileInCache:data name:name]; - [LinphoneManager setValueInMessageAppData:name forKey:@"localimage" inMessage:self.message]; - }); } } else if (localVideo) { if (_messageImageView.image == nil) { [self loadFirstImage:localVideo type:PHAssetMediaTypeVideo]; _imageGestureRecognizer.enabled = NO; - - dispatch_async(dispatch_get_main_queue(), ^ { - PHFetchResult *assets = [PHAsset fetchAssetsWithLocalIdentifiers:[NSArray arrayWithObject:localVideo] options:nil]; - if (![assets firstObject]) - return; - PHAsset *asset = [assets firstObject]; - if (asset.mediaType != PHAssetMediaTypeVideo) - return; - PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init]; - options.version = PHImageRequestOptionsVersionCurrent; - options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic; - - [[PHImageManager defaultManager] requestAVAssetForVideo:asset options:options resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) { - AVURLAsset *urlAsset = (AVURLAsset *)asset; - NSData *data = [NSData dataWithContentsOfURL:urlAsset.URL]; - NSString *name = [NSString stringWithFormat:@"IMG-%f.MOV", [NSDate timeIntervalSinceReferenceDate]]; - [ChatConversationView writeFileInCache:data name:name]; - [LinphoneManager setValueInMessageAppData:name forKey:@"localvideo" inMessage:self.message]; - - }]; - }); } } else if (localFile) { - dispatch_async(dispatch_get_main_queue(), ^ { - NSURL *url = [VIEW(ChatConversationView) getICloudFileUrl:localFile]; - NSData *data = [NSData dataWithContentsOfURL:url]; - [ChatConversationView writeFileInCache:data name:localFile]; - }); - if ([fileType isEqualToString:@"video"]) { UIImage* image = [UIChatBubbleTextCell getImageFromVideoUrl:[VIEW(ChatConversationView) getICloudFileUrl:localFile]]; [self loadImageAsset:nil image:image]; @@ -472,11 +437,6 @@ NSURL *url = [VIEW(ChatConversationView) getICloudFileUrl:localFile]; AVPlayer *player = [AVPlayer playerWithURL:url]; [self playVideoByPlayer:player]; - dispatch_async(dispatch_get_main_queue(), ^ { - NSData *data = [NSData dataWithContentsOfURL:url]; - [ChatConversationView writeFileInCache:data name:localFile]; - }); - return; } PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];