[WIP] Topics

This commit is contained in:
Ali 2022-10-12 18:17:59 +04:00
parent 508cbc7366
commit adc94814c9
2 changed files with 11 additions and 8 deletions

View File

@ -420,10 +420,12 @@ final class MutableMessageHistoryView {
func updatePeerIds(transaction: PostboxTransaction) {
switch self.peerIds {
case let .single(peerId, _):
if let updatedData = transaction.currentUpdatedCachedPeerData[peerId] {
if updatedData.associatedHistoryMessageId != nil {
self.peerIds = .associated(peerId, updatedData.associatedHistoryMessageId)
case let .single(peerId, threadId):
if threadId == nil {
if let updatedData = transaction.currentUpdatedCachedPeerData[peerId] {
if updatedData.associatedHistoryMessageId != nil {
self.peerIds = .associated(peerId, updatedData.associatedHistoryMessageId)
}
}
}
case let .associated(peerId, associatedId):

View File

@ -4725,10 +4725,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
self.reportIrrelvantGeoNoticePromise.set(.single(nil))
let replyThreadType: ChatTitleContent.ReplyThreadType
var replyThreadId: Int64?
switch chatLocation {
case .peer:
replyThreadType = .replies
case let .replyThread(replyThreadMessage):
replyThreadId = Int64(replyThreadMessage.messageId.id)
if replyThreadMessage.isChannelPost {
replyThreadType = .comments
} else {
@ -4742,11 +4744,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
let messageAndTopic = messagePromise.get()
|> mapToSignal { message -> Signal<(message: Message?, threadData: MessageHistoryThreadData?), NoError> in
guard let message = message else {
return .single((nil, nil))
guard let replyThreadId = replyThreadId else {
return .single((message, nil))
}
let viewKey: PostboxViewKey = .messageHistoryThreadInfo(peerId: peerId, threadId: Int64(message.id.id))
let viewKey: PostboxViewKey = .messageHistoryThreadInfo(peerId: peerId, threadId: replyThreadId)
return context.account.postbox.combinedView(keys: [viewKey])
|> map { views -> (message: Message?, threadData: MessageHistoryThreadData?) in
guard let view = views.views[viewKey] as? MessageHistoryThreadInfoView else {