Skip to content

Commit

Permalink
Log when we have a null key material on android
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Feb 26, 2024
1 parent 388bdf8 commit a614a28
Showing 1 changed file with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -561,6 +567,9 @@ class XMTPModule : Module() {
},
)
)
if (conversation.keyMaterial == null) {
logV("Null key material before encode conversation")
}
ConversationWrapper.encode(client, conversation)
}

Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit a614a28

Please sign in to comment.