@@ -219,7 +219,7 @@ final class ChatViewController: MessagesViewController {
219
219
220
220
override func scrollViewDidScroll( _ scrollView: UIScrollView ) {
221
221
super. scrollViewDidScroll ( scrollView)
222
- if state. canReadByDidScroll {
222
+ if state. isInitialMessagesWereUpdated {
223
223
updateUnreadMessages ( )
224
224
}
225
225
updateIsScrollPositionNearlyTheBottom ( )
@@ -341,7 +341,7 @@ extension ChatViewController {
341
341
viewModel. messagesUpdated
342
342
. sink { [ weak self] _ in
343
343
self ? . updateMessagesPosition ( )
344
- self ? . state. canReadByDidScroll = true
344
+ self ? . state. isInitialMessagesWereUpdated = true
345
345
self ? . updateUnreadMessages ( )
346
346
}
347
347
. store ( in: & subscriptions)
@@ -884,7 +884,7 @@ extension ChatViewController {
884
884
}
885
885
}
886
886
887
- fileprivate func markMessageFromCurrentToBottomAsRead ( ) {
887
+ fileprivate func markMessagesFromCurrentToBottomAsRead ( ) {
888
888
guard let unreadIndexes = viewModel. unreadMesaggesIndexes, !unreadIndexes. isEmpty else { return }
889
889
890
890
let visibleSections = messagesCollectionView. indexPathsForVisibleItems. map { $0. section }
@@ -910,7 +910,7 @@ extension ChatViewController {
910
910
guard let self else { return }
911
911
if viewModel. shouldScrollToBottom {
912
912
state. isScrollingToBottom = true
913
- markMessageFromCurrentToBottomAsRead ( )
913
+ markMessagesFromCurrentToBottomAsRead ( )
914
914
self . messagesCollectionView. scrollToBottom ( animated: true )
915
915
} else if let id = viewModel. unreadMessagesIds? . first {
916
916
viewModel. animationType = MessageAnimationType . none
0 commit comments