mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Reply rendering (#861)
* Cleanup how we use message timeline items in preparation for rich reply rendering * Expose reply details up to the UI level * Render replies in the timeline (textual for now). Remove now unused AttributedStringBuilderComponent isReply flag. * Move reply detail loading to when the item appears instead of when it's created. * Fix unit tests * Fetch event details also when the reply details are in the error state * Tweaks following code review * Localise emote bodies * Fix replies not loading sometimes, use the current event identifier instead of the one being replied to
This commit is contained in:
@@ -428,6 +428,19 @@ class RoomProxy: RoomProxyProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func fetchDetails(for eventID: String) {
|
||||
Task {
|
||||
await Task.dispatch(on: .global()) {
|
||||
do {
|
||||
MXLog.info("Fetching event details for \(eventID)")
|
||||
try self.room.fetchEventDetails(eventId: eventID)
|
||||
} catch {
|
||||
MXLog.error("Failed fetching event details for \(eventID) with error: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
/// Force the timeline to load member details so it can populate sender profiles whenever we add a timeline listener
|
||||
|
||||
@@ -102,6 +102,8 @@ protocol RoomProxyProtocol {
|
||||
func rejectInvitation() async -> Result<Void, RoomProxyError>
|
||||
|
||||
func acceptInvitation() async -> Result<Void, RoomProxyError>
|
||||
|
||||
func fetchDetails(for eventID: String)
|
||||
}
|
||||
|
||||
extension RoomProxyProtocol {
|
||||
|
||||
@@ -45,7 +45,7 @@ struct RoomEventStringBuilder {
|
||||
// Message types that don't need a prefix.
|
||||
case .emote(content: let content):
|
||||
let senderDisplayName = sender.displayName ?? sender.id
|
||||
return AttributedString("* \(senderDisplayName) \(content.body)")
|
||||
return AttributedString(L10n.commonEmote(senderDisplayName, content.body))
|
||||
// Message types that should be prefixed with the sender's name.
|
||||
case .image:
|
||||
message = L10n.commonImage
|
||||
|
||||
Reference in New Issue
Block a user