Add support for Space avatars. (#4362)

This commit is contained in:
Doug
2025-07-29 12:20:13 +01:00
committed by GitHub
parent 75bc26d20b
commit 01033cf53e
10 changed files with 97 additions and 44 deletions
@@ -69,6 +69,10 @@ extension BaseRoomInfoProxyProtocol {
return .tombstoned
}
if isSpace {
return .space(id: id, name: displayName, avatarURL: avatarURL)
}
if isDirect, avatarURL == nil, heroes.count == 1 {
return .heroes(heroes.map(UserProfileProxy.init))
}
@@ -134,6 +134,11 @@ extension RoomSummary {
return .tombstoned
}
// NOTE: The check for isSpace isn't implemented yet, waiting to see
// whether we end up with a different type for spaces in the room list.
//
// Don't forget to add a test when you remove this comment 😄
if isDirect, avatarURL == nil, heroes.count == 1 {
return .heroes(heroes)
} else {
@@ -570,7 +570,8 @@ class TimelineController: TimelineControllerProtocol {
attachments: nil)
let avatarURL: URL? = switch roomProxy.details.avatar {
case .room(_, _, let avatarURL):
case .room(_, _, let avatarURL),
.space(_, _, let avatarURL):
avatarURL
case .heroes(let userProfiles):
userProfiles.first?.avatarURL