fix slow paged room list
This commit is contained in:
parent
ba5828711b
commit
d67f86a1e0
|
@ -217,10 +217,15 @@ interface RoomService {
|
|||
|
||||
/**
|
||||
* TODO Doc.
|
||||
* @param getFlattenParents When true, the list of known parent and grand parent summaries will be resolved.
|
||||
* This can have significant impact on performance, better be used only on manageable list (filtered by displayName, ..).
|
||||
*/
|
||||
fun getFilteredPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams,
|
||||
pagedListConfig: PagedList.Config = defaultPagedListConfig,
|
||||
sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): UpdatableLivePageResult
|
||||
fun getFilteredPagedRoomSummariesLive(
|
||||
queryParams: RoomSummaryQueryParams,
|
||||
pagedListConfig: PagedList.Config = defaultPagedListConfig,
|
||||
sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY,
|
||||
getFlattenParents: Boolean = false,
|
||||
): UpdatableLivePageResult
|
||||
|
||||
/**
|
||||
* Return a LiveData on the number of rooms.
|
||||
|
|
|
@ -130,10 +130,13 @@ internal class DefaultRoomService @Inject constructor(
|
|||
return roomSummaryDataSource.getSortedPagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder)
|
||||
}
|
||||
|
||||
override fun getFilteredPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams,
|
||||
pagedListConfig: PagedList.Config,
|
||||
sortOrder: RoomSortOrder): UpdatableLivePageResult {
|
||||
return roomSummaryDataSource.getUpdatablePagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder, getFlattenedParents = true)
|
||||
override fun getFilteredPagedRoomSummariesLive(
|
||||
queryParams: RoomSummaryQueryParams,
|
||||
pagedListConfig: PagedList.Config,
|
||||
sortOrder: RoomSortOrder,
|
||||
getFlattenedParents: Boolean
|
||||
): UpdatableLivePageResult {
|
||||
return roomSummaryDataSource.getUpdatablePagedRoomSummariesLive(queryParams, pagedListConfig, sortOrder, getFlattenedParents)
|
||||
}
|
||||
|
||||
override fun getRoomCountLive(queryParams: RoomSummaryQueryParams): LiveData<Int> {
|
||||
|
|
|
@ -71,7 +71,7 @@ class RoomListSectionBuilderGroup(
|
|||
},
|
||||
{ qpm ->
|
||||
val name = stringProvider.getString(R.string.bottom_action_rooms)
|
||||
val updatableFilterLivePageResult = session.roomService().getFilteredPagedRoomSummariesLive(qpm)
|
||||
val updatableFilterLivePageResult = session.roomService().getFilteredPagedRoomSummariesLive(qpm, getFlattenParents = true)
|
||||
onUpdatable(updatableFilterLivePageResult)
|
||||
|
||||
val itemCountFlow = updatableFilterLivePageResult.livePagedList.asFlow()
|
||||
|
|
|
@ -326,7 +326,7 @@ class RoomListSectionBuilderSpace(
|
|||
},
|
||||
{ queryParams ->
|
||||
val name = stringProvider.getString(R.string.bottom_action_rooms)
|
||||
val updatableFilterLivePageResult = session.roomService().getFilteredPagedRoomSummariesLive(queryParams)
|
||||
val updatableFilterLivePageResult = session.roomService().getFilteredPagedRoomSummariesLive(queryParams, getFlattenParents = true)
|
||||
onUpdatable(updatableFilterLivePageResult)
|
||||
|
||||
val itemCountFlow = updatableFilterLivePageResult.livePagedList.asFlow()
|
||||
|
|
|
@ -199,7 +199,9 @@ class RoomSummaryItemFactory @Inject constructor(private val displayableEventFor
|
|||
|
||||
private fun getSearchResultSubtitle(roomSummary: RoomSummary): String {
|
||||
val userId = roomSummary.directUserId
|
||||
val spaceName = roomSummary.spaceParents?.firstOrNull()?.roomSummary?.name
|
||||
val spaceName = roomSummary.flattenParents
|
||||
.takeIf { it.isNotEmpty() }
|
||||
?.joinToString(", ") { it.name }
|
||||
val canonicalAlias = roomSummary.canonicalAlias
|
||||
|
||||
return (userId ?: spaceName ?: canonicalAlias).orEmpty()
|
||||
|
|
Loading…
Reference in New Issue