mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-17 11:48:51 +03:00
Replaces method for getting the space parents of rooms
This commit is contained in:
parent
f70a24d257
commit
47493fcfa1
2 changed files with 13 additions and 8 deletions
|
@ -37,6 +37,7 @@ import org.matrix.android.sdk.api.session.room.UpdatableLivePageResult
|
|||
import org.matrix.android.sdk.api.session.room.model.Membership
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||
import org.matrix.android.sdk.api.session.room.model.RoomType
|
||||
import org.matrix.android.sdk.api.session.room.model.SpaceParentInfo
|
||||
import org.matrix.android.sdk.api.session.room.roomSummaryQueryParams
|
||||
import org.matrix.android.sdk.api.session.room.spaceSummaryQueryParams
|
||||
import org.matrix.android.sdk.api.session.room.summary.RoomAggregateNotificationCount
|
||||
|
@ -197,6 +198,18 @@ internal class RoomSummaryDataSource @Inject constructor(
|
|||
}
|
||||
val dataSourceFactory = realmDataSourceFactory.map {
|
||||
roomSummaryMapper.map(it)
|
||||
}.map { roomSummary ->
|
||||
val parents = roomSummary.flattenParentIds.mapNotNull { parentId ->
|
||||
getRoomSummary(parentId)?.let { parentSummary ->
|
||||
SpaceParentInfo(
|
||||
parentId = parentSummary.flattenParentIds.firstOrNull(),
|
||||
roomSummary = parentSummary,
|
||||
canonical = true,
|
||||
viaServers = emptyList()
|
||||
)
|
||||
}
|
||||
}
|
||||
roomSummary.copy(spaceParents = parents)
|
||||
}
|
||||
|
||||
val boundaries = MutableLiveData(ResultBoundaries())
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.matrix.android.sdk.internal.session.room.summary
|
||||
|
||||
import io.realm.Realm
|
||||
import io.realm.RealmList
|
||||
import io.realm.kotlin.createObject
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.matrix.android.sdk.api.extensions.orFalse
|
||||
|
@ -362,13 +361,6 @@ internal class RoomSummaryUpdater @Inject constructor(
|
|||
val flattenParentsIds = (flattenSpaceParents[parent.roomId] ?: emptyList()) + listOf(parent.roomId)
|
||||
entry.value.forEach { child ->
|
||||
RoomSummaryEntity.where(realm, child.roomId).findFirst()?.let { childSum ->
|
||||
// TODO: Revisit
|
||||
childSum.parents.add(SpaceParentSummaryEntity(
|
||||
canonical = true,
|
||||
parentRoomId = parent.roomId,
|
||||
parentSummaryEntity = parent,
|
||||
viaServers = RealmList()
|
||||
))
|
||||
if (childSum.flattenParentIds == null) childSum.flattenParentIds = ""
|
||||
flattenParentsIds.forEach {
|
||||
if (childSum.flattenParentIds?.contains(it) != true) {
|
||||
|
|
Loading…
Add table
Reference in a new issue