Emoji input improvements

This commit is contained in:
Ali
2022-07-15 03:37:03 +02:00
parent 0b872d86c5
commit 0577baac79
35 changed files with 1413 additions and 694 deletions

View File

@@ -1031,7 +1031,12 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
var insets: UIEdgeInsets
var inputPanelBottomInsetTerm: CGFloat = 0.0
if inputNodeForState != nil {
if let inputNodeForState = inputNodeForState {
if !self.inputPanelContainerNode.stableIsExpanded && inputNodeForState.adjustLayoutForHiddenInput {
inputNodeForState.hideInput = false
inputNodeForState.adjustLayoutForHiddenInput = false
}
insets = layout.insets(options: [])
inputPanelBottomInsetTerm = max(insets.bottom, layout.standardInputHeight)
} else {
@@ -1191,9 +1196,6 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
inputNode.hideInputUpdated = { [weak self] transition in
self?.updateInputPanelBackgroundExpansion(transition: transition)
}
inputNode.expansionFractionUpdated = { [weak self] transition in
self?.updateInputPanelBackgroundExpansion(transition: transition)
}
dismissedInputNode = self.inputNode
if let inputNode = self.inputNode {
@@ -1236,7 +1238,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
inputNodeHeightAndOverflow = (
boundedHeight,
max(0.0, inputHeight - boundedHeight)
inputNode.followsDefaultHeight ? max(0.0, inputHeight - boundedHeight) : 0.0
)
} else if let inputNode = self.inputNode {
dismissedInputNode = inputNode
@@ -2058,7 +2060,10 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
self.historyNode.verticalScrollIndicatorColor = UIColor(white: 0.5, alpha: 0.8)
let updatedInputFocus = self.chatPresentationInterfaceStateRequiresInputFocus(self.chatPresentationInterfaceState) != self.chatPresentationInterfaceStateRequiresInputFocus(chatPresentationInterfaceState)
var updatedInputFocus = self.chatPresentationInterfaceStateRequiresInputFocus(self.chatPresentationInterfaceState) != self.chatPresentationInterfaceStateRequiresInputFocus(chatPresentationInterfaceState)
if self.chatPresentationInterfaceStateInputView(self.chatPresentationInterfaceState) !== self.chatPresentationInterfaceStateInputView(chatPresentationInterfaceState) {
updatedInputFocus = true
}
let updateInputTextState = self.chatPresentationInterfaceState.interfaceState.effectiveInputState != chatPresentationInterfaceState.interfaceState.effectiveInputState
self.chatPresentationInterfaceState = chatPresentationInterfaceState
@@ -2171,18 +2176,22 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
self.navigationBar?.setContentNode(nil, animated: transitionIsAnimated)
}
var waitForKeyboardLayout = false
if let textView = self.textInputPanelNode?.textInputNode?.textView {
let updatedInputView = self.chatPresentationInterfaceStateInputView(chatPresentationInterfaceState)
if textView.inputView !== updatedInputView {
textView.inputView = updatedInputView
if textView.isFirstResponder {
if self.chatPresentationInterfaceStateRequiresInputFocus(chatPresentationInterfaceState) {
waitForKeyboardLayout = true
}
textView.reloadInputViews()
}
}
}
if updatedInputFocus {
if !self.ignoreUpdateHeight {
if !self.ignoreUpdateHeight && !waitForKeyboardLayout {
self.scheduleLayoutTransitionRequest(layoutTransition)
}