From dccfac308b3823097fa54ee829b95dfb0f070d40 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Wed, 16 Aug 2023 13:56:33 +0300 Subject: [PATCH] Speed up the room event string builder, bold sender names directly instead of parsing markdown --- .../Services/Room/RoomSummary/RoomEventStringBuilder.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift b/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift index 8be2a7965..e33d6f702 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/RoomEventStringBuilder.swift @@ -108,8 +108,11 @@ struct RoomEventStringBuilder { private func prefix(_ eventSummary: String, with sender: TimelineItemSender) -> AttributedString { let attributedEventSummary = AttributedString(eventSummary.trimmingCharacters(in: .whitespacesAndNewlines)) - if let senderDisplayName = sender.displayName, - let attributedSenderDisplayName = try? AttributedString(markdown: "**\(senderDisplayName)**") { + + if let senderDisplayName = sender.displayName { + var attributedSenderDisplayName = AttributedString(senderDisplayName) + attributedSenderDisplayName.bold() + // Don't include the message body in the markdown otherwise it makes tappable links. return attributedSenderDisplayName + ": " + attributedEventSummary } else {