Use attributed string for thread root message

This commit is contained in:
ismailgulek
2021-12-03 00:46:55 +03:00
parent a71cf8e92c
commit 1b6735a09f
3 changed files with 6 additions and 6 deletions
@@ -188,7 +188,7 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
notificationStatus: notificationStatus)
}
private func rootMessageText(forThread thread: MXThread) -> String? {
private func rootMessageText(forThread thread: MXThread) -> NSAttributedString? {
guard let eventFormatter = eventFormatter else {
return nil
}
@@ -196,9 +196,9 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
return nil
}
let formatterError = UnsafeMutablePointer<MXKEventFormatterError>.allocate(capacity: 1)
return eventFormatter.string(from: message,
with: roomState,
error: formatterError)
return eventFormatter.attributedString(from: message,
with: roomState,
error: formatterError)
}
private func lastMessageTextAndTime(forThread thread: MXThread) -> (String?, String?) {
@@ -43,7 +43,7 @@ class ThreadTableViewCell: UITableViewCell {
rootMessageAvatarView.avatarImageView.image = nil
}
rootMessageSenderLabel.text = viewModel.rootMessageSenderDisplayName
rootMessageContentLabel.text = viewModel.rootMessageText
rootMessageContentLabel.attributedText = viewModel.rootMessageText
lastMessageTimeLabel.text = viewModel.lastMessageTime
if let summaryViewModel = viewModel.summaryViewModel {
summaryView.configure(withViewModel: summaryViewModel)
@@ -19,7 +19,7 @@ import Foundation
struct ThreadViewModel {
var rootMessageSenderAvatar: AvatarViewDataProtocol?
var rootMessageSenderDisplayName: String?
var rootMessageText: String?
var rootMessageText: NSAttributedString?
var lastMessageTime: String?
var summaryViewModel: ThreadSummaryViewModel?
var notificationStatus: ThreadNotificationStatus