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:
parent
e685e4ea53
commit
202cea41f6
7 changed files with 20 additions and 6 deletions
|
@ -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>>
|
||||
}
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue