diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/events/DefaultEventService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/events/DefaultEventService.kt index 9d80f27e01..51d305f441 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/events/DefaultEventService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/events/DefaultEventService.kt @@ -29,7 +29,6 @@ internal class DefaultEventService @Inject constructor( override suspend fun getEvent(roomId: String, eventId: String): Event { val event = getEventTask.execute(GetEventTask.Params(roomId, eventId)) - event.ageLocalTs = event.unsignedData?.age?.let { System.currentTimeMillis() - it } // Fast lane to the call event processors: try to make the incoming call ring faster if (callEventProcessor.shouldProcessFastLane(event.getClearType())) { callEventProcessor.processFastLane(event) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/GetEventTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/GetEventTask.kt index cbbc54e90d..9ede2f6562 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/GetEventTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/timeline/GetEventTask.kt @@ -59,6 +59,8 @@ internal class DefaultGetEventTask @Inject constructor( } } + event.ageLocalTs = event.unsignedData?.age?.let { System.currentTimeMillis() - it } + return event } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ThreadsAwarenessHandler.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ThreadsAwarenessHandler.kt index 9aeaf5fd78..767a967522 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ThreadsAwarenessHandler.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/handler/room/ThreadsAwarenessHandler.kt @@ -18,7 +18,6 @@ package org.matrix.android.sdk.internal.session.sync.handler.room import com.zhuinden.monarchy.Monarchy import io.realm.Realm -import io.realm.RealmConfiguration import org.matrix.android.sdk.api.session.crypto.CryptoService import org.matrix.android.sdk.api.session.crypto.MXCryptoError import org.matrix.android.sdk.api.session.events.model.Event @@ -44,7 +43,6 @@ import org.matrix.android.sdk.internal.session.permalinks.PermalinkFactory import org.matrix.android.sdk.internal.session.room.send.LocalEchoEventFactory import org.matrix.android.sdk.internal.session.room.timeline.GetEventTask import org.matrix.android.sdk.internal.util.awaitTransaction -import timber.log.Timber import javax.inject.Inject /** @@ -55,7 +53,6 @@ import javax.inject.Inject internal class ThreadsAwarenessHandler @Inject constructor( private val permalinkFactory: PermalinkFactory, private val cryptoService: CryptoService, - @SessionDatabase private val realmConfiguration: RealmConfiguration, @SessionDatabase private val monarchy: Monarchy, private val getEventTask: GetEventTask ) { @@ -87,7 +84,7 @@ internal class ThreadsAwarenessHandler @Inject constructor( if (eventList.isNullOrEmpty()) return val threadsToFetch = emptyMap().toMutableMap() - Realm.getInstance(realmConfiguration).use { realm -> + Realm.getInstance(monarchy.realmConfiguration).use { realm -> eventList.asSequence() .filter { isThreadEvent(it) && it.roomId != null @@ -130,10 +127,7 @@ internal class ThreadsAwarenessHandler @Inject constructor( */ private suspend fun fetchEvent(eventId: String, roomId: String): Event? { return runCatching { - Timber.i("------> Fetching event[$eventId]....") - getEventTask.execute(GetEventTask.Params(roomId = roomId, eventId = eventId)).apply { - unsignedData?.age?.let { System.currentTimeMillis() - it } - } + getEventTask.execute(GetEventTask.Params(roomId = roomId, eventId = eventId)) }.fold( onSuccess = { it