Various Fixes

This commit is contained in:
Ilya Laktyushin
2022-01-14 01:56:41 +03:00
parent 1c9126971a
commit b102311660
6 changed files with 164 additions and 82 deletions

View File

@@ -618,19 +618,30 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
}
|> deliverOnMainQueue).start(next: { messages in
if let strongSelf = self, !messages.isEmpty {
var isChannel = false
enum PeerType {
case group
case channel
case bot
}
var type: PeerType = .group
for message in messages {
if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
isChannel = true
if let user = message.author?._asPeer() as? TelegramUser, user.botInfo != nil {
type = .bot
break
} else if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
type = .channel
break
}
}
let text: String
if save {
text = isChannel ? strongSelf.presentationData.strings.Conversation_CopyProtectionSavingDisabledChannel : strongSelf.presentationData.strings.Conversation_CopyProtectionSavingDisabledGroup
} else {
text = isChannel ? strongSelf.presentationData.strings.Conversation_CopyProtectionForwardingDisabledChannel : strongSelf.presentationData.strings.Conversation_CopyProtectionForwardingDisabledGroup
switch type {
case .group:
text = save ? strongSelf.presentationData.strings.Conversation_CopyProtectionSavingDisabledGroup : strongSelf.presentationData.strings.Conversation_CopyProtectionForwardingDisabledGroup
case .channel:
text = save ? strongSelf.presentationData.strings.Conversation_CopyProtectionSavingDisabledChannel : strongSelf.presentationData.strings.Conversation_CopyProtectionForwardingDisabledChannel
case .bot:
text = save ? strongSelf.presentationData.strings.Conversation_CopyProtectionSavingDisabledBot : strongSelf.presentationData.strings.Conversation_CopyProtectionForwardingDisabledBot
}
strongSelf.copyProtectionTooltipController?.dismiss()