mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Bot forums v2
This commit is contained in:
@@ -81,23 +81,6 @@ extension ChatControllerImpl {
|
||||
}
|
||||
}
|
||||
|
||||
struct HistoryNodeData: Equatable {
|
||||
let chatLocation: ChatLocation
|
||||
let chatLocationContextHolder: Atomic<ChatLocationContextHolder?>
|
||||
|
||||
init(chatLocation: ChatLocation, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>) {
|
||||
self.chatLocation = chatLocation
|
||||
self.chatLocationContextHolder = chatLocationContextHolder
|
||||
}
|
||||
|
||||
static func ==(lhs: HistoryNodeData, rhs: HistoryNodeData) -> Bool {
|
||||
if lhs.chatLocation != rhs.chatLocation {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
struct State {
|
||||
var peerView: PeerView?
|
||||
var threadInfo: EngineMessageHistoryThread.Info?
|
||||
@@ -161,8 +144,6 @@ extension ChatControllerImpl {
|
||||
var removePaidMessageFeeData: ChatPresentationInterfaceState.RemovePaidMessageFeeData?
|
||||
|
||||
var preloadNextChatPeerId: EnginePeer.Id?
|
||||
|
||||
var historyNodeData: HistoryNodeData?
|
||||
}
|
||||
|
||||
private let presentationData: PresentationData
|
||||
@@ -578,16 +559,6 @@ extension ChatControllerImpl {
|
||||
} else {
|
||||
strongSelf.state.chatTitleContent = .custom(channel.debugDisplayTitle, nil, true)
|
||||
}
|
||||
} else if let channel = peer as? TelegramChannel, let linkedBotId = channel.linkedBotId, let mainPeer = peerView.peers[linkedBotId] {
|
||||
strongSelf.state.chatTitleContent = .peer(peerView: ChatTitleContent.PeerData(
|
||||
peerId: mainPeer.id,
|
||||
peer: mainPeer,
|
||||
isContact: false,
|
||||
isSavedMessages: false,
|
||||
notificationSettings: nil,
|
||||
peerPresences: [:],
|
||||
cachedData: nil
|
||||
), customTitle: nil, customSubtitle: nil, onlineMemberCount: (nil, nil), isScheduledMessages: false, isMuted: nil, customMessageCount: nil, isEnabled: true)
|
||||
} else {
|
||||
strongSelf.state.chatTitleContent = .peer(peerView: ChatTitleContent.PeerData(peerView: peerView), customTitle: nil, customSubtitle: nil, onlineMemberCount: onlineMemberCount, isScheduledMessages: isScheduledMessages, isMuted: nil, customMessageCount: nil, isEnabled: hasPeerInfo)
|
||||
|
||||
@@ -835,13 +806,6 @@ extension ChatControllerImpl {
|
||||
}
|
||||
disallowedGifts = cachedData.disallowedGifts
|
||||
}
|
||||
|
||||
if chatLocation.threadId == nil, case let .known(value) = cachedData.linkedBotChannelId, let value, chatLocation.peerId != value {
|
||||
strongSelf.state.historyNodeData = HistoryNodeData(
|
||||
chatLocation: .peer(id: value),
|
||||
chatLocationContextHolder: Atomic(value: nil)
|
||||
)
|
||||
}
|
||||
} else if let cachedData = peerView.cachedData as? CachedGroupData {
|
||||
var invitedBy: Peer?
|
||||
if let invitedByPeerId = cachedData.invitedBy {
|
||||
@@ -1462,10 +1426,9 @@ extension ChatControllerImpl {
|
||||
|
||||
var customMessageCount: Int?
|
||||
var customSubtitle: String?
|
||||
customSubtitle = nil
|
||||
if let peer = peerView.peers[peerView.peerId] as? TelegramChannel {
|
||||
if peer.isMonoForum {
|
||||
} else if peer.linkedBotId != nil {
|
||||
customSubtitle = strongSelf.presentationData.strings.Bot_GenericBotStatus
|
||||
} else {
|
||||
customMessageCount = savedMessagesPeer?.messageCount ?? 0
|
||||
}
|
||||
@@ -1561,8 +1524,8 @@ extension ChatControllerImpl {
|
||||
|
||||
if let threadInfo = messageAndTopic.threadData?.info {
|
||||
var customSubtitle: String?
|
||||
if messageAndTopic.messageCount == 0, let peer = peerView.peers[peerView.peerId] as? TelegramChannel {
|
||||
if peer.linkedBotId != nil {
|
||||
if messageAndTopic.messageCount == 0, let peer = peerView.peers[peerView.peerId] as? TelegramUser {
|
||||
if peer.isForum {
|
||||
//TODO:localize
|
||||
customSubtitle = "topic"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user