mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 03:16:02 +03:00
Create a new fun
for code clarity
This commit is contained in:
parent
f668be5266
commit
a8eb7d95ac
4 changed files with 12 additions and 7 deletions
|
@ -779,6 +779,11 @@ internal class DefaultCrossSigningService @Inject constructor(
|
||||||
|
|
||||||
override fun onUsersDeviceUpdate(userIds: List<String>) {
|
override fun onUsersDeviceUpdate(userIds: List<String>) {
|
||||||
Timber.d("## CrossSigning - onUsersDeviceUpdate for users: ${userIds.logLimit()}")
|
Timber.d("## CrossSigning - onUsersDeviceUpdate for users: ${userIds.logLimit()}")
|
||||||
|
checkTrustAndAffectedRoomShields(userIds)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun checkTrustAndAffectedRoomShields(userIds: List<String>) {
|
||||||
|
Timber.d("## CrossSigning - checkTrustAndAffectedRoomShields for users: ${userIds.logLimit()}")
|
||||||
val workerParams = UpdateTrustWorker.Params(
|
val workerParams = UpdateTrustWorker.Params(
|
||||||
sessionId = sessionId,
|
sessionId = sessionId,
|
||||||
filename = updateTrustWorkerDataRepository.createParam(userIds)
|
filename = updateTrustWorkerDataRepository.createParam(userIds)
|
||||||
|
|
|
@ -185,10 +185,10 @@ internal class RoomSummaryUpdater @Inject constructor(
|
||||||
if (aggregator == null) {
|
if (aggregator == null) {
|
||||||
// Do it now
|
// Do it now
|
||||||
// mmm maybe we could only refresh shield instead of checking trust also?
|
// mmm maybe we could only refresh shield instead of checking trust also?
|
||||||
crossSigningService.onUsersDeviceUpdate(otherRoomMembers)
|
crossSigningService.checkTrustAndAffectedRoomShields(otherRoomMembers)
|
||||||
} else {
|
} else {
|
||||||
// Schedule it
|
// Schedule it
|
||||||
aggregator.userIdsWithDeviceUpdate.addAll(otherRoomMembers)
|
aggregator.userIdsForCheckingTrustAndAffectedRoomShields.addAll(otherRoomMembers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,6 @@ internal class SyncResponsePostTreatmentAggregator {
|
||||||
// Set of userIds to fetch and update at the end of incremental syncs
|
// Set of userIds to fetch and update at the end of incremental syncs
|
||||||
val userIdsToFetch = mutableSetOf<String>()
|
val userIdsToFetch = mutableSetOf<String>()
|
||||||
|
|
||||||
// Set of users to call `crossSigningService.onUsersDeviceUpdate` once per sync
|
// Set of users to call `crossSigningService.checkTrustAndAffectedRoomShields` once per sync
|
||||||
val userIdsWithDeviceUpdate = mutableSetOf<String>()
|
val userIdsForCheckingTrustAndAffectedRoomShields = mutableSetOf<String>()
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ internal class SyncResponsePostTreatmentAggregatorHandler @Inject constructor(
|
||||||
cleanupEphemeralFiles(aggregator.ephemeralFilesToDelete)
|
cleanupEphemeralFiles(aggregator.ephemeralFilesToDelete)
|
||||||
updateDirectUserIds(aggregator.directChatsToCheck)
|
updateDirectUserIds(aggregator.directChatsToCheck)
|
||||||
fetchAndUpdateUsers(aggregator.userIdsToFetch)
|
fetchAndUpdateUsers(aggregator.userIdsToFetch)
|
||||||
handleUserIdsWithDeviceUpdate(aggregator.userIdsWithDeviceUpdate)
|
handleUserIdsForCheckingTrustAndAffectedRoomShields(aggregator.userIdsForCheckingTrustAndAffectedRoomShields)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun cleanupEphemeralFiles(ephemeralFilesToDelete: List<String>) {
|
private fun cleanupEphemeralFiles(ephemeralFilesToDelete: List<String>) {
|
||||||
|
@ -105,7 +105,7 @@ internal class SyncResponsePostTreatmentAggregatorHandler @Inject constructor(
|
||||||
.enqueue()
|
.enqueue()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleUserIdsWithDeviceUpdate(userIdsWithDeviceUpdate: Iterable<String>) {
|
private fun handleUserIdsForCheckingTrustAndAffectedRoomShields(userIdsWithDeviceUpdate: Iterable<String>) {
|
||||||
crossSigningService.onUsersDeviceUpdate(userIdsWithDeviceUpdate.toList())
|
crossSigningService.checkTrustAndAffectedRoomShields(userIdsWithDeviceUpdate.toList())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue