Fix bot keyboard not showing up if text field is focused

This commit is contained in:
Ilya Laktyushin 2023-02-19 00:03:57 +04:00
parent 7c1f5b9b84
commit 76359a526e
2 changed files with 4 additions and 1 deletions

View File

@ -2508,7 +2508,9 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
} else {
if let inputPanelNode = self.inputPanelNode as? ChatTextInputPanelNode {
if inputPanelNode.isFocused {
inputPanelNode.skipPresentationInterfaceStateUpdate = true
self.context.sharedContext.mainWindow?.simulateKeyboardDismiss(transition: .animated(duration: 0.5, curve: .spring))
inputPanelNode.skipPresentationInterfaceStateUpdate = false
}
}
}

View File

@ -3235,12 +3235,13 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
self.inputMenu.activate()
}
var skipPresentationInterfaceStateUpdate = false
func editableTextNodeDidFinishEditing(_ editableTextNode: ASEditableTextNode) {
self.storedInputLanguage = editableTextNode.textInputMode.primaryLanguage
self.inputMenu.deactivate()
self.dismissedEmojiSuggestionPosition = nil
if let presentationInterfaceState = self.presentationInterfaceState {
if let presentationInterfaceState = self.presentationInterfaceState, !self.skipPresentationInterfaceStateUpdate {
if let peer = presentationInterfaceState.renderedPeer?.peer as? TelegramUser, peer.botInfo != nil, let keyboardButtonsMessage = presentationInterfaceState.keyboardButtonsMessage, let keyboardMarkup = keyboardButtonsMessage.visibleButtonKeyboardMarkup, keyboardMarkup.flags.contains(.persistent) {
self.interfaceInteraction?.updateInputModeAndDismissedButtonKeyboardMessageId { _ in
return (.inputButtons(persistent: true), nil)