mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-18 20:29:10 +03:00
Avoid launching coroutine for nothing.
This commit is contained in:
parent
56986c3a77
commit
837590104d
2 changed files with 7 additions and 7 deletions
|
@ -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…
Add table
Reference in a new issue