mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
[WIP] Monoforums
This commit is contained in:
@@ -4,6 +4,8 @@ import TelegramCore
|
||||
import AccountContext
|
||||
import ChatPresentationInterfaceState
|
||||
import ChatControllerInteraction
|
||||
import ComponentFlow
|
||||
import ChatSideTopicsPanel
|
||||
|
||||
func titlePanelForChatPresentationInterfaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentPanel: ChatTitleAccessoryPanelNode?, controllerInteraction: ChatControllerInteraction?, interfaceInteraction: ChatPanelInterfaceInteraction?, force: Bool) -> ChatTitleAccessoryPanelNode? {
|
||||
if !force, case .standard(.embedded) = chatPresentationInterfaceState.mode {
|
||||
@@ -108,7 +110,6 @@ func titlePanelForChatPresentationInterfaceState(_ chatPresentationInterfaceStat
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if let _ = chatPresentationInterfaceState.peerVerification {
|
||||
if let currentPanel = currentPanel as? ChatVerifiedPeerTitlePanelNode {
|
||||
return currentPanel
|
||||
@@ -166,6 +167,19 @@ func titlePanelForChatPresentationInterfaceState(_ chatPresentationInterfaceStat
|
||||
}
|
||||
}
|
||||
|
||||
if let channel = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramChannel, channel.flags.contains(.isForum) {
|
||||
let topicListDisplayMode = chatPresentationInterfaceState.topicListDisplayMode ?? .top
|
||||
if case .top = topicListDisplayMode, let peerId = chatPresentationInterfaceState.chatLocation.peerId {
|
||||
if let currentPanel = currentPanel as? ChatTopicListTitleAccessoryPanelNode {
|
||||
return currentPanel
|
||||
} else {
|
||||
let panel = ChatTopicListTitleAccessoryPanelNode(context: context, peerId: peerId)
|
||||
panel.interfaceInteraction = interfaceInteraction
|
||||
return panel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedContext == nil || selectedContext! <= .pinnedMessage) {
|
||||
if displayActionsPanel {
|
||||
if let currentPanel = currentPanel as? ChatReportPeerTitlePanelNode {
|
||||
@@ -231,3 +245,34 @@ func titlePanelForChatPresentationInterfaceState(_ chatPresentationInterfaceStat
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func sidePanelForChatPresentationInterfaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentPanel: AnyComponentWithIdentity<ChatSidePanelEnvironment>?, controllerInteraction: ChatControllerInteraction?, interfaceInteraction: ChatPanelInterfaceInteraction?, force: Bool) -> AnyComponentWithIdentity<ChatSidePanelEnvironment>? {
|
||||
guard let peerId = chatPresentationInterfaceState.chatLocation.peerId else {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
if let channel = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramChannel, channel.flags.contains(.isForum) {
|
||||
let topicListDisplayMode = chatPresentationInterfaceState.topicListDisplayMode ?? .top
|
||||
if case .side = topicListDisplayMode {
|
||||
return AnyComponentWithIdentity(
|
||||
id: "topics",
|
||||
component: AnyComponent(ChatSideTopicsPanel(
|
||||
context: context,
|
||||
theme: chatPresentationInterfaceState.theme,
|
||||
strings: chatPresentationInterfaceState.strings,
|
||||
peerId: peerId,
|
||||
topicId: chatPresentationInterfaceState.chatLocation.threadId,
|
||||
togglePanel: { [weak interfaceInteraction] in
|
||||
interfaceInteraction?.toggleChatSidebarMode()
|
||||
},
|
||||
updateTopicId: { [weak interfaceInteraction] topicId in
|
||||
interfaceInteraction?.updateChatLocationThread(topicId)
|
||||
}
|
||||
))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user