cleaning, quality

This commit is contained in:
Valere 2021-06-17 17:00:28 +02:00
parent 682e926965
commit 3dc7a6dc34
3 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 New Vector Ltd * Copyright 2021 The Matrix.org Foundation C.I.C.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -64,8 +64,7 @@ class SpaceSummaryController @Inject constructor(
nonNullViewState.selectedGroupingMethod, nonNullViewState.selectedGroupingMethod,
nonNullViewState.rootSpacesOrdered, nonNullViewState.rootSpacesOrdered,
nonNullViewState.expandedStates, nonNullViewState.expandedStates,
nonNullViewState.homeAggregateCount, nonNullViewState.homeAggregateCount)
nonNullViewState.spaceOrderInfo)
if (!nonNullViewState.legacyGroups.isNullOrEmpty()) { if (!nonNullViewState.legacyGroups.isNullOrEmpty()) {
genericFooterItem { genericFooterItem {
@ -108,8 +107,7 @@ class SpaceSummaryController @Inject constructor(
selected: RoomGroupingMethod, selected: RoomGroupingMethod,
rootSpaces: List<RoomSummary>?, rootSpaces: List<RoomSummary>?,
expandedStates: Map<String, Boolean>, expandedStates: Map<String, Boolean>,
homeCount: RoomAggregateNotificationCount, homeCount: RoomAggregateNotificationCount) {
spaceOrderInfo: Map<String, String?>?) {
val host = this val host = this
spaceBetaHeaderItem { spaceBetaHeaderItem {
id("beta_header") id("beta_header")

View File

@ -159,15 +159,15 @@ class SpacesListViewModel @AssistedInject constructor(@Assisted initialState: Sp
is SpaceListAction.OpenSpaceInvite -> handleSelectSpaceInvite(action) is SpaceListAction.OpenSpaceInvite -> handleSelectSpaceInvite(action)
is SpaceListAction.SelectLegacyGroup -> handleSelectGroup(action) is SpaceListAction.SelectLegacyGroup -> handleSelectGroup(action)
is SpaceListAction.MoveSpace -> handleMoveSpace(action) is SpaceListAction.MoveSpace -> handleMoveSpace(action)
is SpaceListAction.OnEndDragging -> handleEndDragging(action) is SpaceListAction.OnEndDragging -> handleEndDragging()
is SpaceListAction.OnStartDragging -> handleStartDragging(action) is SpaceListAction.OnStartDragging -> handleStartDragging()
} }
} }
// PRIVATE METHODS ***************************************************************************** // PRIVATE METHODS *****************************************************************************
var preDragExpandedState: Map<String, Boolean>? = null var preDragExpandedState: Map<String, Boolean>? = null
private fun handleStartDragging(action: SpaceListAction.OnStartDragging) = withState { state -> private fun handleStartDragging() = withState { state ->
preDragExpandedState = state.expandedStates.toMap() preDragExpandedState = state.expandedStates.toMap()
setState { setState {
copy( copy(
@ -178,7 +178,7 @@ class SpacesListViewModel @AssistedInject constructor(@Assisted initialState: Sp
} }
} }
private fun handleEndDragging(action: SpaceListAction.OnEndDragging) = withState { state -> private fun handleEndDragging() {
// restore expanded state // restore expanded state
setState { setState {
copy( copy(