1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 13:57:10 +09:00

DROID-2966 Chats | Fix | Misc. fixes (#2452)

This commit is contained in:
Evgenii Kozlov 2025-05-24 14:12:11 +02:00 committed by GitHub
parent e685e4ea53
commit 202cea41f6
Signed by: github
GPG key ID: B5690EEEBB952194
7 changed files with 20 additions and 6 deletions

View file

@ -6,4 +6,5 @@ import kotlinx.coroutines.flow.Flow
interface ChatEventChannel {
fun observe(chat: Id): Flow<List<Event.Command.Chats>>
fun subscribe(subscribe: Id): Flow<List<Event.Command.Chats>>
}

View file

@ -15,6 +15,7 @@ import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.mapNotNull
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.scan
import kotlinx.coroutines.launch
@ -50,7 +51,7 @@ interface ChatPreviewContainer {
.onFailure { logger.logException(it, "DROID-2966 Error while getting initial previews") }
.getOrDefault(emptyList())
events
.observe(SUBSCRIPTION_ID)
.subscribe(SUBSCRIPTION_ID)
.scan(initial = initial) { previews, events ->
events.fold(previews) { state, event ->
when (event) {