fix share all kind of images

This commit is contained in:
Danmei Chen 2018-12-21 15:53:24 +01:00
parent 25ff201116
commit bcca4099a2
3 changed files with 6 additions and 5 deletions

View file

@ -260,7 +260,8 @@ static UICompositeViewDescription *compositeDescription = nil;
[_messageField setText:dict[@"message"]];
NSString *key = [[fileName componentsSeparatedByString:@"."] firstObject];
NSMutableDictionary <NSString *, PHAsset *> * assetDict = [LinphoneUtils photoAssetsDictionary];
if ([fileName hasSuffix:@"JPG"] || [fileName hasSuffix:@"PNG"]) {
if ([fileName hasSuffix:@"JPG"] || [fileName hasSuffix:@"PNG"] || [fileName hasSuffix:@"jpg"] || [fileName hasSuffix:@"png"]) {
PHAsset *phasset = [assetDict objectForKey:key];
if (!phasset) {
// for the images not really in the photo album
@ -269,7 +270,7 @@ static UICompositeViewDescription *compositeDescription = nil;
UIImage *image = [[UIImage alloc] initWithData:dict[@"nsData"]];
[self chooseImageQuality:image assetId:[phasset localIdentifier]];
}
} else if ([fileName hasSuffix:@"MOV"]) {
} else if ([fileName hasSuffix:@"MOV"] || [fileName hasSuffix:@"mov"]) {
[self confirmShare:dict[@"nsData"] url:nil fileName:nil assetId:[[assetDict objectForKey:key] localIdentifier]];
} else {
LOGE(@"Unable to parse file %@",fileName);

View file

@ -192,7 +192,7 @@ static const CGFloat CELL_IMAGE_X_MARGIN = 100;
}
}
else if (localFile) {
if ([localFile hasSuffix:@"JPG"] || [localFile hasSuffix:@"PNG"]) {
if ([localFile hasSuffix:@"JPG"] || [localFile hasSuffix:@"PNG"] || [localFile hasSuffix:@"jpg"] || [localFile hasSuffix:@"png"]) {
NSData *data = [NSData dataWithContentsOfURL:[VIEW(ChatConversationView) getICloudFileUrl:localFile]];
UIImage *image = [[UIImage alloc] initWithData:data];
[self loadImageAsset:nil image:image];
@ -314,7 +314,7 @@ static const CGFloat CELL_IMAGE_X_MARGIN = 100;
PHAsset *asset = [_messageImageView asset];
if (!asset) {
NSString *localFile = [LinphoneManager getMessageAppDataForKey:@"localfile" inMessage:self.message];
if ([localFile hasSuffix:@"JPG"] || [localFile hasSuffix:@"PNG"]) {
if ([localFile hasSuffix:@"JPG"] || [localFile hasSuffix:@"PNG"] || [localFile hasSuffix:@"jpg"] || [localFile hasSuffix:@"png"]) {
NSData *data = [NSData dataWithContentsOfURL:[VIEW(ChatConversationView) getICloudFileUrl:localFile]];
UIImage *image = [[UIImage alloc] initWithData:data];
if (image)

View file

@ -465,7 +465,7 @@ static const CGFloat CELL_IMAGE_X_MARGIN = 100;
}
if(localFile) {
if ([localFile hasSuffix:@"JPG"] || [localFile hasSuffix:@"PNG"]) {
if ([localFile hasSuffix:@"JPG"] || [localFile hasSuffix:@"PNG"] || [localFile hasSuffix:@"jpg"] || [localFile hasSuffix:@"png"]) {
NSData *data = [NSData dataWithContentsOfURL:[VIEW(ChatConversationView) getICloudFileUrl:localFile]];
UIImage *image = [[UIImage alloc] initWithData:data];
size = [self getMediaMessageSizefromOriginalSize:image.size withWidth:width];