diff --git a/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt b/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt index 151590484..46f8be27e 100644 --- a/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt +++ b/android/src/main/java/expo/modules/xmtpreactnativesdk/XMTPModule.kt @@ -278,6 +278,9 @@ class XMTPModule : Module() { val data = TopicData.parseFrom(Base64.decode(topicData, NO_WRAP)) val conversation = client.conversations.importTopicData(data) conversations[conversation.cacheKey(clientAddress)] = conversation + if (conversation.keyMaterial == null) { + logV("Null key material before encode conversation") + } ConversationWrapper.encode(client, conversation) } @@ -381,6 +384,9 @@ class XMTPModule : Module() { val conversationList = client.conversations.list() conversationList.map { conversation -> conversations[conversation.cacheKey(clientAddress)] = conversation + if (conversation.keyMaterial == null) { + logV("Null key material before encode conversation") + } ConversationWrapper.encode(client, conversation) } } @@ -561,6 +567,9 @@ class XMTPModule : Module() { }, ) ) + if (conversation.keyMaterial == null) { + logV("Null key material before encode conversation") + } ConversationWrapper.encode(client, conversation) } @@ -713,13 +722,21 @@ class XMTPModule : Module() { subscriptions[getConversationsKey(clientAddress)] = CoroutineScope(Dispatchers.IO).launch { try { client.conversations.stream().collect { conversation -> - sendEvent( - "conversation", - mapOf( - "clientAddress" to clientAddress, - "conversation" to ConversationWrapper.encodeToObj(client, conversation) + run { + if (conversation.keyMaterial == null) { + logV("Null key material before encode conversation") + } + sendEvent( + "conversation", + mapOf( + "clientAddress" to clientAddress, + "conversation" to ConversationWrapper.encodeToObj( + client, + conversation + ) + ) ) - ) + } } } catch (e: Exception) { Log.e("XMTPModule", "Error in conversations subscription: $e")