diff --git a/Classes/Swift/Chat/Views/ChatConversationTableViewSwift.swift b/Classes/Swift/Chat/Views/ChatConversationTableViewSwift.swift index bbece6a92..20767a322 100644 --- a/Classes/Swift/Chat/Views/ChatConversationTableViewSwift.swift +++ b/Classes/Swift/Chat/Views/ChatConversationTableViewSwift.swift @@ -14,8 +14,6 @@ import SwipeCellKit class ChatConversationTableViewSwift: UIViewController, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, QLPreviewControllerDelegate, QLPreviewControllerDataSource, SwipeCollectionViewCellDelegate { - let controlsView = ControlsView(showVideo: true, controlsViewModel: ChatConversationTableViewModel.sharedModel) - static let compositeDescription = UICompositeViewDescription(ChatConversationTableViewSwift.self, statusBar: StatusBarView.self, tabBar: nil, sideMenu: SideMenuView.self, fullscreen: false, isLeftFragment: false,fragmentWith: nil) static func compositeViewDescription() -> UICompositeViewDescription! { return compositeDescription } diff --git a/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift b/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift index 4b0176397..a3440403e 100644 --- a/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift +++ b/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift @@ -27,8 +27,6 @@ import AVFoundation class ChatConversationViewSwift: BackActionsNavigationView, PHPickerViewControllerDelegate, UIDocumentPickerDelegate, UICompositeViewDelegate, UICollectionViewDataSource, UICollectionViewDelegate, UIImagePickerControllerDelegate, CoreDelegate & UINavigationControllerDelegate{ // Replaces ChatConversationView - let controlsView = ControlsView(showVideo: true, controlsViewModel: ChatConversationViewModel.sharedModel) - static let compositeDescription = UICompositeViewDescription(ChatConversationViewSwift.self, statusBar: StatusBarView.self, tabBar: nil, sideMenu: SideMenuView.self, fullscreen: false, isLeftFragment: false,fragmentWith: nil) static func compositeViewDescription() -> UICompositeViewDescription! { return compositeDescription } @@ -1071,11 +1069,7 @@ class ChatConversationViewSwift: BackActionsNavigationView, PHPickerViewControll if(ChatConversationViewModel.sharedModel.mediaCollectionView.count == 0){ self.messageView.fileContext = false self.selectionMedia() - if self.messageView.messageText.text.isEmpty{ - self.messageView.sendButton.isEnabled = false - } else { - self.messageView.sendButton.isEnabled = true - } + self.setSendButtonState() } self.collectionViewMedia.reloadData() } @@ -1416,7 +1410,7 @@ class ChatConversationViewSwift: BackActionsNavigationView, PHPickerViewControll } func setSendButtonState() { - self.messageView.sendButton.isEnabled = !ChatConversationViewModel.sharedModel.isVoiceRecording && ((ChatConversationViewModel.sharedModel.isPendingVoiceRecord && linphone_recorder_get_duration(ChatConversationViewModel.sharedModel.voiceRecorder?.getCobject) > 0) || self.messageView.messageText.text.count > 0 || ChatConversationViewModel.sharedModel.fileContext.count > 0) + self.messageView.sendButton.isEnabled = ((ChatConversationViewModel.sharedModel.isPendingVoiceRecord && linphone_recorder_get_duration(ChatConversationViewModel.sharedModel.voiceRecorder?.getCobject) > 0) || self.messageView.messageText.text.count > 0 || ChatConversationViewModel.sharedModel.fileContext.count > 0) } func onvrPlayPauseStop() { diff --git a/Classes/Swift/Chat/Views/MultilineMessageCell.swift b/Classes/Swift/Chat/Views/MultilineMessageCell.swift index c651c1b42..25fef441e 100644 --- a/Classes/Swift/Chat/Views/MultilineMessageCell.swift +++ b/Classes/Swift/Chat/Views/MultilineMessageCell.swift @@ -524,7 +524,7 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource, recordingWaveView.bottomAnchor.constraint(equalTo: contentMediaViewBubble.bottomAnchor, constant: labelInset.bottom), recordingWaveView.leadingAnchor.constraint(equalTo: contentMediaViewBubble.leadingAnchor, constant: labelInset.left), recordingWaveView.trailingAnchor.constraint(equalTo: contentMediaViewBubble.trailingAnchor, constant: labelInset.right), - recordingWaveImage.bottomAnchor.constraint(equalTo: recordingWaveView.bottomAnchor, constant: -12) + recordingWaveImage.centerYAnchor.constraint(equalTo: recordingWaveView.centerYAnchor) ] recordingWaveConstraintsWithMediaGrid = [ @@ -532,7 +532,7 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource, recordingWaveView.bottomAnchor.constraint(equalTo: recordingView.bottomAnchor, constant: -10), recordingWaveView.leadingAnchor.constraint(equalTo: contentMediaViewBubble.leadingAnchor, constant: labelInset.left), recordingWaveView.trailingAnchor.constraint(equalTo: contentMediaViewBubble.trailingAnchor, constant: labelInset.right), - recordingWaveImage.bottomAnchor.constraint(equalTo: recordingWaveView.bottomAnchor, constant: -7) + recordingWaveImage.centerYAnchor.constraint(equalTo: recordingWaveView.centerYAnchor) ] recordingWaveView.progressViewStyle = .bar @@ -1096,7 +1096,7 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource, } if imagesGridCollectionView.count == 0 { - imagesGridCollectionView.append(nil) + //imagesGridCollectionView.append(nil) imagesGridCollectionViewNil += 1 } @@ -1686,7 +1686,7 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource, if((linphone_core_get_max_size_for_auto_download_incoming_files(LinphoneManager.getLc()) > -1 && self.chatMessage!.isFileTransferInProgress) || self.chatMessage!.isOutgoing){ downloadView.downloadButtonLabel.isHidden = true } - } else { + } else if imagesGridCollectionView[indexPathWithoutNil] != nil { downloadContentCollection.append(nil) let myImageView = UIImageView() @@ -1723,21 +1723,23 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource, } } - if(chatMessage?.contents[indexPathWithoutNilWithRecording].type == "video"){ - var imagePlay = UIImage() - if #available(iOS 13.0, *) { - imagePlay = (UIImage(named: "vr_play")!.withTintColor(.white)) - } else { - imagePlay = UIImage(named: "vr_play")! + if(imagesGridCollectionView[indexPathWithoutNil] != nil){ + if(chatMessage?.contents[indexPathWithoutNilWithRecording].type == "video"){ + var imagePlay = UIImage() + if #available(iOS 13.0, *) { + imagePlay = (UIImage(named: "vr_play")!.withTintColor(.white)) + } else { + imagePlay = UIImage(named: "vr_play")! + } + let myImagePlayView = UIImageView(image: imagePlay) + viewCell.addSubview(myImagePlayView) + myImagePlayView.size(w: viewCell.frame.width/4, h: viewCell.frame.height/4).done() + myImagePlayView.alignHorizontalCenterWith(viewCell).alignVerticalCenterWith(viewCell).done() } - let myImagePlayView = UIImageView(image: imagePlay) - viewCell.addSubview(myImagePlayView) - myImagePlayView.size(w: viewCell.frame.width/4, h: viewCell.frame.height/4).done() - myImagePlayView.alignHorizontalCenterWith(viewCell).alignVerticalCenterWith(viewCell).done() - } - if chatMessage?.contents[indexPathWithoutNilWithRecording].filePath != "" { - viewCell.onClick { - ChatConversationTableViewModel.sharedModel.onGridClick(indexMessage: self.selfIndexMessage, index: indexPathWithoutNil) + if chatMessage?.contents[indexPathWithoutNilWithRecording].filePath != "" { + viewCell.onClick { + ChatConversationTableViewModel.sharedModel.onGridClick(indexMessage: self.selfIndexMessage, index: indexPathWithoutNil) + } } } } diff --git a/Classes/Swift/Chat/Views/UploadMessageCell.swift b/Classes/Swift/Chat/Views/UploadMessageCell.swift index 095fb7cf4..08dd313a4 100644 --- a/Classes/Swift/Chat/Views/UploadMessageCell.swift +++ b/Classes/Swift/Chat/Views/UploadMessageCell.swift @@ -17,7 +17,7 @@ class UploadMessageCell: UIView { override init(frame: CGRect) { super.init(frame: frame) - + self.layer.zPosition = 10 addSubview(circularProgressBarView) circularProgressBarView.isHidden = true circularProgressBarLabel.text = "0%" diff --git a/Classes/Utils/FileTransferDelegate.m b/Classes/Utils/FileTransferDelegate.m index b8cccb6ad..8970c5acb 100644 --- a/Classes/Utils/FileTransferDelegate.m +++ b/Classes/Utils/FileTransferDelegate.m @@ -212,7 +212,7 @@ static void file_transfer_progress_indication_send(LinphoneChatMessage *message, linphone_content_unref(content); } - BOOL basic = linphone_chat_message_get_chat_room(rootMessage); + BOOL basic = [ChatConversationViewSwift isBasicChatRoom:linphone_chat_message_get_chat_room(rootMessage)]; const LinphoneAccountParams *params = linphone_account_get_params(linphone_core_get_default_account(LC)); BOOL cpimEnabled = linphone_account_params_cpim_in_basic_chat_room_enabled(params);