mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +03:00
Always use roomSummaryQueryParams
, and not directly a RoomSummaryQueryParams.Builder()
Also format and add some Kdoc
This commit is contained in:
parent
eeb7d60e59
commit
12b3afbc50
3 changed files with 20 additions and 17 deletions
|
@ -24,21 +24,28 @@ 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.space.SpaceSummaryQueryParams
|
||||
|
||||
/**
|
||||
* Create a [RoomSummaryQueryParams] object, calling [init] with a [RoomSummaryQueryParams.Builder]
|
||||
*/
|
||||
fun roomSummaryQueryParams(init: (RoomSummaryQueryParams.Builder.() -> Unit) = {}): RoomSummaryQueryParams {
|
||||
return RoomSummaryQueryParams.Builder().apply(init).build()
|
||||
}
|
||||
|
||||
fun spaceSummaryQueryParams(init: (RoomSummaryQueryParams.Builder.() -> Unit) = {}): SpaceSummaryQueryParams {
|
||||
return RoomSummaryQueryParams.Builder()
|
||||
.apply(init)
|
||||
.apply {
|
||||
includeType = listOf(RoomType.SPACE)
|
||||
excludeType = null
|
||||
roomCategoryFilter = RoomCategoryFilter.ONLY_ROOMS
|
||||
}
|
||||
.build()
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a [RoomSummaryQueryParams] object, calling [init] with a [RoomSummaryQueryParams.Builder]
|
||||
* This is specific for spaces, other filters will be applied after invoking [init]
|
||||
*/
|
||||
fun spaceSummaryQueryParams(init: (RoomSummaryQueryParams.Builder.() -> Unit) = {}): SpaceSummaryQueryParams {
|
||||
return roomSummaryQueryParams {
|
||||
init()
|
||||
includeType = listOf(RoomType.SPACE)
|
||||
excludeType = null
|
||||
roomCategoryFilter = RoomCategoryFilter.ONLY_ROOMS
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class can be used to filter room summaries to use with:
|
||||
* [org.matrix.android.sdk.api.session.room.Room] and [org.matrix.android.sdk.api.session.room.RoomService].
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.matrix.android.sdk.api.session.Session
|
|||
import org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams
|
||||
import org.matrix.android.sdk.api.session.room.UpdatableLivePageResult
|
||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
||||
|
||||
class RoomListSectionBuilderGroup(
|
||||
private val coroutineScope: CoroutineScope,
|
||||
|
@ -281,9 +282,6 @@ class RoomListSectionBuilderGroup(
|
|||
}
|
||||
|
||||
private fun withQueryParams(builder: (RoomSummaryQueryParams.Builder) -> Unit, block: (RoomSummaryQueryParams) -> Unit) {
|
||||
RoomSummaryQueryParams.Builder()
|
||||
.apply { builder.invoke(this) }
|
||||
.build()
|
||||
.let { block(it) }
|
||||
block(roomSummaryQueryParams { builder.invoke(this) })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.matrix.android.sdk.api.session.getRoomSummary
|
|||
import org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams
|
||||
import org.matrix.android.sdk.api.session.room.UpdatableLivePageResult
|
||||
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
||||
import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotificationCount
|
||||
import timber.log.Timber
|
||||
|
||||
|
@ -429,10 +430,7 @@ class RoomListSectionBuilderSpace(
|
|||
}
|
||||
|
||||
private fun withQueryParams(builder: (RoomSummaryQueryParams.Builder) -> Unit, block: (RoomSummaryQueryParams) -> Unit) {
|
||||
RoomSummaryQueryParams.Builder()
|
||||
.apply { builder.invoke(this) }
|
||||
.build()
|
||||
.let { block(it) }
|
||||
block(roomSummaryQueryParams { builder.invoke(this) })
|
||||
}
|
||||
|
||||
internal fun RoomSummaryQueryParams.process(spaceFilter: RoomListViewModel.SpaceFilterStrategy, currentSpace: String?): RoomSummaryQueryParams {
|
||||
|
|
Loading…
Reference in a new issue