mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 16:13:42 +02:00
Construct formatted body from replied event
This commit is contained in:
@@ -155,10 +155,18 @@ extension RoomDataSource {
|
||||
let editableTextMessage: NSAttributedString?
|
||||
|
||||
if event.isReply() {
|
||||
let parser = MXReplyEventParser()
|
||||
let replyEventParts = parser.parse(event)
|
||||
let body: String
|
||||
if let newContent = event.content[kMXMessageContentKeyNewContent] as? [String:Any] {
|
||||
// Use new content if available.
|
||||
body = newContent["formatted_body"] as? String ?? newContent[kMXMessageBodyKey] as? String ?? ""
|
||||
} else {
|
||||
// Otherwise parse MXReply.
|
||||
let parser = MXReplyEventParser()
|
||||
let replyEventParts = parser.parse(event)
|
||||
|
||||
body = replyEventParts?.formattedBodyParts?.replyText ?? replyEventParts?.bodyParts.replyText ?? ""
|
||||
}
|
||||
|
||||
let body: String = replyEventParts?.formattedBodyParts?.replyText ?? replyEventParts?.bodyParts.replyText ?? ""
|
||||
let attributed = eventFormatter.renderHTMLString(body, for: event, with: self.roomState, isEditMode: true)
|
||||
if let attributed = attributed, #available(iOS 15.0, *) {
|
||||
editableTextMessage = PillsFormatter.insertPills(in: attributed,
|
||||
|
||||
Reference in New Issue
Block a user