Files
GLEGram-iOS/submodules/TelegramUI/Sources/Chat/ChatControllerOpenMessageFactCheck.swift
T
Leeksov 4647310322 GLEGram 12.5 — Initial public release
Based on Swiftgram 12.5 (Telegram iOS 12.5).
All GLEGram features ported and organized in GLEGram/ folder.

Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass,
Font Replacement, Fake Profile, Chat Export, Plugin System, and more.

See CHANGELOG_12.5.md for full details.
2026-04-06 09:48:12 +03:00

37 lines
1.4 KiB
Swift

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,
apply: { [weak self] text, entities in
guard let self else {
return
}
if !currentText.isEmpty && text.isEmpty {
let _ = self.context.engine.messages.deleteMessageFactCheck(messageId: messageId).startStandalone()
} else {
let _ = self.context.engine.messages.editMessageFactCheck(messageId: messageId, text: text, entities: entities).startStandalone()
}
})
self.present(controller, in: .window(.root))
}
}