Cherry-pick various improvements

This commit is contained in:
Ilya Laktyushin
2023-01-08 01:37:02 +04:00
parent bd974e8521
commit 415182b4d2
52 changed files with 1287 additions and 253 deletions

View File

@@ -1506,14 +1506,21 @@ public class AttachmentTextInputPanelNode: ASDisplayNode, TGCaptionPanelView, AS
return UIMenu(children: actions)
}
private var currentSpeechHolder: SpeechSynthesizerHolder?
@objc func _accessibilitySpeak(_ sender: Any) {
var text = ""
self.interfaceInteraction?.updateTextInputStateAndMode { current, inputMode in
text = current.inputText.attributedSubstring(from: NSMakeRange(current.selectionRange.lowerBound, current.selectionRange.count)).string
return (current, inputMode)
}
let _ = speakText(context: self.context, text: text)
if let speechHolder = speakText(context: self.context, text: text) {
speechHolder.completion = { [weak self, weak speechHolder] in
if let strongSelf = self, strongSelf.currentSpeechHolder == speechHolder {
strongSelf.currentSpeechHolder = nil
}
}
self.currentSpeechHolder = speechHolder
}
if #available(iOS 13.0, *) {
UIMenuController.shared.hideMenu()
} else {