mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 02:15:35 +03:00
Merge pull request #4693 from SpiritCroc/spaceChildIds
Fix possible crash when having identical subspaces in multiple root spaces
This commit is contained in:
commit
3719551913
2 changed files with 8 additions and 4 deletions
1
changelog.d/4693.bugfix
Normal file
1
changelog.d/4693.bugfix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix possible crash when having identical subspaces in multiple root spaces
|
|
@ -170,7 +170,7 @@ class SpaceSummaryController @Inject constructor(
|
||||||
if (hasChildren && expanded) {
|
if (hasChildren && expanded) {
|
||||||
// it's expanded
|
// it's expanded
|
||||||
subSpaces?.forEach { child ->
|
subSpaces?.forEach { child ->
|
||||||
buildSubSpace(summaries, expandedStates, selected, child, 1, 3)
|
buildSubSpace(groupSummary.roomId, summaries, expandedStates, selected, child, 1, 3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,8 @@ class SpaceSummaryController @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildSubSpace(summaries: List<RoomSummary>?,
|
private fun buildSubSpace(idPrefix: String,
|
||||||
|
summaries: List<RoomSummary>?,
|
||||||
expandedStates: Map<String, Boolean>,
|
expandedStates: Map<String, Boolean>,
|
||||||
selected: RoomGroupingMethod,
|
selected: RoomGroupingMethod,
|
||||||
info: SpaceChildInfo, currentDepth: Int, maxDepth: Int) {
|
info: SpaceChildInfo, currentDepth: Int, maxDepth: Int) {
|
||||||
|
@ -195,9 +196,11 @@ class SpaceSummaryController @Inject constructor(
|
||||||
val expanded = expandedStates[childSummary.roomId] == true
|
val expanded = expandedStates[childSummary.roomId] == true
|
||||||
val isSelected = selected is RoomGroupingMethod.BySpace && childSummary.roomId == selected.space()?.roomId
|
val isSelected = selected is RoomGroupingMethod.BySpace && childSummary.roomId == selected.space()?.roomId
|
||||||
|
|
||||||
|
val id = "$idPrefix:${childSummary.roomId}"
|
||||||
|
|
||||||
subSpaceSummaryItem {
|
subSpaceSummaryItem {
|
||||||
avatarRenderer(host.avatarRenderer)
|
avatarRenderer(host.avatarRenderer)
|
||||||
id(childSummary.roomId)
|
id(id)
|
||||||
hasChildren(!subSpaces.isNullOrEmpty())
|
hasChildren(!subSpaces.isNullOrEmpty())
|
||||||
selected(isSelected)
|
selected(isSelected)
|
||||||
expanded(expanded)
|
expanded(expanded)
|
||||||
|
@ -216,7 +219,7 @@ class SpaceSummaryController @Inject constructor(
|
||||||
|
|
||||||
if (expanded) {
|
if (expanded) {
|
||||||
subSpaces?.forEach {
|
subSpaces?.forEach {
|
||||||
buildSubSpace(summaries, expandedStates, selected, it, currentDepth + 1, maxDepth)
|
buildSubSpace(id, summaries, expandedStates, selected, it, currentDepth + 1, maxDepth)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue