Fix root message redaction

This commit is contained in:
ismailgulek
2022-01-04 18:07:39 +03:00
parent c0ada7adf3
commit 30497de61c
6 changed files with 33 additions and 13 deletions

View File

@@ -187,7 +187,7 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
summaryViewModel: summaryViewModel)
}
private func rootMessageText(forThread thread: MXThread) -> String? {
private func rootMessageText(forThread thread: MXThread) -> NSAttributedString? {
guard let eventFormatter = eventFormatter else {
return nil
}
@@ -195,12 +195,12 @@ 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?) {
private func lastMessageTextAndTime(forThread thread: MXThread) -> (NSAttributedString?, String?) {
guard let eventFormatter = eventFormatter else {
return (nil, nil)
}
@@ -209,9 +209,9 @@ final class ThreadListViewModel: ThreadListViewModelProtocol {
}
let formatterError = UnsafeMutablePointer<MXKEventFormatterError>.allocate(capacity: 1)
return (
eventFormatter.string(from: message,
with: roomState,
error: formatterError),
eventFormatter.attributedString(from: message,
with: roomState,
error: formatterError),
eventFormatter.dateString(from: message, withTime: true)
)
}