Comment updates

This commit is contained in:
Ali
2020-09-11 19:03:25 +01:00
parent 0fbc4f7009
commit 4b4f702883
14 changed files with 264 additions and 53 deletions

View File

@@ -113,7 +113,8 @@ func chatHistoryEntriesForView(location: ChatLocation, view: MessageHistoryView,
}
}
if case let .replyThread(messageId, isChannelPost, _) = location, !isChannelPost {
var addedThreadHead = false
if case let .replyThread(messageId, isChannelPost, _) = location, view.earlierId == nil, !view.isLoading {
loop: for entry in view.additionalData {
switch entry {
case let .message(id, message) where id == messageId:
@@ -139,8 +140,18 @@ func chatHistoryEntriesForView(location: ChatLocation, view: MessageHistoryView,
}
}
var replyCount = 0
for attribute in message.attributes {
if let attribute = attribute as? ReplyThreadMessageAttribute {
replyCount = Int(attribute.count)
}
}
addedThreadHead = true
entries.insert(.MessageEntry(message, presentationData, false, nil, selection, ChatMessageEntryAttributes(rank: adminRank, isContact: false, contentTypeHint: contentTypeHint, updatingMedia: updatingMedia[message.id])), at: 0)
if view.entries.count > 0 {
entries.insert(.ReplyCountEntry(message.index, isChannelPost, replyCount, presentationData), at: 1)
}
}
break loop
default:
@@ -190,6 +201,9 @@ func chatHistoryEntriesForView(location: ChatLocation, view: MessageHistoryView,
} else {
isEmpty = false
}
if addedThreadHead {
isEmpty = false
}
if isEmpty {
entries.removeAll()
}