mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Fact check
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import Foundation
|
||||
import TelegramCore
|
||||
import FactCheckAlertController
|
||||
|
||||
extension ChatControllerImpl {
|
||||
func openEditMessageFactCheck(messageId: EngineMessage.Id) {
|
||||
guard let message = self.chatDisplayNode.historyNode.messageInCurrentHistoryView(messageId) else {
|
||||
return
|
||||
}
|
||||
var currentText: String = ""
|
||||
var currentEntities: [MessageTextEntity] = []
|
||||
for attribute in message.attributes {
|
||||
if let attribute = attribute as? FactCheckMessageAttribute, case let .Loaded(text, entities, _) = attribute.content {
|
||||
currentText = text
|
||||
currentEntities = entities
|
||||
break
|
||||
}
|
||||
}
|
||||
let controller = factCheckAlertController(context: self.context, updatedPresentationData: self.updatedPresentationData, value: currentText, entities: currentEntities, characterLimit: 4096, apply: { [weak self] text, entities in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let _ = self.context.engine.messages.editMessageFactCheck(messageId: messageId, text: text, entities: entities).startStandalone()
|
||||
})
|
||||
self.present(controller, in: .window(.root))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user