Remove ActiveSpaceFilter.None

Prefer nullability for API coherency of `RoomSummaryQueryParams`
This commit is contained in:
Benoit Marty 2022-05-24 16:15:09 +02:00 committed by Benoit Marty
parent 289f27b738
commit 00809027c1
6 changed files with 8 additions and 9 deletions

View File

@ -21,7 +21,6 @@ package org.matrix.android.sdk.api.query
* @see [org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams]
*/
sealed class ActiveSpaceFilter {
object None : ActiveSpaceFilter()
data class ActiveSpace(val currentSpaceId: String?) : ActiveSpaceFilter()
data class ExcludeSpace(val spaceId: String) : ActiveSpaceFilter()
}

View File

@ -101,7 +101,7 @@ data class RoomSummaryQueryParams(
var roomTagQueryFilter: RoomTagQueryFilter? = null
var excludeType: List<String?>? = listOf(RoomType.SPACE)
var includeType: List<String?>? = null
var activeSpaceFilter: ActiveSpaceFilter = ActiveSpaceFilter.None
var activeSpaceFilter: ActiveSpaceFilter? = null
var activeGroupId: String? = null
fun build() = RoomSummaryQueryParams(

View File

@ -241,7 +241,7 @@ class HomeDetailViewModel @AssistedInject constructor(
roomSummaryQueryParams {
memberships = listOf(Membership.INVITE)
roomCategoryFilter = RoomCategoryFilter.ONLY_DM
activeSpaceFilter = activeSpaceRoomId?.let { ActiveSpaceFilter.ActiveSpace(it) } ?: ActiveSpaceFilter.None
activeSpaceFilter = activeSpaceRoomId?.let { ActiveSpaceFilter.ActiveSpace(it) }
}
).size
@ -258,7 +258,7 @@ class HomeDetailViewModel @AssistedInject constructor(
roomSummaryQueryParams {
memberships = listOf(Membership.JOIN)
roomCategoryFilter = RoomCategoryFilter.ONLY_DM
activeSpaceFilter = activeSpaceRoomId?.let { ActiveSpaceFilter.ActiveSpace(it) } ?: ActiveSpaceFilter.None
activeSpaceFilter = activeSpaceRoomId?.let { ActiveSpaceFilter.ActiveSpace(it) }
}
)

View File

@ -153,7 +153,7 @@ class UnreadMessagesSharedViewModel @AssistedInject constructor(@Assisted initia
this.memberships = listOf(Membership.JOIN)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null).takeIf {
!vectorPreferences.prefSpacesShowAllRoomInHome()
} ?: ActiveSpaceFilter.None
}
}
)

View File

@ -385,7 +385,7 @@ class RoomListSectionBuilderSpace(
)
} else {
filteredPagedRoomSummariesLive.queryParams = roomQueryParams.copy(
activeSpaceFilter = ActiveSpaceFilter.None
activeSpaceFilter = null
)
}
liveQueryParams.update { filteredPagedRoomSummariesLive.queryParams }
@ -442,7 +442,7 @@ class RoomListSectionBuilderSpace(
RoomListViewModel.SpaceFilterStrategy.ALL_IF_SPACE_NULL -> {
if (currentSpace == null) {
copy(
activeSpaceFilter = ActiveSpaceFilter.None
activeSpaceFilter = null
)
} else {
copy(

View File

@ -112,7 +112,7 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
this.memberships = listOf(Membership.JOIN)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null).takeIf {
!vectorPreferences.prefSpacesShowAllRoomInHome()
} ?: ActiveSpaceFilter.None
}
}, sortOrder = RoomSortOrder.NONE
).asFlow()
.sample(300)
@ -129,7 +129,7 @@ class SpaceListViewModel @AssistedInject constructor(@Assisted initialState: Spa
this.memberships = listOf(Membership.JOIN)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null).takeIf {
!vectorPreferences.prefSpacesShowAllRoomInHome()
} ?: ActiveSpaceFilter.None
}
}
)
val counts = RoomAggregateNotificationCount(