diff --git a/Classes/Base.lproj/ChatConversationView.xib b/Classes/Base.lproj/ChatConversationView.xib index 62255dabe..e4db76e66 100644 --- a/Classes/Base.lproj/ChatConversationView.xib +++ b/Classes/Base.lproj/ChatConversationView.xib @@ -361,7 +361,7 @@ - + diff --git a/Classes/ChatConversationView.h b/Classes/ChatConversationView.h index 1a8d77309..bc4b00e93 100644 --- a/Classes/ChatConversationView.h +++ b/Classes/ChatConversationView.h @@ -49,7 +49,7 @@ @interface ChatConversationView : TPMultiLayoutViewController { + UIDocumentInteractionControllerDelegate, UISearchBarDelegate, UIImageViewDeletableDelegate,QLPreviewControllerDelegate, UICollectionViewDataSource,UICollectionViewDelegate,UIDocumentMenuDelegate,UIDocumentPickerDelegate,UITableViewDataSource, UITableViewDelegate> { OrderedDictionary *imageQualities; BOOL scrollOnGrowingEnabled; BOOL composingVisible; diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 05ec3b14c..5ee487012 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -187,6 +187,7 @@ static UICompositeViewDescription *compositeDescription = nil; [_tableController setChatRoomDelegate:self]; [_imagesCollectionView registerClass:[UIImageViewDeletable class] forCellWithReuseIdentifier:NSStringFromClass([UIImageViewDeletable class])]; [_imagesCollectionView setDataSource:self]; + [_imagesCollectionView setDelegate:self]; [_toggleSelectionButton setImage:[UIImage imageNamed:@"select_all_default.png"] forState:UIControlStateSelected]; _vrInnerView.layer.cornerRadius = 5.0f; @@ -250,12 +251,12 @@ static UICompositeViewDescription *compositeDescription = nil; animations:^{ // resizing imagesView CGRect imagesFrame = [_imagesView frame]; - imagesFrame.origin.y = [_messageView frame].origin.y - 100; - imagesFrame.size.height = 100; + imagesFrame.origin.y = [_messageView frame].origin.y - 120; + imagesFrame.size.height = 120; [_imagesView setFrame:imagesFrame]; // resizing chatTable CGRect tableViewFrame = [_tableController.tableView frame]; - tableViewFrame.size.height -= 100; + tableViewFrame.size.height -= 120; [_tableController.tableView setFrame:tableViewFrame]; [self updateFramesInclRecordingView]; } @@ -1452,14 +1453,19 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog return [_fileContext count]; } + +- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + return UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) ? CGSizeMake(60, 60) : CGSizeMake(120, 120); +} + - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { UIImageViewDeletable *imgView = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([UIImageViewDeletable class]) forIndexPath:indexPath]; CGRect imgFrame = imgView.frame; imgFrame.origin.y = 5; if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) { - imgFrame.size.height = 50; + imgFrame.size.height = 60; } else { - imgFrame.size.height = 100; + imgFrame.size.height = 120; } [imgView.image setImage:[UIImage resizeImage:[_fileContext.previewsArray objectAtIndex:[indexPath item]] withMaxWidth:imgFrame.size.width andMaxHeight:imgFrame.size.height]]; @@ -1471,7 +1477,7 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog } - (void)refreshImageDrawer { - int heightDiff = UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) ? 55 : 105; + int heightDiff = UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]) ? 65 : 125; if ([_fileContext count] == 0) { [UIView animateWithDuration:0 @@ -1560,7 +1566,7 @@ void on_chat_room_conference_alert(LinphoneChatRoom *cr, const LinphoneEventLog NSFileCoordinator *co =[[NSFileCoordinator alloc] init]; NSError *error = nil; [co coordinateReadingItemAtURL:url options:0 error:&error byAccessor:^(NSURL * _Nonnull newURL) { - UIImage *image = [ChatConversationView drawText:[newURL lastPathComponent] image:[ChatConversationView getBasicImage] textSize:10]; + UIImage *image = [UIChatBubbleTextCell getImageFromFileName:[newURL lastPathComponent]]; [_fileContext addObject:[NSData dataWithContentsOfURL:newURL] name:[newURL lastPathComponent] type:@"file" image:image]; [self refreshImageDrawer]; }]; diff --git a/Classes/KIF b/Classes/KIF deleted file mode 160000 index 99ae001ae..000000000 --- a/Classes/KIF +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 99ae001ae51f4883d189e3f77544828ec035395d diff --git a/Classes/LinphoneUI/UIChatBubblePhotoCell.m b/Classes/LinphoneUI/UIChatBubblePhotoCell.m index b5a946b01..5371c49ad 100644 --- a/Classes/LinphoneUI/UIChatBubblePhotoCell.m +++ b/Classes/LinphoneUI/UIChatBubblePhotoCell.m @@ -268,10 +268,15 @@ _playButton.hidden = YES; _fileName.hidden = _fileView.hidden = _fileButton.hidden =YES; } else { - _downloadButton.hidden = NO; + _downloadButton.hidden = YES; + UIChatContentView * contentView = [[UIChatContentView alloc] init]; + [contentView setContent:fileContent message:self.message]; + contentView.position = 0; + [_contentViews addObject:contentView]; _cancelButton.hidden = _fileTransferProgress.hidden = YES; _playButton.hidden = YES; _fileName.hidden = _fileView.hidden = _fileButton.hidden = YES; + [self layoutSubviews]; } return; } diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index f0d583b5a..67233af23 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -635,10 +635,10 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 44; NSString *localFile = [LinphoneManager getMessageAppDataForKey:@"localfile" inMessage:chat]; NSString *localVideo = [LinphoneManager getMessageAppDataForKey:@"localvideo" inMessage:chat]; NSString *filePath = [LinphoneManager getMessageAppDataForKey:@"encryptedfile" inMessage:chat]; - NSString *fileName = [NSString stringWithUTF8String:linphone_content_get_name(fileContent)]; - + NSString *fileName = fileContent ? [NSString stringWithUTF8String:linphone_content_get_name(fileContent)] : nil; + CGSize textSize = CGSizeMake(0, 0); - if (![messageText isEqualToString:@"🗻"]) { + if (![messageText isEqualToString:@"🗻"] && messageText.length > 0) { textSize = [self computeBoundingBox:messageText size:CGSizeMake(width - CELL_MESSAGE_X_MARGIN - 4, CGFLOAT_MAX) font:messageFont]; @@ -677,7 +677,7 @@ static const CGFloat CELL_MESSAGE_Y_MARGIN = 44; } else { if (!localImage && !localVideo) { //We are loading the image - CGSize baseSize = CGSizeMake(CELL_MIN_WIDTH + CELL_MESSAGE_X_MARGIN, CELL_MIN_HEIGHT + CELL_MESSAGE_Y_MARGIN + textSize.height + 20); + CGSize baseSize = CGSizeMake(120 + CELL_MESSAGE_X_MARGIN, 120 + CELL_MESSAGE_Y_MARGIN + textSize.height + (textSize.height != 0 ? 20 : 0)); if (voiceContent) { baseSize = [self addVoicePlayerToSize:baseSize withMargins:true]; } diff --git a/Classes/LinphoneUI/UIChatContentView.m b/Classes/LinphoneUI/UIChatContentView.m index 418d3a996..3b5713e94 100644 --- a/Classes/LinphoneUI/UIChatContentView.m +++ b/Classes/LinphoneUI/UIChatContentView.m @@ -31,19 +31,20 @@ if(!linphone_chat_message_is_outgoing(_message) && linphone_content_is_file_transfer(_content)) { // has not yet downloaded - UIImage *basicImage = [ChatConversationView getBasicImage]; NSString *name = [NSString stringWithUTF8String:linphone_content_get_name(content)] ; - UIImage *image = [ChatConversationView drawText:name image:basicImage textSize:25]; + UIImage *image = [UIChatBubbleTextCell getImageFromFileName:name]; [self setImage:image]; _downloadButton = [UIButton buttonWithType:UIButtonTypeCustom]; [_downloadButton addTarget:self action:@selector(onDownloadClick:) forControlEvents:UIControlEventTouchUpInside]; - _downloadButton.backgroundColor = [UIColor orangeColor]; - UIFont *boldFont = [UIFont systemFontOfSize:10]; - NSMutableAttributedString *boldText = [[NSMutableAttributedString alloc] initWithString:@"Download" attributes:@{ NSFontAttributeName : boldFont }]; + UIFont *boldFont = [UIFont systemFontOfSize:12]; + NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + paragraphStyle.alignment = NSTextAlignmentCenter; + + NSMutableAttributedString *boldText = [[NSMutableAttributedString alloc] initWithString:@"Download" attributes:@{ NSFontAttributeName : boldFont, NSParagraphStyleAttributeName:paragraphStyle,NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle) }]; [_downloadButton setAttributedTitle:boldText forState:UIControlStateNormal]; - _downloadButton.frame = CGRectMake(3, 3, 60, 30); + _downloadButton.frame = CGRectMake(0, 90, 120, 30); [self addSubview:_downloadButton]; } else { if (_filePath == NULL) { diff --git a/Classes/LinphoneUI/UIImageViewDeletable.xib b/Classes/LinphoneUI/UIImageViewDeletable.xib index 2fa5d17e1..4d0dea67a 100644 --- a/Classes/LinphoneUI/UIImageViewDeletable.xib +++ b/Classes/LinphoneUI/UIImageViewDeletable.xib @@ -1,11 +1,9 @@ - - - - + + - + @@ -17,15 +15,15 @@ - + - + + - - + diff --git a/Classes/SwiftUtil.swift b/Classes/SwiftUtil.swift index 6c9022fac..ff1701b87 100644 --- a/Classes/SwiftUtil.swift +++ b/Classes/SwiftUtil.swift @@ -33,7 +33,7 @@ import UIKit image.draw(in: CGRect(origin: CGPoint(x: size.width/2 - (image.size.width)/2,y: 15), size: image.size)) - let rect = CGRect(origin: CGPoint(x: 0,y: 70), size: size) + let rect = CGRect(origin: CGPoint(x: 0,y: 70), size: CGSize(width: size.width, height: 30)) text.draw(in: rect, withAttributes: textFontAttributes) let newImage = UIGraphicsGetImageFromCurrentImageContext()