mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Update read mechanic
This commit is contained in:
@@ -893,6 +893,35 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
|
||||
|
||||
strongSelf.maybeUpdateOverscrollAction(offset: offsetFromBottom)
|
||||
}
|
||||
|
||||
var maxMessage: Message?
|
||||
strongSelf.forEachVisibleMessageItemNode { itemNode in
|
||||
if let item = itemNode.item {
|
||||
var matches = false
|
||||
if itemNode.frame.maxY < strongSelf.insets.top {
|
||||
return
|
||||
}
|
||||
if itemNode.frame.minY >= strongSelf.insets.top {
|
||||
matches = true
|
||||
} else if itemNode.frame.minY >= strongSelf.insets.top - 100.0 {
|
||||
matches = true
|
||||
}
|
||||
|
||||
if matches {
|
||||
if let maxMessageValue = maxMessage {
|
||||
if maxMessageValue.index < item.message.index {
|
||||
maxMessage = item.message
|
||||
}
|
||||
} else {
|
||||
maxMessage = item.message
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let maxMessage {
|
||||
//print("read \(maxMessage.text)")
|
||||
strongSelf.updateMaxVisibleReadIncomingMessageIndex(maxMessage.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3234,7 +3263,8 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
|
||||
}
|
||||
|
||||
if let messageIndex = messageIndex {
|
||||
strongSelf.updateMaxVisibleReadIncomingMessageIndex(messageIndex)
|
||||
let _ = messageIndex
|
||||
//strongSelf.updateMaxVisibleReadIncomingMessageIndex(messageIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user