mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
[WIP] Topics
This commit is contained in:
@@ -500,10 +500,24 @@ func _internal_loadMessageHistoryThreads(accountPeerId: PeerId, postbox: Postbox
|
||||
transaction.replaceMessageTagSummary(peerId: peerId, threadId: Int64(id), tagMask: .unseenPersonalMessage, namespace: Namespaces.Message.Cloud, count: unreadMentionsCount, maxId: topMessage)
|
||||
transaction.replaceMessageTagSummary(peerId: peerId, threadId: Int64(id), tagMask: .unseenReaction, namespace: Namespaces.Message.Cloud, count: unreadReactionsCount, maxId: topMessage)
|
||||
|
||||
if topMessage != 0 {
|
||||
transaction.removeHole(peerId: peerId, threadId: Int64(id), namespace: Namespaces.Message.Cloud, space: .everywhere, range: topMessage ... (Int32.max - 1))
|
||||
}
|
||||
|
||||
var topTimestamp = date
|
||||
for message in addedMessages {
|
||||
if message.id.peerId == peerId && message.threadId == Int64(id) {
|
||||
topTimestamp = max(topTimestamp, message.timestamp)
|
||||
|
||||
if case let .Id(messageId) = message.id {
|
||||
for media in message.media {
|
||||
if let action = media as? TelegramMediaAction {
|
||||
if case .topicCreated = action.action {
|
||||
transaction.removeHole(peerId: messageId.peerId, threadId: Int64(id), namespace: Namespaces.Message.Cloud, space: .everywhere, range: 1 ... messageId.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,10 +534,12 @@ func _internal_loadMessageHistoryThreads(accountPeerId: PeerId, postbox: Postbox
|
||||
}
|
||||
}
|
||||
|
||||
if let pinnedId = pinnedId {
|
||||
transaction.setPeerPinnedThreads(peerId: peerId, threadIds: [pinnedId])
|
||||
} else {
|
||||
transaction.setPeerPinnedThreads(peerId: peerId, threadIds: [])
|
||||
if offsetIndex != nil {
|
||||
if let pinnedId = pinnedId {
|
||||
transaction.setPeerPinnedThreads(peerId: peerId, threadIds: [pinnedId])
|
||||
} else {
|
||||
transaction.setPeerPinnedThreads(peerId: peerId, threadIds: [])
|
||||
}
|
||||
}
|
||||
|
||||
var nextIndex: StoredPeerThreadCombinedState.Index
|
||||
|
||||
@@ -3027,6 +3027,8 @@ func replayFinalState(
|
||||
for media in message.media {
|
||||
if let action = media as? TelegramMediaAction {
|
||||
switch action.action {
|
||||
case .topicCreated:
|
||||
transaction.removeHole(peerId: id.peerId, threadId: threadId, namespace: Namespaces.Message.Cloud, space: .everywhere, range: 1 ... id.id)
|
||||
case let .topicEdited(components):
|
||||
if let initialData = transaction.getMessageHistoryThreadInfo(peerId: id.peerId, threadId: threadId)?.data.get(MessageHistoryThreadData.self) {
|
||||
var data = initialData
|
||||
@@ -3038,7 +3040,7 @@ func replayFinalState(
|
||||
case let .iconFileId(fileId):
|
||||
data.info = EngineMessageHistoryThread.Info(title: data.info.title, icon: fileId == 0 ? nil : fileId, iconColor: data.info.iconColor)
|
||||
case let .isClosed(isClosed):
|
||||
let _ = isClosed
|
||||
data.isClosed = isClosed
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user