mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-22 17:35:54 +03:00
PR remrarks
This commit is contained in:
parent
9972dbc278
commit
8015ffee42
3 changed files with 4 additions and 9 deletions
|
@ -29,7 +29,6 @@ internal class DefaultEventService @Inject constructor(
|
||||||
|
|
||||||
override suspend fun getEvent(roomId: String, eventId: String): Event {
|
override suspend fun getEvent(roomId: String, eventId: String): Event {
|
||||||
val event = getEventTask.execute(GetEventTask.Params(roomId, eventId))
|
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
|
// Fast lane to the call event processors: try to make the incoming call ring faster
|
||||||
if (callEventProcessor.shouldProcessFastLane(event.getClearType())) {
|
if (callEventProcessor.shouldProcessFastLane(event.getClearType())) {
|
||||||
callEventProcessor.processFastLane(event)
|
callEventProcessor.processFastLane(event)
|
||||||
|
|
|
@ -59,6 +59,8 @@ internal class DefaultGetEventTask @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.ageLocalTs = event.unsignedData?.age?.let { System.currentTimeMillis() - it }
|
||||||
|
|
||||||
return event
|
return event
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ package org.matrix.android.sdk.internal.session.sync.handler.room
|
||||||
|
|
||||||
import com.zhuinden.monarchy.Monarchy
|
import com.zhuinden.monarchy.Monarchy
|
||||||
import io.realm.Realm
|
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.CryptoService
|
||||||
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
import org.matrix.android.sdk.api.session.crypto.MXCryptoError
|
||||||
import org.matrix.android.sdk.api.session.events.model.Event
|
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.send.LocalEchoEventFactory
|
||||||
import org.matrix.android.sdk.internal.session.room.timeline.GetEventTask
|
import org.matrix.android.sdk.internal.session.room.timeline.GetEventTask
|
||||||
import org.matrix.android.sdk.internal.util.awaitTransaction
|
import org.matrix.android.sdk.internal.util.awaitTransaction
|
||||||
import timber.log.Timber
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +53,6 @@ import javax.inject.Inject
|
||||||
internal class ThreadsAwarenessHandler @Inject constructor(
|
internal class ThreadsAwarenessHandler @Inject constructor(
|
||||||
private val permalinkFactory: PermalinkFactory,
|
private val permalinkFactory: PermalinkFactory,
|
||||||
private val cryptoService: CryptoService,
|
private val cryptoService: CryptoService,
|
||||||
@SessionDatabase private val realmConfiguration: RealmConfiguration,
|
|
||||||
@SessionDatabase private val monarchy: Monarchy,
|
@SessionDatabase private val monarchy: Monarchy,
|
||||||
private val getEventTask: GetEventTask
|
private val getEventTask: GetEventTask
|
||||||
) {
|
) {
|
||||||
|
@ -87,7 +84,7 @@ internal class ThreadsAwarenessHandler @Inject constructor(
|
||||||
if (eventList.isNullOrEmpty()) return
|
if (eventList.isNullOrEmpty()) return
|
||||||
|
|
||||||
val threadsToFetch = emptyMap<String, String>().toMutableMap()
|
val threadsToFetch = emptyMap<String, String>().toMutableMap()
|
||||||
Realm.getInstance(realmConfiguration).use { realm ->
|
Realm.getInstance(monarchy.realmConfiguration).use { realm ->
|
||||||
eventList.asSequence()
|
eventList.asSequence()
|
||||||
.filter {
|
.filter {
|
||||||
isThreadEvent(it) && it.roomId != null
|
isThreadEvent(it) && it.roomId != null
|
||||||
|
@ -130,10 +127,7 @@ internal class ThreadsAwarenessHandler @Inject constructor(
|
||||||
*/
|
*/
|
||||||
private suspend fun fetchEvent(eventId: String, roomId: String): Event? {
|
private suspend fun fetchEvent(eventId: String, roomId: String): Event? {
|
||||||
return runCatching {
|
return runCatching {
|
||||||
Timber.i("------> Fetching event[$eventId]....")
|
getEventTask.execute(GetEventTask.Params(roomId = roomId, eventId = eventId))
|
||||||
getEventTask.execute(GetEventTask.Params(roomId = roomId, eventId = eventId)).apply {
|
|
||||||
unsignedData?.age?.let { System.currentTimeMillis() - it }
|
|
||||||
}
|
|
||||||
}.fold(
|
}.fold(
|
||||||
onSuccess = {
|
onSuccess = {
|
||||||
it
|
it
|
||||||
|
|
Loading…
Reference in a new issue