diff --git a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt index 45178da73..e8bd7cced 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt @@ -232,10 +232,10 @@ class GroupTest { boClient.conversations.streamGroups().test { val group = alixClient.conversations.newGroup(listOf(bo.walletAddress)) - assertEquals(group.id.toHex(), awaitItem().topic) + assertEquals(group.id.toHex(), awaitItem().id.toHex()) val group2 = caroClient.conversations.newGroup(listOf(bo.walletAddress)) - assertEquals(group2.id.toHex(), awaitItem().topic) + assertEquals(group2.id.toHex(), awaitItem().id.toHex()) } } 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 1c146ac8c..659ec94b9 100644 --- a/library/src/main/java/org/xmtp/android/library/Conversations.kt +++ b/library/src/main/java/org/xmtp/android/library/Conversations.kt @@ -501,10 +501,10 @@ data class Conversations( } fun streamAll(): Flow { - return merge(streamGroups(), stream()) + return merge(streamGroupConversations(), stream()) } - fun streamGroups(): Flow = callbackFlow { + private fun streamGroupConversations(): Flow = callbackFlow { val groupCallback = object : FfiConversationCallback { override fun onConversation(conversation: FfiGroup) { trySend(Conversation.Group(Group(client, conversation))) @@ -515,6 +515,17 @@ data class Conversations( awaitClose { stream.end() } } + fun streamGroups(): Flow = callbackFlow { + val groupCallback = object : FfiConversationCallback { + override fun onConversation(conversation: FfiGroup) { + trySend(Group(client, conversation)) + } + } + val stream = libXMTPConversations?.stream(groupCallback) + ?: throw XMTPException("Client does not support Groups") + awaitClose { stream.end() } + } + /** * Get the stream of all messages of the current [Client] * @return Flow object of [DecodedMessage] that represents all the messages of the