Fix attach menu buttons

This commit is contained in:
Ilya Laktyushin
2023-03-10 11:07:19 +04:00
parent 8b933180d3
commit 66619d2e17

View File

@@ -12833,24 +12833,29 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
break break
case .gift: case .gift:
initialButton = .gift initialButton = .gift
case let .bot(botId, _, _): default:
for bot in attachMenuBots.reversed() { break
var peerType = peerType }
if bot.peer.id == peer.id {
peerType.insert(.sameBot) for bot in attachMenuBots.reversed() {
peerType.remove(.bot) var peerType = peerType
} if bot.peer.id == peer.id {
let button: AttachmentButtonType = .app(bot.peer, bot.shortName, bot.icons) peerType.insert(.sameBot)
if !bot.peerTypes.intersection(peerType).isEmpty { peerType.remove(.bot)
buttons.insert(button, at: 1) }
let button: AttachmentButtonType = .app(bot.peer, bot.shortName, bot.icons)
if !bot.peerTypes.intersection(peerType).isEmpty {
buttons.insert(button, at: 1)
if case let .bot(botId, _, _) = subject {
if initialButton == nil && bot.peer.id == botId { if initialButton == nil && bot.peer.id == botId {
initialButton = button initialButton = button
} }
} }
allButtons.insert(button, at: 1)
} }
allButtons.insert(button, at: 1)
} }
return (buttons, allButtons, initialButton) return (buttons, allButtons, initialButton)
} }
} else { } else {