mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Indicate that a topic is closed in View as messages
This commit is contained in:
@@ -646,11 +646,13 @@ public final class Message {
|
||||
public let title: String
|
||||
public let icon: Int64?
|
||||
public let iconColor: Int32
|
||||
public let isClosed: Bool
|
||||
|
||||
public init(title: String, icon: Int64?, iconColor: Int32) {
|
||||
public init(title: String, icon: Int64?, iconColor: Int32, isClosed: Bool) {
|
||||
self.title = title
|
||||
self.icon = icon
|
||||
self.iconColor = iconColor
|
||||
self.isClosed = isClosed
|
||||
}
|
||||
|
||||
public static func ==(lhs: AssociatedThreadInfo, rhs: AssociatedThreadInfo) -> Bool {
|
||||
@@ -666,6 +668,9 @@ public final class Message {
|
||||
if lhs.iconColor != rhs.iconColor {
|
||||
return false
|
||||
}
|
||||
if lhs.isClosed != rhs.isClosed {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public let telegramPostboxSeedConfiguration: SeedConfiguration = {
|
||||
guard let data = entry.get(MessageHistoryThreadData.self) else {
|
||||
return nil
|
||||
}
|
||||
return Message.AssociatedThreadInfo(title: data.info.title, icon: data.info.icon, iconColor: data.info.iconColor)
|
||||
return Message.AssociatedThreadInfo(title: data.info.title, icon: data.info.icon, iconColor: data.info.iconColor, isClosed: data.isClosed)
|
||||
},
|
||||
decodeAutoremoveTimeout: { cachedData in
|
||||
if let cachedData = cachedData as? CachedUserData {
|
||||
|
||||
@@ -197,6 +197,15 @@ func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState
|
||||
return (panel, nil)
|
||||
}
|
||||
}
|
||||
} else if let replyMessage = chatPresentationInterfaceState.replyMessage, let threadInfo = replyMessage.associatedThreadInfo, threadInfo.isClosed {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,12 @@ final class ChatRestrictedInputPanelNode: ChatInputPanelNode {
|
||||
iconImage = PresentationResourcesChat.chatPanelLockIcon(interfaceState.theme)
|
||||
self.textNode.attributedText = NSAttributedString(string: interfaceState.strings.Chat_PanelTopicClosedText, font: Font.regular(15.0), textColor: interfaceState.theme.chat.inputPanel.secondaryTextColor)
|
||||
} else if let channel = interfaceState.renderedPeer?.peer as? TelegramChannel, channel.flags.contains(.isForum), case .peer = interfaceState.chatLocation {
|
||||
self.textNode.attributedText = NSAttributedString(string: interfaceState.strings.Chat_PanelForumModeReplyText, font: Font.regular(15.0), textColor: interfaceState.theme.chat.inputPanel.secondaryTextColor)
|
||||
if let replyMessage = interfaceState.replyMessage, let threadInfo = replyMessage.associatedThreadInfo {
|
||||
//TODO:localize
|
||||
self.textNode.attributedText = NSAttributedString(string: "Topic \"\(threadInfo.title)\" is closed", font: Font.regular(15.0), textColor: interfaceState.theme.chat.inputPanel.secondaryTextColor)
|
||||
} else {
|
||||
self.textNode.attributedText = NSAttributedString(string: interfaceState.strings.Chat_PanelForumModeReplyText, font: Font.regular(15.0), textColor: interfaceState.theme.chat.inputPanel.secondaryTextColor)
|
||||
}
|
||||
} else if let (untilDate, personal) = bannedPermission {
|
||||
if personal && untilDate != 0 && untilDate != Int32.max {
|
||||
self.textNode.attributedText = NSAttributedString(string: interfaceState.strings.Conversation_RestrictedTextTimed(stringForFullDate(timestamp: untilDate, strings: interfaceState.strings, dateTimeFormat: interfaceState.dateTimeFormat)).string, font: Font.regular(13.0), textColor: interfaceState.theme.chat.inputPanel.secondaryTextColor)
|
||||
|
||||
Reference in New Issue
Block a user