diff --git a/library/src/main/java/org/xmtp/android/library/ConversationV1.kt b/library/src/main/java/org/xmtp/android/library/ConversationV1.kt index 124242c50..3ce2b7a1a 100644 --- a/library/src/main/java/org/xmtp/android/library/ConversationV1.kt +++ b/library/src/main/java/org/xmtp/android/library/ConversationV1.kt @@ -4,7 +4,7 @@ import android.util.Log import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.callbackFlow -import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.launch import org.web3j.crypto.Hash import org.xmtp.android.library.Util.Companion.envelopeFromFFi import org.xmtp.android.library.codecs.ContentCodec @@ -51,7 +51,7 @@ data class ConversationV1( } } val stream = client.subscribe(listOf(topic.description), streamCallback) - awaitClose { runBlocking { stream.end() } } + awaitClose { launch { stream.end() } } } /** @@ -283,7 +283,7 @@ data class ConversationV1( } } val stream = client.subscribe(listOf(ephemeralTopic), streamCallback) - awaitClose { runBlocking { stream.end() } } + awaitClose { launch { stream.end() } } } fun streamDecryptedMessages(): Flow = callbackFlow { @@ -293,6 +293,6 @@ data class ConversationV1( } } val stream = client.subscribe(listOf(topic.description), streamCallback) - awaitClose { runBlocking { stream.end() } } + awaitClose { launch { stream.end() } } } } diff --git a/library/src/main/java/org/xmtp/android/library/ConversationV2.kt b/library/src/main/java/org/xmtp/android/library/ConversationV2.kt index a33f992ac..e021226ef 100644 --- a/library/src/main/java/org/xmtp/android/library/ConversationV2.kt +++ b/library/src/main/java/org/xmtp/android/library/ConversationV2.kt @@ -4,7 +4,7 @@ import android.util.Log import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.callbackFlow -import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.launch import org.web3j.crypto.Hash import org.xmtp.android.library.codecs.ContentCodec import org.xmtp.android.library.codecs.EncodedContent @@ -149,7 +149,7 @@ data class ConversationV2( } } val stream = client.subscribe(listOf(topic), streamCallback) - awaitClose { runBlocking { stream.end() } } + awaitClose { launch { stream.end() } } } /** @@ -284,7 +284,7 @@ data class ConversationV2( } } val stream = client.subscribe(listOf(ephemeralTopic), streamCallback) - awaitClose { runBlocking { stream.end() } } + awaitClose { launch { stream.end() } } } fun streamDecryptedMessages(): Flow = callbackFlow { @@ -294,6 +294,6 @@ data class ConversationV2( } } val stream = client.subscribe(listOf(topic), streamCallback) - awaitClose { runBlocking { stream.end() } } + awaitClose { launch { stream.end() } } } } diff --git a/library/src/main/java/org/xmtp/android/library/Conversations.kt b/library/src/main/java/org/xmtp/android/library/Conversations.kt index 33a5c8688..928c8a560 100644 --- a/library/src/main/java/org/xmtp/android/library/Conversations.kt +++ b/library/src/main/java/org/xmtp/android/library/Conversations.kt @@ -7,7 +7,6 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.callbackFlow import kotlinx.coroutines.flow.merge import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking import org.xmtp.android.library.GRPCApiClient.Companion.makeQueryRequest import org.xmtp.android.library.Util.Companion.envelopeFromFFi import org.xmtp.android.library.libxmtp.MessageV3 @@ -592,7 +591,7 @@ data class Conversations( subscriptionCallback ) - awaitClose { runBlocking { stream.end() } } + awaitClose { launch { stream.end() } } } fun streamAll(): Flow { @@ -701,7 +700,7 @@ data class Conversations( stream = client.subscribe2(subscriptionRequest, subscriptionCallback) - awaitClose { runBlocking { stream.end() } } + awaitClose { launch { stream.end() } } } fun streamAllMessages(includeGroups: Boolean = false): Flow { @@ -767,6 +766,6 @@ data class Conversations( stream = client.subscribe2(subscriptionRequest, subscriptionCallback) - awaitClose { runBlocking { stream.end() } } + awaitClose { launch { stream.end() } } } }