providing the muted state on the directory item

This commit is contained in:
Adam Brown 2022-11-02 11:50:59 +00:00
parent dc5a46e0cd
commit e986b44959
2 changed files with 5 additions and 2 deletions

View File

@ -13,7 +13,8 @@ typealias InviteState = List<RoomInvite>
data class DirectoryItem( data class DirectoryItem(
val overview: RoomOverview, val overview: RoomOverview,
val unreadCount: UnreadCount, val unreadCount: UnreadCount,
val typing: Typing? val typing: Typing?,
val isMuted: Boolean,
) )
data class RoomOverview( data class RoomOverview(

View File

@ -24,11 +24,13 @@ internal class DirectoryUseCase(
roomStore.observeUnreadCountById(), roomStore.observeUnreadCountById(),
syncService.events() syncService.events()
) { overviewState, localEchos, unread, events -> ) { overviewState, localEchos, unread, events ->
val allMuted = roomStore.allMuted()
overviewState.mergeWithLocalEchos(localEchos, userId).map { roomOverview -> overviewState.mergeWithLocalEchos(localEchos, userId).map { roomOverview ->
DirectoryItem( DirectoryItem(
overview = roomOverview, overview = roomOverview,
unreadCount = UnreadCount(unread[roomOverview.roomId] ?: 0), unreadCount = UnreadCount(unread[roomOverview.roomId] ?: 0),
typing = events.filterIsInstance<Typing>().firstOrNull { it.roomId == roomOverview.roomId }?.engine() typing = events.filterIsInstance<Typing>().firstOrNull { it.roomId == roomOverview.roomId }?.engine(),
isMuted = allMuted.contains(roomOverview.roomId),
) )
} }
} }