Use the room heroes when computing a DM avatar. (#2900)

* Use room heroes for DM avatar content ID.

* Use RoomAvatar.heroes for the DM Details stack.
This commit is contained in:
Doug
2024-06-19 11:27:10 +01:00
committed by GitHub
parent 17d96b0f4b
commit 834260c144
55 changed files with 524 additions and 198 deletions
@@ -15,6 +15,7 @@
//
import Combine
import Compound
import SwiftUI
@MainActor
@@ -27,11 +28,9 @@ struct HomeScreenInviteCell: View {
var body: some View {
HStack(alignment: .top, spacing: 16) {
if dynamicTypeSize < .accessibility3 {
LoadableAvatarImage(url: room.avatarURL,
name: title,
contentID: room.id,
avatarSize: .custom(52),
imageProvider: context.imageProvider)
RoomAvatarImage(avatar: room.avatar,
avatarSize: .custom(52),
imageProvider: context.imageProvider)
.dynamicTypeSize(dynamicTypeSize < .accessibility1 ? dynamicTypeSize : .accessibility1)
.accessibilityHidden(true)
}
@@ -48,8 +47,8 @@ struct HomeScreenInviteCell: View {
.padding(.top, 12)
.padding(.leading, 16)
.onTapGesture {
if let roomId = room.roomId {
context.send(viewAction: .selectRoom(roomIdentifier: roomId))
if let roomID = room.roomID {
context.send(viewAction: .selectRoom(roomIdentifier: roomID))
}
}
}
@@ -214,6 +213,7 @@ private extension HomeScreenRoom {
name: "Some Guy",
isDirect: true,
avatarURL: nil,
heroes: [.init(userID: "@someone:somewhere.com")],
lastMessage: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0,
@@ -240,6 +240,7 @@ private extension HomeScreenRoom {
name: "Awesome Room",
isDirect: false,
avatarURL: avatarURL,
heroes: [.init(userID: "@someone:somewhere.com")],
lastMessage: nil,
lastMessageFormattedTimestamp: nil,
unreadMessagesCount: 0,