Fix invisible pinned messages button actions

This commit is contained in:
Ali 2022-04-21 21:59:11 +04:00
parent 826f87b51e
commit 89abe476d9

View File

@ -1594,13 +1594,22 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
return true
}, requestMessageActionCallback: { [weak self] messageId, data, isGame, requiresPassword in
if let strongSelf = self {
guard let strongSelf = self else {
return
}
guard strongSelf.presentationInterfaceState.subject != .scheduledMessages else {
strongSelf.present(textAlertController(context: strongSelf.context, updatedPresentationData: strongSelf.updatedPresentationData, title: nil, text: strongSelf.presentationData.strings.ScheduledMessages_BotActionUnavailable, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root))
return
}
if let message = strongSelf.chatDisplayNode.historyNode.messageInCurrentHistoryView(messageId) {
let _ = (strongSelf.context.account.postbox.transaction { transaction -> Message? in
return transaction.getMessage(messageId)
}
|> deliverOnMainQueue).start(next: { message in
guard let strongSelf = self, let message = message else {
return
}
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, {
return $0.updatedTitlePanelContext {
if !$0.contains(where: {
@ -1738,8 +1747,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
proceedWithResult(result)
}))
}
}
}
})
}, requestMessageActionUrlAuth: { [weak self] defaultUrl, subject in
if let strongSelf = self {
guard strongSelf.presentationInterfaceState.subject != .scheduledMessages else {
@ -2449,9 +2457,19 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
}, openCheckoutOrReceipt: { [weak self] messageId in
if let strongSelf = self {
guard let strongSelf = self else {
return
}
strongSelf.commitPurposefulAction()
if let message = strongSelf.chatDisplayNode.historyNode.messageInCurrentHistoryView(messageId) {
let _ = (strongSelf.context.account.postbox.transaction { transaction -> Message? in
return transaction.getMessage(messageId)
}
|> deliverOnMainQueue).start(next: { message in
guard let strongSelf = self, let message = message else {
return
}
for media in message.media {
if let invoice = media as? TelegramMediaInvoice {
strongSelf.chatDisplayNode.dismissInput()
@ -2483,8 +2501,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
}
}
}
})
}, openSearch: {
}, setupReply: { [weak self] messageId in
self?.interfaceInteraction?.setupReplyMessage(messageId, { _ in })