Skip to content

Commit

Permalink
code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Velin92 committed Jan 22, 2025
1 parent 3566d0b commit 8d9603b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions ElementX/Sources/Other/SwiftUI/Views/AvatarHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct AvatarHeaderView<Footer: View>: View {

if let roomAlias = room.canonicalAlias {
subtitle = roomAlias
} else if case let .heroes(heroes) = room.avatar, heroes.count == 1 {
} else if room.isDirect, case let .heroes(heroes) = room.avatar, heroes.count == 1 {
subtitle = heroes[0].userID
} else {
subtitle = nil
Expand Down Expand Up @@ -200,7 +200,8 @@ struct AvatarHeaderView_Previews: PreviewProvider, TestablePreview {
avatarURL: .mockMXCAvatar),
canonicalAlias: "#test:matrix.org",
isEncrypted: true,
isPublic: true),
isPublic: true,
isDirect: false),
avatarSize: .room(on: .details),
mediaProvider: MediaProviderMock(configuration: .init())) {
HStack(spacing: 32) {
Expand Down
1 change: 1 addition & 0 deletions ElementX/Sources/Services/Room/RoomDetails.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ struct RoomDetails {
let canonicalAlias: String?
let isEncrypted: Bool
let isPublic: Bool
let isDirect: Bool
}
3 changes: 2 additions & 1 deletion ElementX/Sources/Services/Room/RoomProxyProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ extension JoinedRoomProxyProtocol {
avatar: infoPublisher.value.avatar,
canonicalAlias: infoPublisher.value.canonicalAlias,
isEncrypted: isEncrypted,
isPublic: infoPublisher.value.isPublic)
isPublic: infoPublisher.value.isPublic,
isDirect: infoPublisher.value.isDirect)
}

var isDirectOneToOneRoom: Bool {
Expand Down

0 comments on commit 8d9603b

Please sign in to comment.