mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 12:07:26 +00:00
Fix NewMessage with ONS
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
@file:JvmName("PromiseUtilities")
|
||||
package org.session.libsignal.utilities
|
||||
|
||||
import kotlinx.coroutines.channels.awaitClose
|
||||
import kotlinx.coroutines.flow.callbackFlow
|
||||
import kotlinx.coroutines.isActive
|
||||
import nl.komponents.kovenant.Promise
|
||||
import nl.komponents.kovenant.deferred
|
||||
import nl.komponents.kovenant.functional.map
|
||||
@@ -70,19 +67,3 @@ infix fun <V, E: Exception> Promise<V, E>.sideEffect(
|
||||
callback(it)
|
||||
it
|
||||
}
|
||||
|
||||
/**
|
||||
* Observe a [Promise] as a flow
|
||||
*
|
||||
* Warning: Promise will not be canceled on unsubscribe.
|
||||
*/
|
||||
fun <V, E: Exception> Promise<V, E>.asFlow() = callbackFlow {
|
||||
success {
|
||||
if (isActive) trySend(it)
|
||||
close()
|
||||
} fail {
|
||||
close(it)
|
||||
}
|
||||
|
||||
awaitClose()
|
||||
}
|
||||
|
Reference in New Issue
Block a user