Comments [WIP]

This commit is contained in:
Ali 2020-09-25 19:16:19 +04:00
parent 6a0d0c1481
commit 933e1f788f
7 changed files with 4441 additions and 4427 deletions

View File

@ -5806,3 +5806,7 @@ Any member of this group will be able to see messages in the channel.";
"Conversation.ContextMenuBlock" = "Block User";
"Replies.BlockAndDeleteRepliesActionTitle" = "Block and Delete Replies";
"Channel.CommentsGroup.Header" = "Select a group chat that will be used to host comments from your channel.";
"Channel.CommentsGroup.HeaderSet" = "%@ is selected as the group that will be used to host comments for your channel.";
"Channel.CommentsGroup.HeaderGroupSet" = "%@ is linking the group as it's discussion board.";

View File

@ -136,12 +136,12 @@ private enum ChannelDiscussionGroupSetupControllerEntry: ItemListNodeEntry {
let text: String
if let title = title {
if isGroup {
text = presentationData.strings.Channel_DiscussionGroup_HeaderGroupSet(title).0
text = presentationData.strings.Channel_CommentsGroup_HeaderGroupSet(title).0
} else {
text = presentationData.strings.Channel_DiscussionGroup_HeaderSet(title).0
text = presentationData.strings.Channel_CommentsGroup_HeaderSet(title).0
}
} else {
text = ""
text = presentationData.strings.Channel_CommentsGroup_Header
}
return ChatListFilterSettingsHeaderItem(theme: presentationData.theme, text: text, animation: .discussionGroupSetup, sectionId: self.section)
case let .create(theme, text):

View File

@ -132,9 +132,9 @@ class ChannelDiscussionGroupSetupHeaderItemNode: ListViewItemNode {
let bold = MarkdownAttributeSet(font: titleBoldFont, textColor: item.theme.list.sectionHeaderTextColor)
let string: NSAttributedString
if let title = item.title {
string = addAttributesToStringWithRanges(item.isGroup ? item.strings.Channel_DiscussionGroup_HeaderGroupSet(title) : item.strings.Channel_DiscussionGroup_HeaderSet(title), body: body, argumentAttributes: [0: bold])
string = addAttributesToStringWithRanges(item.isGroup ? item.strings.Channel_CommentsGroup_HeaderGroupSet(title) : item.strings.Channel_CommentsGroup_HeaderSet(title), body: body, argumentAttributes: [0: bold])
} else {
string = NSAttributedString(string: item.strings.Channel_DiscussionGroup_Header, font: titleFont, textColor: item.theme.list.sectionHeaderTextColor)
string = NSAttributedString(string: item.strings.Channel_CommentsGroup_Header, font: titleFont, textColor: item.theme.list.sectionHeaderTextColor)
}
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: string, backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: params.width - params.leftInset - params.rightInset - 20.0, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))

View File

@ -6089,6 +6089,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if let currentButton = self.rightNavigationButton?.action, currentButton == button.action {
animated = false
}
if case .replyThread = self.chatLocation {
animated = false
}
self.navigationItem.setRightBarButton(button.buttonItem, animated: animated)
self.rightNavigationButton = button
}

View File

@ -1366,7 +1366,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePrevewItemNode
string = rank.trimmingEmojis
}
adminBadgeString = NSAttributedString(string: " \(string)", font: inlineBotPrefixFont, textColor: messageTheme.secondaryTextColor)
} else if authorIsChannel {
} else if authorIsChannel, case .peer = item.chatLocation {
adminBadgeString = NSAttributedString(string: " \(item.presentationData.strings.Channel_Status)", font: inlineBotPrefixFont, textColor: messageTheme.secondaryTextColor)
}
if let authorNameString = authorNameString, let authorNameColor = authorNameColor, let inlineBotNameString = inlineBotNameString {