mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Avoid launching coroutine for nothing.
This commit is contained in:
parent
56986c3a77
commit
837590104d
@ -42,14 +42,12 @@ internal class StreamEventsManager @Inject constructor() {
|
||||
listeners.remove(listener)
|
||||
}
|
||||
|
||||
fun dispatchLiveEventReceived(event: Event, roomId: String, initialSync: Boolean) {
|
||||
fun dispatchLiveEventReceived(event: Event, roomId: String) {
|
||||
Timber.v("## dispatchLiveEventReceived ${event.eventId}")
|
||||
coroutineScope.launch {
|
||||
if (!initialSync) {
|
||||
listeners.forEach {
|
||||
tryOrNull {
|
||||
it.onLiveEvent(roomId, event)
|
||||
}
|
||||
listeners.forEach {
|
||||
tryOrNull {
|
||||
it.onLiveEvent(roomId, event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -423,7 +423,9 @@ internal class RoomSyncHandler @Inject constructor(
|
||||
val isInitialSync = insertType == EventInsertType.INITIAL_SYNC
|
||||
|
||||
eventIds.add(event.eventId)
|
||||
liveEventService.get().dispatchLiveEventReceived(event, roomId, isInitialSync)
|
||||
if (!isInitialSync) {
|
||||
liveEventService.get().dispatchLiveEventReceived(event, roomId)
|
||||
}
|
||||
|
||||
if (event.isEncrypted() && !isInitialSync) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user