mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 11:26:01 +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) {
|
||||
// it's expanded
|
||||
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>,
|
||||
selected: RoomGroupingMethod,
|
||||
info: SpaceChildInfo, currentDepth: Int, maxDepth: Int) {
|
||||
|
@ -195,9 +196,11 @@ class SpaceSummaryController @Inject constructor(
|
|||
val expanded = expandedStates[childSummary.roomId] == true
|
||||
val isSelected = selected is RoomGroupingMethod.BySpace && childSummary.roomId == selected.space()?.roomId
|
||||
|
||||
val id = "$idPrefix:${childSummary.roomId}"
|
||||
|
||||
subSpaceSummaryItem {
|
||||
avatarRenderer(host.avatarRenderer)
|
||||
id(childSummary.roomId)
|
||||
id(id)
|
||||
hasChildren(!subSpaces.isNullOrEmpty())
|
||||
selected(isSelected)
|
||||
expanded(expanded)
|
||||
|
@ -216,7 +219,7 @@ class SpaceSummaryController @Inject constructor(
|
|||
|
||||
if (expanded) {
|
||||
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