diff --git a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/SyncService.kt b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/SyncService.kt index d0487d3..20ddf80 100644 --- a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/SyncService.kt +++ b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/SyncService.kt @@ -19,7 +19,7 @@ interface SyncService : MatrixService { fun overview(): Flow fun room(roomId: RoomId): Flow fun startSyncing(): Flow - fun events(): Flow> + fun events(roomId: RoomId? = null): Flow> suspend fun observeEvent(eventId: EventId): Flow suspend fun forceManualRefresh(roomIds: List) @@ -27,7 +27,9 @@ interface SyncService : MatrixService { value class FilterId(val value: String) sealed interface SyncEvent { - data class Typing(val roomId: RoomId, val members: List) : SyncEvent + val roomId: RoomId + + data class Typing(override val roomId: RoomId, val members: List) : SyncEvent } } diff --git a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/DefaultSyncService.kt b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/DefaultSyncService.kt index bf8a7ae..779c2f0 100644 --- a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/DefaultSyncService.kt +++ b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/DefaultSyncService.kt @@ -108,7 +108,7 @@ internal class DefaultSyncService( override fun invites() = overviewStore.latestInvites() override fun overview() = overviewStore.latest() override fun room(roomId: RoomId) = roomStore.latest(roomId) - override fun events() = syncEventsFlow + override fun events(roomId: RoomId?) = roomId?.let { syncEventsFlow.map { it.filter { it.roomId == roomId } }.distinctUntilChanged() } ?: syncEventsFlow override suspend fun observeEvent(eventId: EventId) = roomStore.observeEvent(eventId) override suspend fun forceManualRefresh(roomIds: List) { coroutineDispatchers.withIoContext {