mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Trim newlines from message previews. (#1208)
- Fixes a bug with replies where the message shows on the line after the sender's name.
This commit is contained in:
@@ -78,12 +78,13 @@ struct RoomEventStringBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func prefix(_ eventSummary: String, with sender: TimelineItemSender) -> AttributedString {
|
func prefix(_ eventSummary: String, with sender: TimelineItemSender) -> AttributedString {
|
||||||
|
let attributedEventSummary = AttributedString(eventSummary.trimmingCharacters(in: .whitespacesAndNewlines))
|
||||||
if let senderDisplayName = sender.displayName,
|
if let senderDisplayName = sender.displayName,
|
||||||
let attributedSenderDisplayName = try? AttributedString(markdown: "**\(senderDisplayName)**") {
|
let attributedSenderDisplayName = try? AttributedString(markdown: "**\(senderDisplayName)**") {
|
||||||
// Don't include the message body in the markdown otherwise it makes tappable links.
|
// Don't include the message body in the markdown otherwise it makes tappable links.
|
||||||
return attributedSenderDisplayName + ": " + AttributedString(eventSummary)
|
return attributedSenderDisplayName + ": " + attributedEventSummary
|
||||||
} else {
|
} else {
|
||||||
return AttributedString(eventSummary)
|
return attributedEventSummary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user