Little changes after review

This commit is contained in:
Benoit Marty 2019-09-20 17:34:50 +02:00
parent a993a30203
commit b3e1c3969d
2 changed files with 12 additions and 11 deletions

View File

@ -22,15 +22,15 @@ import im.vector.matrix.android.internal.database.model.GroupSummaryEntity
internal object GroupSummaryMapper {
fun map(roomSummaryEntity: GroupSummaryEntity): GroupSummary {
fun map(groupSummaryEntity: GroupSummaryEntity): GroupSummary {
return GroupSummary(
roomSummaryEntity.groupId,
roomSummaryEntity.membership,
roomSummaryEntity.displayName,
roomSummaryEntity.shortDescription,
roomSummaryEntity.avatarUrl,
roomSummaryEntity.roomIds.toList(),
roomSummaryEntity.userIds.toList()
groupSummaryEntity.groupId,
groupSummaryEntity.membership,
groupSummaryEntity.displayName,
groupSummaryEntity.shortDescription,
groupSummaryEntity.avatarUrl,
groupSummaryEntity.roomIds.toList(),
groupSummaryEntity.userIds.toList()
)
}
}

View File

@ -47,15 +47,16 @@ internal class GroupSummaryUpdater @Inject constructor(private val context: Cont
val modifiedGroupEntity = (changeSet.insertions + changeSet.changes)
.asSequence()
.mapNotNull { results[it] }
.toList()
fetchGroupsData(modifiedGroupEntity
.filter { it.membership == Membership.JOIN || it.membership == Membership.INVITE }
.map { it.groupId })
.map { it.groupId }
.toList())
deleteGroups(modifiedGroupEntity
.filter { it.membership == Membership.LEAVE }
.map { it.groupId })
.map { it.groupId }
.toList())
}
private fun fetchGroupsData(groupIds: List<String>) {