Cleanup constructors

This commit is contained in:
Benoit Marty 2021-07-19 18:59:27 +02:00
parent 14b4bff477
commit 5990e5a52b
3 changed files with 18 additions and 22 deletions

View File

@ -26,7 +26,6 @@ import im.vector.app.features.invite.AutoAcceptInvites
import im.vector.app.features.invite.showInvites
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import kotlinx.coroutines.CoroutineScope
import org.matrix.android.sdk.api.query.RoomCategoryFilter
import org.matrix.android.sdk.api.query.RoomTagQueryFilter
import org.matrix.android.sdk.api.session.Session
@ -36,13 +35,12 @@ import org.matrix.android.sdk.api.session.room.model.Membership
import org.matrix.android.sdk.rx.asObservable
class RoomListSectionBuilderGroup(
val session: Session,
val stringProvider: StringProvider,
val viewModelScope: CoroutineScope,
val appStateHandler: AppStateHandler,
private val session: Session,
private val stringProvider: StringProvider,
private val appStateHandler: AppStateHandler,
private val autoAcceptInvites: AutoAcceptInvites,
val onDisposable: (Disposable) -> Unit,
val onUpdatable: (UpdatableLivePageResult) -> Unit
private val onDisposable: (Disposable) -> Unit,
private val onUpdatable: (UpdatableLivePageResult) -> Unit
) : RoomListSectionBuilder {
override fun buildSections(mode: RoomListDisplayMode): List<RoomsSection> {

View File

@ -47,18 +47,18 @@ import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotification
import org.matrix.android.sdk.rx.asObservable
class RoomListSectionBuilderSpace(
val session: Session,
val stringProvider: StringProvider,
val appStateHandler: AppStateHandler,
val viewModelScope: CoroutineScope,
private val suggestedRoomJoiningState: LiveData<Map<String, Async<Unit>>>,
private val session: Session,
private val stringProvider: StringProvider,
private val appStateHandler: AppStateHandler,
private val viewModelScope: CoroutineScope,
private val autoAcceptInvites: AutoAcceptInvites,
val onDisposable: (Disposable) -> Unit,
val onUpdatable: (UpdatableLivePageResult) -> Unit,
val onlyOrphansInHome: Boolean = false
private val onDisposable: (Disposable) -> Unit,
private val onUpdatable: (UpdatableLivePageResult) -> Unit,
private val suggestedRoomJoiningState: LiveData<Map<String, Async<Unit>>>,
private val onlyOrphansInHome: Boolean = false
) : RoomListSectionBuilder {
val pagedListConfig = PagedList.Config.Builder()
private val pagedListConfig = PagedList.Config.Builder()
.setPageSize(10)
.setInitialLoadSizeHint(20)
.setEnablePlaceholders(true)

View File

@ -127,7 +127,6 @@ class RoomListViewModel @Inject constructor(
stringProvider,
appStateHandler,
viewModelScope,
suggestedRoomJoiningState,
autoAcceptInvites,
{
it.disposeOnClear()
@ -135,22 +134,21 @@ class RoomListViewModel @Inject constructor(
{
updatableQuery = it
},
suggestedRoomJoiningState,
vectorPreferences.labsSpacesOnlyOrphansInHome()
)
} else {
RoomListSectionBuilderGroup(
session,
stringProvider,
viewModelScope,
appStateHandler,
autoAcceptInvites,
{
it.disposeOnClear()
},
{
updatableQuery = it
}
)
) {
updatableQuery = it
}
}
.buildSections(initialState.displayMode)
}