Better tab notification count -incomplete-

This commit is contained in:
Valere 2021-04-12 16:31:25 +02:00
parent 02c2fea99e
commit bfbd37074e
1 changed files with 12 additions and 6 deletions

View File

@ -32,6 +32,7 @@ import im.vector.app.features.grouplist.SelectedGroupDataSource
import im.vector.app.features.ui.UiStateRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.matrix.android.sdk.api.query.ActiveSpaceFilter
import org.matrix.android.sdk.api.query.RoomCategoryFilter
import org.matrix.android.sdk.api.session.Session
import org.matrix.android.sdk.api.session.room.model.Membership
@ -152,14 +153,18 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
}
private fun observeRoomSummaries() {
session.getPagedRoomSummariesLive(
roomSummaryQueryParams {
memberships = Membership.activeMemberships()
}
)
.asObservable()
appStateHandler.selectedSpaceDataSource.observe().distinctUntilChanged().switchMap {
session.getPagedRoomSummariesLive(
roomSummaryQueryParams {
memberships = Membership.activeMemberships()
}
).asObservable()
}
// .asObservable()
.throttleFirst(300, TimeUnit.MILLISECONDS)
.subscribe {
val activeSpace = appStateHandler.safeActiveSpaceId()
val dmInvites = session.getRoomSummaries(
roomSummaryQueryParams {
memberships = listOf(Membership.INVITE)
@ -185,6 +190,7 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
roomSummaryQueryParams {
memberships = listOf(Membership.JOIN)
roomCategoryFilter = RoomCategoryFilter.ONLY_ROOMS
activeSpaceId = ActiveSpaceFilter.ActiveSpace(activeSpace)
}
)