Adding knowledge of pending space invites
This commit is contained in:
parent
0e8a2254f8
commit
c36869cd03
|
@ -185,7 +185,7 @@ class NewHomeDetailFragment :
|
|||
}
|
||||
|
||||
newHomeDetailViewModel.onEach { viewState ->
|
||||
refreshUnreadCounterBadge(viewState.spacesNotificationCount)
|
||||
refreshUnreadCounterBadge(viewState.spacesNotificationCount, viewState.hasPendingSpaceInvites)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,11 +386,21 @@ class NewHomeDetailFragment :
|
|||
}
|
||||
}
|
||||
|
||||
private fun refreshUnreadCounterBadge(roomAggregateNotificationCount: RoomAggregateNotificationCount) {
|
||||
val badgeState = UnreadCounterBadgeView.State.Count(
|
||||
count = roomAggregateNotificationCount.notificationCount,
|
||||
highlighted = roomAggregateNotificationCount.isHighlight,
|
||||
)
|
||||
private fun refreshUnreadCounterBadge(
|
||||
spacesNotificationCount: RoomAggregateNotificationCount,
|
||||
hasPendingSpaceInvites: Boolean,
|
||||
) {
|
||||
val badgeState = if (hasPendingSpaceInvites && spacesNotificationCount.notificationCount == 0) {
|
||||
UnreadCounterBadgeView.State.Text(
|
||||
text = "!",
|
||||
highlighted = true,
|
||||
)
|
||||
} else {
|
||||
UnreadCounterBadgeView.State.Count(
|
||||
count = spacesNotificationCount.notificationCount,
|
||||
highlighted = spacesNotificationCount.isHighlight,
|
||||
)
|
||||
}
|
||||
views.spacesUnreadCounterBadge.render(badgeState)
|
||||
}
|
||||
|
||||
|
|
|
@ -21,4 +21,5 @@ import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotification
|
|||
|
||||
data class NewHomeDetailViewState(
|
||||
val spacesNotificationCount: RoomAggregateNotificationCount = RoomAggregateNotificationCount(notificationCount = 0, highlightCount = 0),
|
||||
val hasPendingSpaceInvites: Boolean = false,
|
||||
) : MavericksState
|
||||
|
|
Loading…
Reference in New Issue