Commit efe51762 authored by Valere's avatar Valere
Browse files

rename activeSpaceId to activeSpaceFilter

parent 50687030
......@@ -210,7 +210,7 @@ class SpaceCreationTest : InstrumentedTest {
val childCount = bobSession.getRoomSummaries(
roomSummaryQueryParams {
activeSpaceId = ActiveSpaceFilter.ActiveSpace(spaceId)
activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(spaceId)
}
).size
......
......@@ -248,7 +248,7 @@ class SpaceHierarchyTest : InstrumentedTest {
Thread.sleep(2_000)
val orphansUpdate = session.getRoomSummaries(roomSummaryQueryParams {
activeSpaceId = ActiveSpaceFilter.ActiveSpace(null)
activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null)
})
assertEquals("Unexpected number of orphan rooms ${orphansUpdate.map { it.name }}", 2, orphansUpdate.size)
}
......
......@@ -58,7 +58,7 @@ data class RoomSummaryQueryParams(
val roomTagQueryFilter: RoomTagQueryFilter?,
val excludeType: List<String?>?,
val includeType: List<String?>?,
val activeSpaceId: ActiveSpaceFilter?,
val activeSpaceFilter: ActiveSpaceFilter?,
var activeGroupId: String? = null
) {
......@@ -72,7 +72,7 @@ data class RoomSummaryQueryParams(
var roomTagQueryFilter: RoomTagQueryFilter? = null
var excludeType: List<String?>? = listOf(RoomType.SPACE)
var includeType: List<String?>? = null
var activeSpaceId: ActiveSpaceFilter = ActiveSpaceFilter.None
var activeSpaceFilter: ActiveSpaceFilter = ActiveSpaceFilter.None
var activeGroupId: String? = null
fun build() = RoomSummaryQueryParams(
......@@ -84,7 +84,7 @@ data class RoomSummaryQueryParams(
roomTagQueryFilter = roomTagQueryFilter,
excludeType = excludeType,
includeType = includeType,
activeSpaceId = activeSpaceId,
activeSpaceFilter = activeSpaceFilter,
activeGroupId = activeGroupId
)
}
......
......@@ -282,19 +282,19 @@ internal class RoomSummaryDataSource @Inject constructor(@SessionDatabase privat
}
// Timber.w("VAL: activeSpaceId : ${queryParams.activeSpaceId}")
when (queryParams.activeSpaceId) {
when (queryParams.activeSpaceFilter) {
is ActiveSpaceFilter.ActiveSpace -> {
// It's annoying but for now realm java does not support querying in primitive list :/
// https://github.com/realm/realm-java/issues/5361
if (queryParams.activeSpaceId.currentSpaceId == null) {
if (queryParams.activeSpaceFilter.currentSpaceId == null) {
// orphan rooms
query.isNull(RoomSummaryEntityFields.FLATTEN_PARENT_IDS)
} else {
query.contains(RoomSummaryEntityFields.FLATTEN_PARENT_IDS, queryParams.activeSpaceId.currentSpaceId)
query.contains(RoomSummaryEntityFields.FLATTEN_PARENT_IDS, queryParams.activeSpaceFilter.currentSpaceId)
}
}
is ActiveSpaceFilter.ExcludeSpace -> {
query.not().contains(RoomSummaryEntityFields.FLATTEN_PARENT_IDS, queryParams.activeSpaceId.spaceId)
query.not().contains(RoomSummaryEntityFields.FLATTEN_PARENT_IDS, queryParams.activeSpaceFilter.spaceId)
}
else -> {
// nop
......
......@@ -171,7 +171,7 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
roomSummaryQueryParams {
memberships = listOf(Membership.INVITE)
roomCategoryFilter = RoomCategoryFilter.ONLY_DM
activeSpaceId = activeSpaceRoomId?.let { ActiveSpaceFilter.ActiveSpace(it) } ?: ActiveSpaceFilter.None
activeSpaceFilter = activeSpaceRoomId?.let { ActiveSpaceFilter.ActiveSpace(it) } ?: ActiveSpaceFilter.None
}
).size
......@@ -179,7 +179,7 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
roomSummaryQueryParams {
memberships = listOf(Membership.INVITE)
roomCategoryFilter = RoomCategoryFilter.ONLY_ROOMS
activeSpaceId = ActiveSpaceFilter.ActiveSpace(groupingMethod.spaceSummary?.roomId)
activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(groupingMethod.spaceSummary?.roomId)
}
).size
......@@ -187,7 +187,7 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
roomSummaryQueryParams {
memberships = listOf(Membership.JOIN)
roomCategoryFilter = RoomCategoryFilter.ONLY_DM
activeSpaceId = activeSpaceRoomId?.let { ActiveSpaceFilter.ActiveSpace(it) } ?: ActiveSpaceFilter.None
activeSpaceFilter = activeSpaceRoomId?.let { ActiveSpaceFilter.ActiveSpace(it) } ?: ActiveSpaceFilter.None
}
)
......@@ -195,7 +195,7 @@ class HomeDetailViewModel @AssistedInject constructor(@Assisted initialState: Ho
roomSummaryQueryParams {
memberships = listOf(Membership.JOIN)
roomCategoryFilter = RoomCategoryFilter.ONLY_ROOMS
activeSpaceId = ActiveSpaceFilter.ActiveSpace(groupingMethod.spaceSummary?.roomId)
activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(groupingMethod.spaceSummary?.roomId)
}
)
......
......@@ -79,7 +79,7 @@ class UnreadMessagesSharedViewModel @AssistedInject constructor(@Assisted initia
session.getPagedRoomSummariesLive(
roomSummaryQueryParams {
this.memberships = listOf(Membership.JOIN)
this.activeSpaceId = ActiveSpaceFilter.ActiveSpace(null)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null)
}, sortOrder = RoomSortOrder.NONE
).asObservable()
.throttleFirst(300, TimeUnit.MILLISECONDS)
......@@ -87,13 +87,13 @@ class UnreadMessagesSharedViewModel @AssistedInject constructor(@Assisted initia
val counts = session.getNotificationCountForRooms(
roomSummaryQueryParams {
this.memberships = listOf(Membership.JOIN)
this.activeSpaceId = ActiveSpaceFilter.ActiveSpace(null)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null)
}
)
val invites = session.getRoomSummaries(
roomSummaryQueryParams {
this.memberships = listOf(Membership.INVITE)
this.activeSpaceId = ActiveSpaceFilter.ActiveSpace(null)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null)
}
).size
copy(
......@@ -129,7 +129,7 @@ class UnreadMessagesSharedViewModel @AssistedInject constructor(@Assisted initia
val counts = session.getNotificationCountForRooms(
roomSummaryQueryParams {
this.memberships = listOf(Membership.JOIN)
this.activeSpaceId = ActiveSpaceFilter.ActiveSpace(null)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null)
}
)
val rootCounts = session.spaceService().getRootSpaceSummaries()
......
......@@ -282,7 +282,7 @@ class SpaceRoomListSectionBuilder(
override fun updateForSpaceId(roomId: String?) {
it.updateQuery {
it.copy(
activeSpaceId = ActiveSpaceFilter.ActiveSpace(roomId)
activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(roomId)
)
}
}
......@@ -294,13 +294,13 @@ class SpaceRoomListSectionBuilder(
if (roomId != null) {
it.updateQuery {
it.copy(
activeSpaceId = ActiveSpaceFilter.ActiveSpace(roomId)
activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(roomId)
)
}
} else {
it.updateQuery {
it.copy(
activeSpaceId = ActiveSpaceFilter.None
activeSpaceFilter = ActiveSpaceFilter.None
)
}
}
......@@ -351,7 +351,7 @@ class SpaceRoomListSectionBuilder(
return when (spaceFilter) {
RoomListViewModel.SpaceFilterStrategy.NORMAL -> {
copy(
activeSpaceId = ActiveSpaceFilter.ActiveSpace(currentSpace)
activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(currentSpace)
)
}
RoomListViewModel.SpaceFilterStrategy.NOT_IF_ALL -> {
......@@ -359,7 +359,7 @@ class SpaceRoomListSectionBuilder(
this
} else {
copy(
activeSpaceId = ActiveSpaceFilter.ActiveSpace(currentSpace)
activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(currentSpace)
)
}
}
......
......@@ -111,7 +111,7 @@ class SpacesListViewModel @AssistedInject constructor(@Assisted initialState: Sp
session.getPagedRoomSummariesLive(
roomSummaryQueryParams {
this.memberships = listOf(Membership.JOIN)
this.activeSpaceId = ActiveSpaceFilter.ActiveSpace(null)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null)
}, sortOrder = RoomSortOrder.NONE
).asObservable()
.throttleFirst(300, TimeUnit.MILLISECONDS)
......@@ -120,7 +120,7 @@ class SpacesListViewModel @AssistedInject constructor(@Assisted initialState: Sp
val counts = session.getNotificationCountForRooms(
roomSummaryQueryParams {
this.memberships = listOf(Membership.JOIN)
this.activeSpaceId = ActiveSpaceFilter.ActiveSpace(null)
this.activeSpaceFilter = ActiveSpaceFilter.ActiveSpace(null)
}
)
setState {
......
......@@ -60,7 +60,7 @@ class SpaceAddRoomsViewModel @AssistedInject constructor(
this.memberships = listOf(Membership.JOIN)
this.excludeType = null
this.includeType = listOf(RoomType.SPACE)
this.activeSpaceId = ActiveSpaceFilter.ExcludeSpace(initialState.spaceId)
this.activeSpaceFilter = ActiveSpaceFilter.ExcludeSpace(initialState.spaceId)
this.displayName = QueryStringValue.Contains(initialState.currentFilter, QueryStringValue.Case.INSENSITIVE)
},
pagedListConfig = PagedList.Config.Builder()
......@@ -80,7 +80,7 @@ class SpaceAddRoomsViewModel @AssistedInject constructor(
this.excludeType = listOf(RoomType.SPACE)
this.includeType = null
this.roomCategoryFilter = RoomCategoryFilter.ONLY_ROOMS
this.activeSpaceId = ActiveSpaceFilter.ExcludeSpace(initialState.spaceId)
this.activeSpaceFilter = ActiveSpaceFilter.ExcludeSpace(initialState.spaceId)
this.displayName = QueryStringValue.Contains(initialState.currentFilter, QueryStringValue.Case.INSENSITIVE)
},
pagedListConfig = PagedList.Config.Builder()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment