Fix / device change detection broken

This commit is contained in:
Valere 2020-06-29 11:21:10 +02:00
parent 51228a3a5c
commit 51b7a0aeae
3 changed files with 8 additions and 0 deletions

View file

@ -360,6 +360,8 @@ internal class DefaultCryptoService @Inject constructor(
// be called for all e2e rooms during the processing of the sync,
// at which point we'll start tracking all the users of that room.
deviceListManager.invalidateAllDeviceLists()
// always track my devices?
deviceListManager.startTrackingDeviceList(listOf(userId))
deviceListManager.refreshOutdatedDeviceLists()
} catch (failure: Throwable) {
Timber.e(failure, "## CRYPTO onSyncWillProcess ")

View file

@ -156,6 +156,7 @@ internal class DeviceListManager @Inject constructor(private val cryptoStore: IM
* @param left the user ids list which left a room
*/
fun handleDeviceListsChanges(changed: Collection<String>, left: Collection<String>) {
Timber.v("## CRYPTO: handleDeviceListsChanges changed:$changed / left:$left")
var isUpdated = false
val deviceTrackingStatuses = cryptoStore.getDeviceTrackingStatuses().toMutableMap()
@ -483,6 +484,7 @@ internal class DeviceListManager @Inject constructor(private val cryptoStore: IM
* This method must be called on getEncryptingThreadHandler() thread.
*/
suspend fun refreshOutdatedDeviceLists() {
Timber.v("## CRYPTO | refreshOutdatedDeviceLists()")
val deviceTrackingStatuses = cryptoStore.getDeviceTrackingStatuses().toMutableMap()
val users = deviceTrackingStatuses.keys.filterTo(mutableListOf()) { userId ->

View file

@ -49,6 +49,10 @@ internal class SyncResponseHandler @Inject constructor(@SessionDatabase private
val reporter = initialSyncProgressService.takeIf { isInitialSync }
measureTimeMillis {
if (!cryptoService.isStarted()) {
Timber.v("Should start cryptoService")
cryptoService.start()
}
cryptoService.onSyncWillProcess(isInitialSync)
}.also {
Timber.v("Finish handling start cryptoService in $it ms")