providing the muted state on the directory item
This commit is contained in:
parent
dc5a46e0cd
commit
e986b44959
|
@ -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(
|
||||||
|
|
|
@ -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),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue