Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remember that button keyboard was dismissed when reopening chat #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions TelegramUI/ChatControllerNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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))
Expand Down