Fix / empty space pannel on new accounts
This commit is contained in:
parent
32605be6e8
commit
8c1afbaa66
|
@ -102,10 +102,6 @@ class SpaceSummaryController @Inject constructor(
|
||||||
rootSpaces: List<RoomSummary>?,
|
rootSpaces: List<RoomSummary>?,
|
||||||
expandedStates: Map<String, Boolean>,
|
expandedStates: Map<String, Boolean>,
|
||||||
homeCount: RoomAggregateNotificationCount) {
|
homeCount: RoomAggregateNotificationCount) {
|
||||||
if (summaries.isNullOrEmpty()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
genericItemHeader {
|
genericItemHeader {
|
||||||
id("spaces")
|
id("spaces")
|
||||||
text(stringProvider.getString(R.string.spaces_header))
|
text(stringProvider.getString(R.string.spaces_header))
|
||||||
|
@ -115,14 +111,8 @@ class SpaceSummaryController @Inject constructor(
|
||||||
|
|
||||||
// show invites on top
|
// show invites on top
|
||||||
|
|
||||||
summaries.filter { it.membership == Membership.INVITE }
|
summaries?.filter { it.membership == Membership.INVITE }
|
||||||
.let { invites ->
|
?.forEach {
|
||||||
if (invites.isNotEmpty()) {
|
|
||||||
// genericItemHeader {
|
|
||||||
// id("invites")
|
|
||||||
// text(stringProvider.getString(R.string.spaces_invited_header))
|
|
||||||
// }
|
|
||||||
invites.forEach {
|
|
||||||
spaceSummaryItem {
|
spaceSummaryItem {
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(avatarRenderer)
|
||||||
id(it.roomId)
|
id(it.roomId)
|
||||||
|
@ -133,8 +123,6 @@ class SpaceSummaryController @Inject constructor(
|
||||||
listener { callback?.onSpaceInviteSelected(it) }
|
listener { callback?.onSpaceInviteSelected(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
homeSpaceSummaryItem {
|
homeSpaceSummaryItem {
|
||||||
id("space_home")
|
id("space_home")
|
||||||
|
@ -149,7 +137,7 @@ class SpaceSummaryController @Inject constructor(
|
||||||
val isSelected = selected is RoomGroupingMethod.BySpace && groupSummary.roomId == selected.space()?.roomId
|
val isSelected = selected is RoomGroupingMethod.BySpace && groupSummary.roomId == selected.space()?.roomId
|
||||||
// does it have children?
|
// does it have children?
|
||||||
val subSpaces = groupSummary.spaceChildren?.filter { childInfo ->
|
val subSpaces = groupSummary.spaceChildren?.filter { childInfo ->
|
||||||
summaries.indexOfFirst { it.roomId == childInfo.childRoomId } != -1
|
summaries?.indexOfFirst { it.roomId == childInfo.childRoomId } != -1
|
||||||
}
|
}
|
||||||
val hasChildren = (subSpaces?.size ?: 0) > 0
|
val hasChildren = (subSpaces?.size ?: 0) > 0
|
||||||
val expanded = expandedStates[groupSummary.roomId] == true
|
val expanded = expandedStates[groupSummary.roomId] == true
|
||||||
|
@ -175,7 +163,7 @@ class SpaceSummaryController @Inject constructor(
|
||||||
if (hasChildren && expanded) {
|
if (hasChildren && expanded) {
|
||||||
// it's expanded
|
// it's expanded
|
||||||
subSpaces?.forEach { child ->
|
subSpaces?.forEach { child ->
|
||||||
summaries.firstOrNull { it.roomId == child.childRoomId }?.let { childSum ->
|
summaries?.firstOrNull { it.roomId == child.childRoomId }?.let { childSum ->
|
||||||
val isChildSelected = selected is RoomGroupingMethod.BySpace && childSum.roomId == selected.space()?.roomId
|
val isChildSelected = selected is RoomGroupingMethod.BySpace && childSum.roomId == selected.space()?.roomId
|
||||||
spaceSummaryItem {
|
spaceSummaryItem {
|
||||||
avatarRenderer(avatarRenderer)
|
avatarRenderer(avatarRenderer)
|
||||||
|
@ -197,7 +185,6 @@ class SpaceSummaryController @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporary item to create a new Space (will move with final design)
|
|
||||||
spaceAddItem {
|
spaceAddItem {
|
||||||
id("create")
|
id("create")
|
||||||
listener { callback?.onAddSpaceSelected() }
|
listener { callback?.onAddSpaceSelected() }
|
||||||
|
|
Loading…
Reference in New Issue