mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-25 20:50:47 +00:00
Various fixes
This commit is contained in:
parent
0401bc8ef1
commit
b6db0715d0
@ -109,6 +109,7 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
|||||||
|
|
||||||
public var onInteractionUpdated: (Bool) -> Void = { _ in }
|
public var onInteractionUpdated: (Bool) -> Void = { _ in }
|
||||||
public var edgePreviewUpdated: (Bool) -> Void = { _ in }
|
public var edgePreviewUpdated: (Bool) -> Void = { _ in }
|
||||||
|
public var onTextEditingEnded: (Bool) -> Void = { _ in }
|
||||||
|
|
||||||
private let hapticFeedback = HapticFeedback()
|
private let hapticFeedback = HapticFeedback()
|
||||||
|
|
||||||
|
@ -3078,6 +3078,11 @@ public final class DrawingToolsInteraction {
|
|||||||
self.onInteractionUpdated(isInteracting)
|
self.onInteractionUpdated(isInteracting)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.entitiesView.onTextEditingEnded = { [weak self] reset in
|
||||||
|
if let self {
|
||||||
|
self.onTextEditingEnded(reset)
|
||||||
|
}
|
||||||
|
}
|
||||||
self.entitiesView.requestedMenuForEntityView = { [weak self] entityView, isTopmost in
|
self.entitiesView.requestedMenuForEntityView = { [weak self] entityView, isTopmost in
|
||||||
guard let self, let node = self.getControllerNode() else {
|
guard let self, let node = self.getControllerNode() else {
|
||||||
return
|
return
|
||||||
@ -3267,7 +3272,6 @@ public final class DrawingToolsInteraction {
|
|||||||
public func endTextEditing(reset: Bool) {
|
public func endTextEditing(reset: Bool) {
|
||||||
if let entityView = self.entitiesView.selectedEntityView as? DrawingTextEntityView {
|
if let entityView = self.entitiesView.selectedEntityView as? DrawingTextEntityView {
|
||||||
entityView.endEditing(reset: reset)
|
entityView.endEditing(reset: reset)
|
||||||
self.onTextEditingEnded(reset)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,6 +357,8 @@ public final class DrawingTextEntityView: DrawingEntityView, UITextViewDelegate
|
|||||||
selectionView.alpha = 1.0
|
selectionView.alpha = 1.0
|
||||||
selectionView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
selectionView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parentView.onTextEditingEnded(reset)
|
||||||
}
|
}
|
||||||
|
|
||||||
func suspendEditing() {
|
func suspendEditing() {
|
||||||
|
@ -1273,27 +1273,8 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate, Ch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recognizer.waitForTouchUp = { [weak self] in
|
recognizer.waitForTouchUp = {
|
||||||
guard let strongSelf = self, let textInputNode = strongSelf.textInputNode else {
|
return true
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if textInputNode.textView.isFirstResponder {
|
|
||||||
return true
|
|
||||||
} else if let (_, _, _, bottomInset, _, _, metrics, _, _) = strongSelf.validLayout {
|
|
||||||
let textFieldWaitsForTouchUp: Bool
|
|
||||||
if case .regular = metrics.widthClass, bottomInset.isZero {
|
|
||||||
textFieldWaitsForTouchUp = true
|
|
||||||
} else if !textInputNode.textView.text.isEmpty {
|
|
||||||
textFieldWaitsForTouchUp = true
|
|
||||||
} else {
|
|
||||||
textFieldWaitsForTouchUp = false
|
|
||||||
}
|
|
||||||
|
|
||||||
return textFieldWaitsForTouchUp
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
textInputNode.view.addGestureRecognizer(recognizer)
|
textInputNode.view.addGestureRecognizer(recognizer)
|
||||||
self.touchDownGestureRecognizer = recognizer
|
self.touchDownGestureRecognizer = recognizer
|
||||||
@ -4086,6 +4067,10 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate, Ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.inputMenu.activate()
|
self.inputMenu.activate()
|
||||||
|
|
||||||
|
if let touchDownGestureRecognizer = self.touchDownGestureRecognizer {
|
||||||
|
self.textInputNode?.view.addGestureRecognizer(touchDownGestureRecognizer)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func editableTextNodeDidBeginEditing(_ editableTextNode: ASEditableTextNode) {
|
@objc func editableTextNodeDidBeginEditing(_ editableTextNode: ASEditableTextNode) {
|
||||||
@ -4120,6 +4105,10 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate, Ch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let touchDownGestureRecognizer = self.touchDownGestureRecognizer {
|
||||||
|
self.textInputNode?.view.removeGestureRecognizer(touchDownGestureRecognizer)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func editableTextNodeDidFinishEditing(_ editableTextNode: ASEditableTextNode) {
|
func editableTextNodeDidFinishEditing(_ editableTextNode: ASEditableTextNode) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user