Don't send interactive dice in secret chats

This commit is contained in:
Ilya Laktyushin 2020-03-25 23:28:48 +04:00
parent eb4105cc36
commit 055dfe503c

View File

@ -2241,7 +2241,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
var messages: [EnqueueMessage] = [] var messages: [EnqueueMessage] = []
let effectiveInputText = effectivePresentationInterfaceState.interfaceState.composeInputState.inputText let effectiveInputText = effectivePresentationInterfaceState.interfaceState.composeInputState.inputText
if effectiveInputText.string.trimmingCharacters(in: .whitespacesAndNewlines) == "🎲" { if case let .peer(peerId) = effectivePresentationInterfaceState.chatLocation, peerId.namespace != Namespaces.Peer.SecretChat, effectiveInputText.string.trimmingCharacters(in: .whitespacesAndNewlines) == "🎲" {
messages.append(.message(text: "", attributes: [], mediaReference: AnyMediaReference.standalone(media: TelegramMediaDice()), replyToMessageId: self.chatPresentationInterfaceState.interfaceState.replyMessageId, localGroupingKey: nil)) messages.append(.message(text: "", attributes: [], mediaReference: AnyMediaReference.standalone(media: TelegramMediaDice()), replyToMessageId: self.chatPresentationInterfaceState.interfaceState.replyMessageId, localGroupingKey: nil))
} else { } else {
let inputText = convertMarkdownToAttributes(effectiveInputText) let inputText = convertMarkdownToAttributes(effectiveInputText)