Simplify solution based on pr feedback

This commit is contained in:
Michael Telatynski 2022-04-12 14:43:26 +01:00
parent 7a721a4d1d
commit fd3bbabec5

View file

@ -54,8 +54,8 @@ import org.matrix.android.sdk.api.session.group.groupSummaryQueryParams
import org.matrix.android.sdk.api.session.room.RoomSortOrder import org.matrix.android.sdk.api.session.room.RoomSortOrder
import org.matrix.android.sdk.api.session.room.accountdata.RoomAccountDataTypes import org.matrix.android.sdk.api.session.room.accountdata.RoomAccountDataTypes
import org.matrix.android.sdk.api.session.room.model.Membership import org.matrix.android.sdk.api.session.room.model.Membership
import org.matrix.android.sdk.api.session.room.model.RoomType
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
import org.matrix.android.sdk.api.session.room.spaceSummaryQueryParams
import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotificationCount import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotificationCount
import org.matrix.android.sdk.api.session.space.SpaceOrderUtils import org.matrix.android.sdk.api.session.space.SpaceOrderUtils
import org.matrix.android.sdk.api.session.space.model.SpaceOrderContent import org.matrix.android.sdk.api.session.space.model.SpaceOrderContent
@ -273,10 +273,9 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
} }
private fun observeSpaceSummaries() { private fun observeSpaceSummaries() {
val spaceSummaryQueryParams = roomSummaryQueryParams { val params = spaceSummaryQueryParams {
memberships = listOf(Membership.JOIN, Membership.INVITE) memberships = listOf(Membership.JOIN, Membership.INVITE)
displayName = QueryStringValue.IsNotEmpty displayName = QueryStringValue.IsNotEmpty
includeType = listOf(RoomType.SPACE)
} }
val flowSession = session.flow() val flowSession = session.flow()
@ -288,7 +287,7 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
it.getOrNull() it.getOrNull()
}, },
flowSession flowSession
.liveSpaceSummaries(spaceSummaryQueryParams), .liveSpaceSummaries(params),
session session
.accountDataService() .accountDataService()
.getLiveRoomAccountDataEvents(setOf(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER)) .getLiveRoomAccountDataEvents(setOf(RoomAccountDataTypes.EVENT_TYPE_SPACE_ORDER))