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