mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
[WIP] Monoforums
This commit is contained in:
@@ -10,13 +10,7 @@ import ChatChannelSubscriberInputPanelNode
|
||||
import ChatMessageSelectionInputPanelNode
|
||||
|
||||
func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentPanel: ChatInputPanelNode?, currentSecondaryPanel: ChatInputPanelNode?, textInputPanelNode: ChatTextInputPanelNode?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> (primary: ChatInputPanelNode?, secondary: ChatInputPanelNode?) {
|
||||
var isPostSuggestions = false
|
||||
if case let .customChatContents(customChatContents) = chatPresentationInterfaceState.subject, case .postSuggestions = customChatContents.kind {
|
||||
isPostSuggestions = true
|
||||
}
|
||||
|
||||
if isPostSuggestions {
|
||||
} else if let renderedPeer = chatPresentationInterfaceState.renderedPeer, renderedPeer.peer?.restrictionText(platform: "ios", contentSettings: context.currentContentSettings.with { $0 }) != nil {
|
||||
if let renderedPeer = chatPresentationInterfaceState.renderedPeer, renderedPeer.peer?.restrictionText(platform: "ios", contentSettings: context.currentContentSettings.with { $0 }) != nil {
|
||||
return (nil, nil)
|
||||
}
|
||||
if chatPresentationInterfaceState.isNotAccessible {
|
||||
@@ -138,8 +132,7 @@ func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState
|
||||
}
|
||||
}
|
||||
|
||||
if isPostSuggestions {
|
||||
} else if chatPresentationInterfaceState.peerIsBlocked, let peer = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramUser, peer.botInfo == nil {
|
||||
if chatPresentationInterfaceState.peerIsBlocked, let peer = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramUser, peer.botInfo == nil {
|
||||
if let currentPanel = (currentPanel as? ChatUnblockInputPanelNode) ?? (currentSecondaryPanel as? ChatUnblockInputPanelNode) {
|
||||
currentPanel.interfaceInteraction = interfaceInteraction
|
||||
currentPanel.updateThemeAndStrings(theme: chatPresentationInterfaceState.theme, strings: chatPresentationInterfaceState.strings)
|
||||
@@ -154,9 +147,7 @@ func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState
|
||||
|
||||
var displayInputTextPanel = false
|
||||
|
||||
if isPostSuggestions {
|
||||
displayInputTextPanel = true
|
||||
} else if let peer = chatPresentationInterfaceState.renderedPeer?.peer {
|
||||
if let peer = chatPresentationInterfaceState.renderedPeer?.peer {
|
||||
if peer.id.isRepliesOrVerificationCodes {
|
||||
if let currentPanel = (currentPanel as? ChatChannelSubscriberInputPanelNode) ?? (currentSecondaryPanel as? ChatChannelSubscriberInputPanelNode) {
|
||||
return (currentPanel, nil)
|
||||
@@ -239,7 +230,20 @@ func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState
|
||||
}
|
||||
|
||||
if channel.flags.contains(.isMonoforum) {
|
||||
displayInputTextPanel = true
|
||||
if channel.adminRights != nil, case .peer = chatPresentationInterfaceState.chatLocation {
|
||||
displayInputTextPanel = false
|
||||
|
||||
if let currentPanel = (currentPanel as? ChatRestrictedInputPanelNode) ?? (currentSecondaryPanel as? ChatRestrictedInputPanelNode) {
|
||||
return (currentPanel, nil)
|
||||
} else {
|
||||
let panel = ChatRestrictedInputPanelNode()
|
||||
panel.context = context
|
||||
panel.interfaceInteraction = interfaceInteraction
|
||||
return (panel, nil)
|
||||
}
|
||||
} else {
|
||||
displayInputTextPanel = true
|
||||
}
|
||||
} else if channel.flags.contains(.isForum) && isMember {
|
||||
var canManage = false
|
||||
if channel.flags.contains(.isCreator) {
|
||||
@@ -418,8 +422,6 @@ func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState
|
||||
displayInputTextPanel = false
|
||||
case .quickReplyMessageInput, .businessLinkSetup:
|
||||
displayInputTextPanel = true
|
||||
case .postSuggestions:
|
||||
displayInputTextPanel = true
|
||||
}
|
||||
|
||||
if let chatHistoryState = chatPresentationInterfaceState.chatHistoryState, case .loaded(_, true) = chatHistoryState {
|
||||
|
||||
Reference in New Issue
Block a user