mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 01:10:09 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
85faae8a2c
@ -806,6 +806,10 @@ public class AttachmentController: ViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deinit {
|
||||||
|
print()
|
||||||
|
}
|
||||||
|
|
||||||
public required init(coder aDecoder: NSCoder) {
|
public required init(coder aDecoder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit aa4d82d73a84429b9955401bc8bb17ea92f30555
|
Subproject commit b7460dd9572173aed1e3838f5eb33b813a1e6b31
|
||||||
@ -175,30 +175,6 @@ public func canTranslateText(context: AccountContext, text: String, showTranslat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func translateText(context: AccountContext, text: String, fromLang: String? = nil) {
|
|
||||||
guard !text.isEmpty else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if #available(iOS 15.0, *) {
|
|
||||||
let text = text.unicodeScalars.filter { !$0.properties.isEmojiPresentation }.reduce("") { $0 + String($1) }
|
|
||||||
|
|
||||||
let textView = UITextView()
|
|
||||||
textView.text = text
|
|
||||||
textView.isEditable = false
|
|
||||||
if let navigationController = context.sharedContext.mainWindow?.viewController as? NavigationController, let topController = navigationController.topViewController as? ViewController {
|
|
||||||
topController.view.addSubview(textView)
|
|
||||||
textView.selectAll(nil)
|
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
textView.removeFromSuperview()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let toLang = context.sharedContext.currentPresentationData.with { $0 }.strings.baseLanguageCode
|
|
||||||
let _ = context.engine.messages.translate(text: text, fromLang: fromLang, toLang: toLang).start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public struct TextTranslationResult: Equatable {
|
public struct TextTranslationResult: Equatable {
|
||||||
let text: String
|
let text: String
|
||||||
let detectedLanguage: String?
|
let detectedLanguage: String?
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"app": "8.6",
|
"app": "8.7",
|
||||||
"bazel": "5.1.0",
|
"bazel": "5.1.0",
|
||||||
"xcode": "13.2.1"
|
"xcode": "13.2.1"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user