reusing the suspend scope

This commit is contained in:
Adam Brown 2022-08-01 13:13:00 +01:00
parent fedbe048ba
commit 410a7b525f

View File

@ -198,7 +198,7 @@ class VectorMessagingReceiver : MessagingReceiver() {
} }
} }
private fun getEventFastLane(session: Session, pushData: PushData) { private suspend fun getEventFastLane(session: Session, pushData: PushData) {
pushData.roomId ?: return pushData.roomId ?: return
pushData.eventId ?: return pushData.eventId ?: return
@ -212,18 +212,16 @@ class VectorMessagingReceiver : MessagingReceiver() {
return return
} }
coroutineScope.launch { Timber.tag(loggerTag.value).d("Fast lane: start request")
Timber.tag(loggerTag.value).d("Fast lane: start request") val event = tryOrNull { session.eventService().getEvent(pushData.roomId, pushData.eventId) } ?: return
val event = tryOrNull { session.eventService().getEvent(pushData.roomId, pushData.eventId) } ?: return@launch
val resolvedEvent = notifiableEventResolver.resolveInMemoryEvent(session, event, canBeReplaced = true) val resolvedEvent = notifiableEventResolver.resolveInMemoryEvent(session, event, canBeReplaced = true)
resolvedEvent resolvedEvent
?.also { Timber.tag(loggerTag.value).d("Fast lane: notify drawer") } ?.also { Timber.tag(loggerTag.value).d("Fast lane: notify drawer") }
?.let { ?.let {
notificationDrawerManager.updateEvents { it.onNotifiableEventReceived(resolvedEvent) } notificationDrawerManager.updateEvents { it.onNotifiableEventReceived(resolvedEvent) }
} }
}
} }
// check if the event was not yet received // check if the event was not yet received