mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various Fixes
This commit is contained in:
parent
f604462390
commit
ee54a4a403
@ -82,7 +82,7 @@ private enum Knob {
|
||||
case right
|
||||
}
|
||||
|
||||
private final class RecognizedTextSelectionGetureRecognizer: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
||||
private final class RecognizedTextSelectionGestureRecognizer: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
||||
private var longTapTimer: Timer?
|
||||
private var movingKnob: (Knob, CGPoint, CGPoint)?
|
||||
private var currentLocation: CGPoint?
|
||||
@ -225,7 +225,7 @@ public final class RecognizedTextSelectionNode: ASDisplayNode {
|
||||
|
||||
public let highlightAreaNode: ASDisplayNode
|
||||
|
||||
private var recognizer: RecognizedTextSelectionGetureRecognizer?
|
||||
private var recognizer: RecognizedTextSelectionGestureRecognizer?
|
||||
|
||||
public init(size: CGSize, theme: RecognizedTextSelectionTheme, strings: PresentationStrings, recognitions: [RecognizedContent], updateIsActive: @escaping (Bool) -> Void, present: @escaping (ViewController, Any?) -> Void, rootNode: ASDisplayNode, performAction: @escaping (String, RecognizedTextSelectionAction) -> Void) {
|
||||
self.size = size
|
||||
@ -286,7 +286,7 @@ public final class RecognizedTextSelectionNode: ASDisplayNode {
|
||||
return self?.hitTest(point, with: event)
|
||||
}
|
||||
|
||||
let recognizer = RecognizedTextSelectionGetureRecognizer(target: nil, action: nil)
|
||||
let recognizer = RecognizedTextSelectionGestureRecognizer(target: nil, action: nil)
|
||||
recognizer.knobAtPoint = { [weak self] point in
|
||||
return self?.knobAtPoint(point)
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ private enum Knob {
|
||||
case right
|
||||
}
|
||||
|
||||
private final class InstantPageTextSelectionGetureRecognizer: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
||||
private final class InstantPageTextSelectionGestureRecognizer: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
||||
private var longTapTimer: Timer?
|
||||
private var movingKnob: (Knob, CGPoint, CGPoint)?
|
||||
private var currentLocation: CGPoint?
|
||||
@ -220,7 +220,7 @@ final class InstantPageTextSelectionNode: ASDisplayNode {
|
||||
|
||||
public let highlightAreaNode: ASDisplayNode
|
||||
|
||||
private var recognizer: InstantPageTextSelectionGetureRecognizer?
|
||||
private var recognizer: InstantPageTextSelectionGestureRecognizer?
|
||||
private var displayLinkAnimator: DisplayLinkAnimator?
|
||||
|
||||
public init(theme: InstantPageTextSelectionTheme, strings: PresentationStrings, textItemAtLocation: @escaping (CGPoint) -> (InstantPageTextItem, CGPoint)?, updateIsActive: @escaping (Bool) -> Void, present: @escaping (ViewController, Any?) -> Void, rootNode: ASDisplayNode, performAction: @escaping (String, InstantPageTextSelectionAction) -> Void) {
|
||||
@ -263,7 +263,7 @@ final class InstantPageTextSelectionNode: ASDisplayNode {
|
||||
return self?.hitTest(point, with: event)
|
||||
}
|
||||
|
||||
let recognizer = InstantPageTextSelectionGetureRecognizer(target: nil, action: nil)
|
||||
let recognizer = InstantPageTextSelectionGestureRecognizer(target: nil, action: nil)
|
||||
recognizer.knobAtPoint = { [weak self] point in
|
||||
return self?.knobAtPoint(point)
|
||||
}
|
||||
|
@ -9666,6 +9666,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
var presentationInterfaceState = ChatPresentationInterfaceState(chatWallpaper: .builtin(WallpaperSettings()), theme: presentationData.theme, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameDisplayOrder: presentationData.nameDisplayOrder, limitsConfiguration: self.context.currentLimitsConfiguration.with { $0 }, fontSize: presentationData.chatFontSize, bubbleCorners: presentationData.chatBubbleCorners, accountPeerId: self.context.account.peerId, mode: .standard(previewing: false), chatLocation: .peer(PeerId(0)), subject: nil, peerNearbyData: nil, greetingData: nil, pendingUnpinnedAllMessages: false, activeGroupCallInfo: nil, hasActiveGroupCall: false, importState: nil)
|
||||
|
||||
var updateChatPresentationInterfaceStateImpl: (((ChatPresentationInterfaceState) -> ChatPresentationInterfaceState) -> Void)?
|
||||
var ensureFocusedImpl: (() -> Void)?
|
||||
|
||||
let interfaceInteraction = ChatPanelInterfaceInteraction(updateTextInputStateAndMode: { f in
|
||||
updateChatPresentationInterfaceStateImpl?({
|
||||
@ -9708,6 +9709,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
})
|
||||
})
|
||||
}
|
||||
ensureFocusedImpl?()
|
||||
updateChatPresentationInterfaceStateImpl?({
|
||||
return $0.updatedInputMode({ _ in return inputMode }).updatedInterfaceState({
|
||||
$0.withUpdatedEffectiveInputState(ChatTextInputState(inputText: $0.effectiveInputState.inputText, selectionRange: selectionRange.endIndex ..< selectionRange.endIndex))
|
||||
@ -9736,6 +9738,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
}
|
||||
}
|
||||
|
||||
ensureFocusedImpl = { [weak inputPanelNode] in
|
||||
inputPanelNode?.ensureFocused()
|
||||
}
|
||||
|
||||
return inputPanelNode
|
||||
}
|
||||
|
||||
|
@ -286,8 +286,8 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
return state
|
||||
})
|
||||
|
||||
let controller = chatTextLinkEditController(sharedContext: strongSelf.context.sharedContext, updatedPresentationData: (presentationData, .never()), account: strongSelf.context.account, text: text ?? "", link: nil, apply: { link in
|
||||
if let inputMode = inputMode, let selectionRange = selectionRange {
|
||||
let controller = chatTextLinkEditController(sharedContext: strongSelf.context.sharedContext, updatedPresentationData: (presentationData, .never()), account: strongSelf.context.account, text: text ?? "", link: nil, apply: { [weak self] link in
|
||||
if let strongSelf = self, let inputMode = inputMode, let selectionRange = selectionRange {
|
||||
if let link = link {
|
||||
strongSelf.updateChatPresentationInterfaceState(animated: true, { state in
|
||||
return state.updatedInterfaceState({
|
||||
@ -295,6 +295,9 @@ final class PeerSelectionControllerNode: ASDisplayNode {
|
||||
})
|
||||
})
|
||||
}
|
||||
if let textInputPanelNode = strongSelf.textInputPanelNode {
|
||||
textInputPanelNode.ensureFocused()
|
||||
}
|
||||
strongSelf.updateChatPresentationInterfaceState(animated: true, { state in
|
||||
return state.updatedInputMode({ _ in return inputMode }).updatedInterfaceState({
|
||||
$0.withUpdatedEffectiveInputState(ChatTextInputState(inputText: $0.effectiveInputState.inputText, selectionRange: selectionRange.endIndex ..< selectionRange.endIndex))
|
||||
|
@ -322,7 +322,7 @@ class PeerSelectionTextInputPanelNode: ChatInputPanelNode, TGCaptionPanelView, A
|
||||
}
|
||||
|
||||
public func dismissInput() {
|
||||
self.view.window?.endEditing(true)
|
||||
self.ensureUnfocused()
|
||||
}
|
||||
|
||||
public func baseHeight() -> CGFloat {
|
||||
@ -614,7 +614,7 @@ class PeerSelectionTextInputPanelNode: ChatInputPanelNode, TGCaptionPanelView, A
|
||||
}
|
||||
|
||||
if self.isCaption {
|
||||
if !(self.textInputNode?.isFirstResponder() ?? false) {
|
||||
if !self.isFocused {
|
||||
panelHeight = minimalHeight
|
||||
|
||||
transition.updateAlpha(node: self.oneLineNode, alpha: inputHasText ? 1.0 : 0.0)
|
||||
@ -942,8 +942,12 @@ class PeerSelectionTextInputPanelNode: ChatInputPanelNode, TGCaptionPanelView, A
|
||||
}
|
||||
}
|
||||
|
||||
private var imitateFocus = false
|
||||
@objc func formatAttributesLink(_ sender: Any) {
|
||||
self.inputMenu.back()
|
||||
if self.isCaption {
|
||||
self.imitateFocus = true
|
||||
}
|
||||
self.interfaceInteraction?.openLinkEditing()
|
||||
}
|
||||
|
||||
@ -1061,6 +1065,9 @@ class PeerSelectionTextInputPanelNode: ChatInputPanelNode, TGCaptionPanelView, A
|
||||
}
|
||||
|
||||
var isFocused: Bool {
|
||||
if self.imitateFocus {
|
||||
return true
|
||||
}
|
||||
return self.textInputNode?.isFirstResponder() ?? false
|
||||
}
|
||||
|
||||
@ -1069,6 +1076,8 @@ class PeerSelectionTextInputPanelNode: ChatInputPanelNode, TGCaptionPanelView, A
|
||||
}
|
||||
|
||||
func ensureFocused() {
|
||||
self.imitateFocus = false
|
||||
|
||||
if self.textInputNode == nil {
|
||||
self.loadTextInputNode()
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ private enum Knob {
|
||||
case right
|
||||
}
|
||||
|
||||
private final class TextSelectionGetureRecognizer: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
||||
private final class TextSelectionGestureRecognizer: UIGestureRecognizer, UIGestureRecognizerDelegate {
|
||||
private var longTapTimer: Timer?
|
||||
private var movingKnob: (Knob, CGPoint, CGPoint)?
|
||||
private var currentLocation: CGPoint?
|
||||
@ -207,7 +207,7 @@ public final class TextSelectionNode: ASDisplayNode {
|
||||
|
||||
public let highlightAreaNode: ASDisplayNode
|
||||
|
||||
private var recognizer: TextSelectionGetureRecognizer?
|
||||
private var recognizer: TextSelectionGestureRecognizer?
|
||||
private var displayLinkAnimator: DisplayLinkAnimator?
|
||||
|
||||
public init(theme: TextSelectionTheme, strings: PresentationStrings, textNode: TextNode, updateIsActive: @escaping (Bool) -> Void, present: @escaping (ViewController, Any?) -> Void, rootNode: ASDisplayNode, performAction: @escaping (NSAttributedString, TextSelectionAction) -> Void) {
|
||||
@ -250,7 +250,7 @@ public final class TextSelectionNode: ASDisplayNode {
|
||||
return self?.hitTest(point, with: event)
|
||||
}
|
||||
|
||||
let recognizer = TextSelectionGetureRecognizer(target: nil, action: nil)
|
||||
let recognizer = TextSelectionGestureRecognizer(target: nil, action: nil)
|
||||
recognizer.knobAtPoint = { [weak self] point in
|
||||
return self?.knobAtPoint(point)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user