Fix refreshData when chat room has no message

This commit is contained in:
Benoit Martins 2023-04-21 13:54:58 +02:00 committed by QuentinArguillere
parent 8b69f58442
commit 2c87421757

View file

@ -122,7 +122,9 @@ class ChatConversationTableViewSwift: UIViewController, UICollectionViewDataSour
if (ChatConversationTableViewModel.sharedModel.getNBMessages() > 1){
let isDisplayingBottomOfTable = collectionView.contentOffset.y <= 20
if isDisplayingBottomOfTable {
if ChatConversationTableViewModel.sharedModel.getNBMessages() < 4 {
collectionView.reloadData()
} else if isDisplayingBottomOfTable {
self.collectionView.scrollToItem(at: IndexPath(item: 1, section: 0), at: .top, animated: false)
collectionView.reloadData()
self.scrollToBottom(animated: true)