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 7405e3b18..c2e514e2a 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/GroupTest.kt @@ -327,10 +327,9 @@ class GroupTest { } @Test - fun testCannotStartEmptyGroupChat() { - assertThrows("Cannot start an empty group chat.", XMTPException::class.java) { - runBlocking { boClient.conversations.newGroup(listOf()) } - } + fun testCanStartEmptyGroupChat() { + val group = runBlocking { boClient.conversations.newGroup(listOf()) } + assert(group.id.isNotEmpty()) } @Test 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 14d024296..40b652ce7 100644 --- a/library/src/main/java/org/xmtp/android/library/Conversations.kt +++ b/library/src/main/java/org/xmtp/android/library/Conversations.kt @@ -108,16 +108,14 @@ data class Conversations( accountAddresses: List, permissions: GroupPermissions = GroupPermissions.EVERYONE_IS_ADMIN, ): Group { - if (accountAddresses.isEmpty()) { - throw XMTPException("Cannot start an empty group chat.") - } if (accountAddresses.size == 1 && accountAddresses.first().lowercase() == client.address.lowercase() ) { throw XMTPException("Recipient is sender") } val falseAddresses = - client.canMessageV3(accountAddresses).filter { !it.value }.map { it.key } + if (accountAddresses.isNotEmpty()) client.canMessageV3(accountAddresses) + .filter { !it.value }.map { it.key } else emptyList() if (falseAddresses.isNotEmpty()) { throw XMTPException("${falseAddresses.joinToString()} not on network") } @@ -150,7 +148,10 @@ data class Conversations( } ?: emptyList() } - private suspend fun handleConsentProof(consentProof: Invitation.ConsentProofPayload, peerAddress: String) { + private suspend fun handleConsentProof( + consentProof: Invitation.ConsentProofPayload, + peerAddress: String, + ) { val signature = consentProof.signature val timestamp = consentProof.timestamp