Pinned messages [WIP]

This commit is contained in:
Ali 2020-10-09 17:07:13 +01:00
parent a62ab933bd
commit 805152ea1e
3 changed files with 4 additions and 1 deletions

View File

@ -1138,6 +1138,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
updatedState.updateMessagesPinned(ids: messages.map { id in
MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id)
}, pinned: (flags & (1 << 0)) != 0)
updatedState.updateChannelState(peerId, pts: pts)
} else {
if !channelsToPoll.contains(peerId) {
Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) pinned messages pts hole")

View File

@ -268,6 +268,8 @@ extension Api.Update {
}
case let .updateDeleteChannelMessages(channelId, _, _, _):
return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)]
case let .updatePinnedChannelMessages(_, channelId, _, _, _):
return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)]
case let .updateNewChannelMessage(message, _, _):
return apiMessagePeerIds(message)
case let .updateEditChannelMessage(message, _, _):

View File

@ -3438,7 +3438,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if message == nil {
matches = true
} else if let topVisibleMessageRange = topVisibleMessageRange {
if entry.message.id < topVisibleMessageRange.upperBound {
if entry.message.id < topVisibleMessageRange.lowerBound {
matches = true
}
} else {