Adopt the new latest event API. (#4779)

This commit is contained in:
Doug
2025-11-25 11:52:48 +00:00
committed by GitHub
parent 08514917fe
commit f2607affd2
23 changed files with 321 additions and 139 deletions
@@ -6,7 +6,8 @@
// Please see LICENSE files in the repository root for full details.
//
import UIKit
import MatrixRustSDK
import SwiftUI
struct TimelineItemSender: Identifiable, Hashable {
static let test = TimelineItemSender(id: "@test.matrix.org")
@@ -22,6 +23,21 @@ struct TimelineItemSender: Identifiable, Hashable {
self.isDisplayNameAmbiguous = isDisplayNameAmbiguous
self.avatarURL = avatarURL
}
init(senderID: String, senderProfile: ProfileDetails) {
switch senderProfile {
case let .ready(displayName, isDisplayNameAmbiguous, avatarUrl):
self.init(id: senderID,
displayName: displayName,
isDisplayNameAmbiguous: isDisplayNameAmbiguous,
avatarURL: avatarUrl.flatMap(URL.init(string:)))
default:
self.init(id: senderID,
displayName: nil,
isDisplayNameAmbiguous: false,
avatarURL: nil)
}
}
var disambiguatedDisplayName: String? {
guard let displayName else {