From 25813dc15ff5bb6edb0daecf4e7e71859327df70 Mon Sep 17 00:00:00 2001 From: "benoit.martins" Date: Mon, 29 May 2023 16:05:00 +0200 Subject: [PATCH] Fix crash when receive message with multiple media Fix presence latestActivityTimestamp --- Classes/Swift/Chat/Views/ChatConversationViewSwift.swift | 3 +-- Classes/Swift/Chat/Views/MultilineMessageCell.swift | 8 +++++--- Podfile | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift b/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift index f6a6c465a..75288fe4e 100644 --- a/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift +++ b/Classes/Swift/Chat/Views/ChatConversationViewSwift.swift @@ -548,7 +548,7 @@ class ChatConversationViewSwift: BackActionsNavigationView, PHPickerViewControll var hasPresence : Bool? = false if friend?.address?.asStringUriOnly() != nil { - presenceModel = friend!.getPresenceModelForUriOrTel(uriOrTel: (friend?.address?.asStringUriOnly())!) + presenceModel = friend!.presenceModel hasPresence = presenceModel != nil && presenceModel!.basicStatus == PresenceBasicStatus.Open } @@ -559,7 +559,6 @@ class ChatConversationViewSwift: BackActionsNavigationView, PHPickerViewControll let timeInterval = TimeInterval(presenceModel!.latestActivityTimestamp) let myNSDate = Date(timeIntervalSince1970: timeInterval) - if timeInterval == -1 { participantsGroupLabel.text = VoipTexts.chat_room_presence_away; } else if Calendar.current.isDateInToday(myNSDate) { diff --git a/Classes/Swift/Chat/Views/MultilineMessageCell.swift b/Classes/Swift/Chat/Views/MultilineMessageCell.swift index cf7f8ea03..b43e6e03a 100644 --- a/Classes/Swift/Chat/Views/MultilineMessageCell.swift +++ b/Classes/Swift/Chat/Views/MultilineMessageCell.swift @@ -950,6 +950,9 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource, collectionViewImagesGrid.isHidden = false NSLayoutConstraint.activate(imagesGridConstraints) + imageViewBubble.image = nil + NSLayoutConstraint.deactivate(imageConstraints) + imageViewBubble.isHidden = true } if (event.chatMessage?.isOutgoing == true && content.isFileTransfer && event.chatMessage?.isFileTransferInProgress == true) { @@ -1238,7 +1241,7 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource, imageViewBubble.isHidden = true } } else { - if content.filePath == "" { + if content.filePath == "" && content.isFileTransfer == false { imagesGridCollectionView.append(SwiftUtil.textToImage(drawText: "Error", inImage: UIImage(named: "file_default")!, forReplyBubble: true)) collectionViewImagesGrid.reloadData() @@ -1598,8 +1601,7 @@ class MultilineMessageCell: SwipeCollectionViewCell, UICollectionViewDataSource, }else{ let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cellImagesGridMessage", for: indexPath) let indexPathWithoutNil = indexPath.row + imagesGridCollectionViewNil - print("indexPathWithoutNilindexPathWithoutNil \(indexPathWithoutNil) \(chatMessage?.contents[indexPathWithoutNil])") - if ((indexPathWithoutNil <= (imagesGridCollectionView.count) - 1) && (imagesGridCollectionView[indexPathWithoutNil] != nil) && (chatMessage?.contents[indexPathWithoutNil].isFile == true || chatMessage?.contents[indexPathWithoutNil].isFileTransfer == true)) { + if ((indexPathWithoutNil <= imagesGridCollectionView.count - 1) && (imagesGridCollectionView[indexPathWithoutNil] != nil) && (chatMessage?.contents[indexPathWithoutNil].isFile == true || chatMessage?.contents[indexPathWithoutNil].isFileTransfer == true)) { let viewCell: UIView = UIView(frame: cell.contentView.frame) cell.addSubview(viewCell) if (chatMessage?.isOutgoing == false && (chatMessage?.contents[indexPathWithoutNil].filePath == "" || chatMessage?.contents[indexPathWithoutNil].isFileTransfer == true)) { diff --git a/Podfile b/Podfile index 4353935a4..114a2a8e0 100644 --- a/Podfile +++ b/Podfile @@ -5,7 +5,7 @@ source "https://github.com/CocoaPods/Specs.git" def all_pods if ENV['PODFILE_PATH'].nil? - pod 'linphone-sdk', '~>5.2.52-pre.2' + pod 'linphone-sdk', '~>5.2.65-pre.2' else pod 'linphone-sdk', :path => ENV['PODFILE_PATH'] # local sdk end