Join room : change state and view
This commit is contained in:
parent
ab8c31541b
commit
a2329fc7df
11 changed files with 228 additions and 165 deletions
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package io.element.android.libraries.matrix.impl.util
|
||||
|
||||
import io.element.android.libraries.core.data.tryOrNull
|
||||
import kotlinx.coroutines.channels.ProducerScope
|
||||
import kotlinx.coroutines.channels.awaitClose
|
||||
import kotlinx.coroutines.flow.callbackFlow
|
||||
|
|
@ -23,7 +24,9 @@ import org.matrix.rustcomponents.sdk.TaskHandle
|
|||
|
||||
internal fun <T> mxCallbackFlow(block: suspend ProducerScope<T>.() -> TaskHandle?) =
|
||||
callbackFlow {
|
||||
val taskHandle: TaskHandle? = block(this)
|
||||
val taskHandle: TaskHandle? = tryOrNull {
|
||||
block(this)
|
||||
}
|
||||
awaitClose {
|
||||
taskHandle?.cancelAndDestroy()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue