From 96f4aa3b0a968e57a679b951c1dc1a82dc1cc283 Mon Sep 17 00:00:00 2001 From: Alexander Danilov <> Date: Wed, 19 Jun 2019 09:35:20 +0300 Subject: [PATCH] remember that keyboard buttons were dismissed when reopening chat --- TelegramUI/ChatControllerNode.swift | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/TelegramUI/ChatControllerNode.swift b/TelegramUI/ChatControllerNode.swift index 8c0081c1..b90d85c9 100644 --- a/TelegramUI/ChatControllerNode.swift +++ b/TelegramUI/ChatControllerNode.swift @@ -1515,16 +1515,14 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { } func dismissInput() { - if let _ = self.chatPresentationInterfaceState.inputTextPanelState.mediaRecordingState { - return - } + guard self.chatPresentationInterfaceState.inputTextPanelState.mediaRecordingState == nil else { return } switch self.chatPresentationInterfaceState.inputMode { case .none: break default: self.interfaceInteraction?.updateInputModeAndDismissedButtonKeyboardMessageId({ state in - return (.none, state.interfaceState.messageActionsState.closedButtonKeyboardMessageId) + return (.none, state.keyboardButtonsMessage?.id ?? state.interfaceState.messageActionsState.closedButtonKeyboardMessageId) }) } self.searchNavigationNode?.deactivate() @@ -1978,14 +1976,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { if canDismiss, let inputHeight = derivedLayoutState.inputNodeHeight, currentLocation.y + (self.keyboardGestureAccessoryHeight ?? 0.0) > validLayout.size.height - inputHeight { self.upperInputPositionBound = nil - self.requestUpdateInterfaceState(.animated(duration: 0.25, curve: .spring), true, { state in - if case .none = state.inputMode { - return state - } - return state.updatedInputMode { _ in - return .none - } - }) + self.dismissInput() } else { self.upperInputPositionBound = nil self.updateLayoutInternal(transition: .animated(duration: 0.25, curve: .spring))