Fix room list cell highlighting issues, add unit tests

This commit is contained in:
Stefan Ceriu
2024-02-08 10:08:20 +02:00
parent 60ba71c727
commit d7a190ba23
4 changed files with 243 additions and 5 deletions
@@ -197,7 +197,7 @@ extension HomeScreenRoom {
let isMentionShown = details.hasUnreadMentions && !details.isMuted
let isMuteShown = details.isMuted
let isCallShown = details.hasOngoingCall
let isHighlighted = !details.isMuted && (details.hasUnreadNotifications || details.hasUnreadMentions || details.isMarkedUnread)
let isHighlighted = details.isMarkedUnread || (!details.isMuted && (details.hasUnreadNotifications || details.hasUnreadMentions))
self.init(id: identifier,
roomId: details.id,
@@ -119,26 +119,23 @@ struct HomeScreenRoomCell: View {
HStack(spacing: 8) {
if room.badges.isCallShown {
CompoundIcon(\.videoCallSolid, size: .xSmall, relativeTo: .compound.bodySM)
.foregroundColor(room.isHighlighted ? .compound.iconAccentTertiary : .compound.iconQuaternary)
}
if room.badges.isMuteShown {
CompoundIcon(\.notificationsOffSolid, size: .custom(15), relativeTo: .compound.bodyMD)
.accessibilityLabel(L10n.a11yNotificationsMuted)
.foregroundColor(.compound.iconQuaternary)
}
if room.badges.isMentionShown {
mentionIcon
.foregroundColor(.compound.iconAccentTertiary)
}
if room.badges.isDotShown {
Circle()
.frame(width: 12, height: 12)
.foregroundColor(room.isHighlighted ? .compound.iconAccentTertiary : .compound.iconQuaternary)
}
}
.foregroundColor(room.isHighlighted ? .compound.iconAccentTertiary : .compound.iconQuaternary)
}
}