mirror of
https://github.com/element-hq/element-android
synced 2024-10-23 11:16:33 +03:00
Set instead of List, to avoid duplication.
This commit is contained in:
parent
9a0ea7bc2e
commit
a7666e2112
2 changed files with 3 additions and 3 deletions
|
@ -24,7 +24,7 @@ internal class SyncResponsePostTreatmentAggregator {
|
||||||
val directChatsToCheck = mutableMapOf<String, String>()
|
val directChatsToCheck = mutableMapOf<String, String>()
|
||||||
|
|
||||||
// List of userIds to fetch and update at the end of incremental syncs
|
// List of userIds to fetch and update at the end of incremental syncs
|
||||||
val userIdsToFetch = mutableListOf<String>()
|
val userIdsToFetch = mutableSetOf<String>()
|
||||||
|
|
||||||
// Set of users to call `crossSigningService.onUsersDeviceUpdate` once per sync
|
// Set of users to call `crossSigningService.onUsersDeviceUpdate` once per sync
|
||||||
val userIdsWithDeviceUpdate = mutableSetOf<String>()
|
val userIdsWithDeviceUpdate = mutableSetOf<String>()
|
||||||
|
|
|
@ -83,13 +83,13 @@ internal class SyncResponsePostTreatmentAggregatorHandler @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun fetchAndUpdateUsers(userIdsToFetch: List<String>) {
|
private suspend fun fetchAndUpdateUsers(userIdsToFetch: Collection<String>) {
|
||||||
fetchUsers(userIdsToFetch)
|
fetchUsers(userIdsToFetch)
|
||||||
.takeIf { it.isNotEmpty() }
|
.takeIf { it.isNotEmpty() }
|
||||||
?.saveLocally()
|
?.saveLocally()
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun fetchUsers(userIdsToFetch: List<String>) = userIdsToFetch.mapNotNull {
|
private suspend fun fetchUsers(userIdsToFetch: Collection<String>) = userIdsToFetch.mapNotNull {
|
||||||
tryOrNull {
|
tryOrNull {
|
||||||
val profileJson = getProfileInfoTask.execute(GetProfileInfoTask.Params(it))
|
val profileJson = getProfileInfoTask.execute(GetProfileInfoTask.Params(it))
|
||||||
User.fromJson(it, profileJson)
|
User.fromJson(it, profileJson)
|
||||||
|
|
Loading…
Reference in a new issue