mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 09:25:49 +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>) {
|
||||
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(
|
||||
sessionId = sessionId,
|
||||
filename = updateTrustWorkerDataRepository.createParam(userIds)
|
||||
|
|
|
@ -185,10 +185,10 @@ internal class RoomSummaryUpdater @Inject constructor(
|
|||
if (aggregator == null) {
|
||||
// Do it now
|
||||
// mmm maybe we could only refresh shield instead of checking trust also?
|
||||
crossSigningService.onUsersDeviceUpdate(otherRoomMembers)
|
||||
crossSigningService.checkTrustAndAffectedRoomShields(otherRoomMembers)
|
||||
} else {
|
||||
// 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
|
||||
val userIdsToFetch = mutableSetOf<String>()
|
||||
|
||||
// Set of users to call `crossSigningService.onUsersDeviceUpdate` once per sync
|
||||
val userIdsWithDeviceUpdate = mutableSetOf<String>()
|
||||
// Set of users to call `crossSigningService.checkTrustAndAffectedRoomShields` once per sync
|
||||
val userIdsForCheckingTrustAndAffectedRoomShields = mutableSetOf<String>()
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ internal class SyncResponsePostTreatmentAggregatorHandler @Inject constructor(
|
|||
cleanupEphemeralFiles(aggregator.ephemeralFilesToDelete)
|
||||
updateDirectUserIds(aggregator.directChatsToCheck)
|
||||
fetchAndUpdateUsers(aggregator.userIdsToFetch)
|
||||
handleUserIdsWithDeviceUpdate(aggregator.userIdsWithDeviceUpdate)
|
||||
handleUserIdsForCheckingTrustAndAffectedRoomShields(aggregator.userIdsForCheckingTrustAndAffectedRoomShields)
|
||||
}
|
||||
|
||||
private fun cleanupEphemeralFiles(ephemeralFilesToDelete: List<String>) {
|
||||
|
@ -105,7 +105,7 @@ internal class SyncResponsePostTreatmentAggregatorHandler @Inject constructor(
|
|||
.enqueue()
|
||||
}
|
||||
|
||||
private fun handleUserIdsWithDeviceUpdate(userIdsWithDeviceUpdate: Iterable<String>) {
|
||||
crossSigningService.onUsersDeviceUpdate(userIdsWithDeviceUpdate.toList())
|
||||
private fun handleUserIdsForCheckingTrustAndAffectedRoomShields(userIdsWithDeviceUpdate: Iterable<String>) {
|
||||
crossSigningService.checkTrustAndAffectedRoomShields(userIdsWithDeviceUpdate.toList())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue