mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Join room : change state and view
This commit is contained in:
+4
-1
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user