Cleanup and comment

This commit is contained in:
Benoit Marty 2021-07-19 19:03:41 +02:00
parent 5990e5a52b
commit ac2f1ee7fe
2 changed files with 10 additions and 4 deletions

View file

@ -86,6 +86,7 @@ class RoomListSectionBuilderGroup(
it.activeGroupId = actualGroupId
}
}
addSection(
sections,
activeGroupAwareQueries,
@ -111,6 +112,7 @@ class RoomListSectionBuilderGroup(
}.also {
onDisposable.invoke(it)
}
return sections
}
@ -257,6 +259,7 @@ class RoomListSectionBuilderGroup(
}.also {
onDisposable.invoke(it)
}
sections.add(
RoomsSection(
sectionName = name,

View file

@ -70,12 +70,15 @@ class RoomListSectionBuilderSpace(
val activeSpaceAwareQueries = mutableListOf<RoomListViewModel.ActiveSpaceQueryUpdater>()
when (mode) {
RoomListDisplayMode.PEOPLE -> {
// 4 sections Invites / Fav / Dms / Low Priority
buildDmSections(sections, activeSpaceAwareQueries)
}
RoomListDisplayMode.ROOMS -> {
// 6 sections invites / Fav / Rooms / Low Priority / Server notice / Suggested rooms
buildRoomsSections(sections, activeSpaceAwareQueries)
}
RoomListDisplayMode.FILTERED -> {
// Used when searching for rooms
withQueryParams(
{
it.memberships = Membership.activeMemberships()
@ -140,7 +143,8 @@ class RoomListSectionBuilderSpace(
return sections
}
private fun buildRoomsSections(sections: MutableList<RoomsSection>, activeSpaceAwareQueries: MutableList<RoomListViewModel.ActiveSpaceQueryUpdater>) {
private fun buildRoomsSections(sections: MutableList<RoomsSection>,
activeSpaceAwareQueries: MutableList<RoomListViewModel.ActiveSpaceQueryUpdater>) {
if (autoAcceptInvites.showInvites()) {
addSection(
sections = sections,
@ -259,7 +263,8 @@ class RoomListSectionBuilderSpace(
)
}
private fun buildDmSections(sections: MutableList<RoomsSection>, activeSpaceAwareQueries: MutableList<RoomListViewModel.ActiveSpaceQueryUpdater>) {
private fun buildDmSections(sections: MutableList<RoomsSection>,
activeSpaceAwareQueries: MutableList<RoomListViewModel.ActiveSpaceQueryUpdater>) {
if (autoAcceptInvites.showInvites()) {
addSection(
sections = sections,
@ -321,7 +326,6 @@ class RoomListSectionBuilderSpace(
withQueryParams(
{ query.invoke(it) },
{ roomQueryParams ->
val name = stringProvider.getString(nameRes)
session.getFilteredPagedRoomSummariesLive(
roomQueryParams.process(spaceFilterStrategy, appStateHandler.safeActiveSpaceId()),
@ -364,7 +368,6 @@ class RoomListSectionBuilderSpace(
}
}.livePagedList
.let { livePagedList ->
// use it also as a source to update count
livePagedList.asObservable()
.observeOn(Schedulers.computation())