mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various Improvements
This commit is contained in:
@@ -196,6 +196,7 @@ public final class TextSelectionNode: ASDisplayNode {
|
||||
private let strings: PresentationStrings
|
||||
private let textNode: TextNode
|
||||
private let updateIsActive: (Bool) -> Void
|
||||
public var updateRange: ((NSRange?) -> Void)?
|
||||
private let present: (ViewController, Any?) -> Void
|
||||
private weak var rootNode: ASDisplayNode?
|
||||
private let performAction: (NSAttributedString, TextSelectionAction) -> Void
|
||||
@@ -396,6 +397,8 @@ public final class TextSelectionNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
private func updateSelection(range: NSRange?, animateIn: Bool) {
|
||||
self.updateRange?(range)
|
||||
|
||||
var rects: (rects: [CGRect], start: TextRangeRectEdge, end: TextRangeRectEdge)?
|
||||
|
||||
if let range = range {
|
||||
@@ -502,18 +505,18 @@ public final class TextSelectionNode: ASDisplayNode {
|
||||
self?.performAction(attributedText, .lookup)
|
||||
self?.dismissSelection()
|
||||
}))
|
||||
// if #available(iOS 15.0, *) {
|
||||
// actions.append(ContextMenuAction(content: .text(title: self.strings.Conversation_ContextMenuTranslate, accessibilityLabel: self.strings.Conversation_ContextMenuTranslate), action: { [weak self] in
|
||||
// self?.performAction(attributedText, .translate)
|
||||
// self?.dismissSelection()
|
||||
// }))
|
||||
// }
|
||||
if isSpeakSelectionEnabled() {
|
||||
actions.append(ContextMenuAction(content: .text(title: self.strings.Conversation_ContextMenuSpeak, accessibilityLabel: self.strings.Conversation_ContextMenuSpeak), action: { [weak self] in
|
||||
self?.performAction(attributedText, .speak)
|
||||
if #available(iOS 15.0, *) {
|
||||
actions.append(ContextMenuAction(content: .text(title: self.strings.Conversation_ContextMenuTranslate, accessibilityLabel: self.strings.Conversation_ContextMenuTranslate), action: { [weak self] in
|
||||
self?.performAction(attributedText, .translate)
|
||||
self?.dismissSelection()
|
||||
}))
|
||||
}
|
||||
// if isSpeakSelectionEnabled() {
|
||||
// actions.append(ContextMenuAction(content: .text(title: self.strings.Conversation_ContextMenuSpeak, accessibilityLabel: self.strings.Conversation_ContextMenuSpeak), action: { [weak self] in
|
||||
// self?.performAction(attributedText, .speak)
|
||||
// self?.dismissSelection()
|
||||
// }))
|
||||
// }
|
||||
actions.append(ContextMenuAction(content: .text(title: self.strings.Conversation_ContextMenuShare, accessibilityLabel: self.strings.Conversation_ContextMenuShare), action: { [weak self] in
|
||||
self?.performAction(attributedText, .share)
|
||||
self?.dismissSelection()
|
||||
|
||||
Reference in New Issue
Block a user