diff --git a/library/src/androidTest/java/org/xmtp/android/library/AttachmentTest.kt b/library/src/androidTest/java/org/xmtp/android/library/AttachmentTest.kt index 8dac7c006..f1004dd9a 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/AttachmentTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/AttachmentTest.kt @@ -36,8 +36,8 @@ class AttachmentTest { ) } val messages = runBlocking { aliceConversation.messages() } - assertEquals(messages.size, 2) - if (messages.size == 2) { + assertEquals(messages.size, 1) + if (messages.size == 1) { val content: Attachment? = messages[0].content() assertEquals("test.txt", content?.filename) assertEquals("text/plain", content?.mimeType) diff --git a/library/src/androidTest/java/org/xmtp/android/library/CodecTest.kt b/library/src/androidTest/java/org/xmtp/android/library/CodecTest.kt index b25d160af..0bb08eed5 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/CodecTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/CodecTest.kt @@ -60,8 +60,8 @@ class CodecTest { ) } val messages = runBlocking { aliceConversation.messages() } - assertEquals(messages.size, 2) - if (messages.size == 2) { + assertEquals(messages.size, 1) + if (messages.size == 1) { val content: Double? = messages[0].content() assertEquals(3.14, content) assertEquals("Error: This app does not support numbers.", messages[0].fallbackContent) diff --git a/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt b/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt index 3445effef..6eaad4072 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt @@ -209,10 +209,15 @@ class ConversationsTest { runBlocking { boClient.conversations.sync() boDm?.sync() + alixClient.conversations.sync() alixClient2.conversations.sync() - val dm2 = alixClient2.findConversation(dm.id)!! alixClient2.syncConsent() - assertEquals(dm2.consentState(), ConsentState.DENIED) + alixClient.conversations.syncAllConversations() + Thread.sleep(2000) + alixClient2.conversations.syncAllConversations() + Thread.sleep(2000) + val dm2 = alixClient2.findConversation(dm.id)!! + assertEquals(ConsentState.DENIED, dm2.consentState()) alixClient2.preferences.consentList.setConsentState( listOf( ConsentListEntry( diff --git a/library/src/androidTest/java/org/xmtp/android/library/DmTest.kt b/library/src/androidTest/java/org/xmtp/android/library/DmTest.kt index c1b144253..7945dc540 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/DmTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/DmTest.kt @@ -198,7 +198,7 @@ class DmTest { assertEquals(dm.messages().first().body, "gm") assertEquals(dm.messages().first().id, messageId) assertEquals(dm.messages().first().deliveryStatus, MessageDeliveryStatus.PUBLISHED) - assertEquals(dm.messages().size, 3) + assertEquals(dm.messages().size, 2) runBlocking { alixClient.conversations.sync() } val sameDm = runBlocking { alixClient.conversations.listDms().last() } @@ -215,12 +215,12 @@ class DmTest { dm.send("gm") } - assertEquals(dm.messages().size, 3) - assertEquals(dm.messages(deliveryStatus = MessageDeliveryStatus.PUBLISHED).size, 3) + assertEquals(dm.messages().size, 2) + assertEquals(dm.messages(deliveryStatus = MessageDeliveryStatus.PUBLISHED).size, 2) runBlocking { dm.sync() } - assertEquals(dm.messages().size, 3) + assertEquals(dm.messages().size, 2) assertEquals(dm.messages(deliveryStatus = MessageDeliveryStatus.UNPUBLISHED).size, 0) - assertEquals(dm.messages(deliveryStatus = MessageDeliveryStatus.PUBLISHED).size, 3) + assertEquals(dm.messages(deliveryStatus = MessageDeliveryStatus.PUBLISHED).size, 2) runBlocking { alixClient.conversations.sync() } val sameDm = runBlocking { alixClient.conversations.listDms().last() } @@ -253,7 +253,7 @@ class DmTest { runBlocking { dm.sync() } val messages = dm.messages() - assertEquals(messages.size, 3) + assertEquals(messages.size, 2) val content: Reaction? = messages.first().content() assertEquals("U+1F603", content?.content) assertEquals(messageToReact.id, content?.reference) diff --git a/library/src/androidTest/java/org/xmtp/android/library/ReactionTest.kt b/library/src/androidTest/java/org/xmtp/android/library/ReactionTest.kt index 94f292961..dc653c07d 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/ReactionTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/ReactionTest.kt @@ -89,8 +89,8 @@ class ReactionTest { ) } val messages = runBlocking { aliceConversation.messages() } - assertEquals(messages.size, 3) - if (messages.size == 3) { + assertEquals(messages.size, 2) + if (messages.size == 2) { val content: Reaction? = messages.first().content() assertEquals("U+1F603", content?.content) assertEquals(messageToReact.id, content?.reference) diff --git a/library/src/androidTest/java/org/xmtp/android/library/ReadReceiptTest.kt b/library/src/androidTest/java/org/xmtp/android/library/ReadReceiptTest.kt index 058506a2d..a3941457f 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/ReadReceiptTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/ReadReceiptTest.kt @@ -34,8 +34,8 @@ class ReadReceiptTest { ) } val messages = runBlocking { aliceConversation.messages() } - assertEquals(messages.size, 3) - if (messages.size == 3) { + assertEquals(messages.size, 2) + if (messages.size == 2) { val contentType: String = messages.first().encodedContent.type.typeId assertEquals(contentType, "readReceipt") } diff --git a/library/src/androidTest/java/org/xmtp/android/library/ReplyTest.kt b/library/src/androidTest/java/org/xmtp/android/library/ReplyTest.kt index 413a9644a..ba5e6bf5f 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/ReplyTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/ReplyTest.kt @@ -41,8 +41,8 @@ class ReplyTest { ) } val messages = runBlocking { aliceConversation.messages() } - assertEquals(messages.size, 3) - if (messages.size == 3) { + assertEquals(messages.size, 2) + if (messages.size == 2) { val content: Reply? = messages.first().content() assertEquals("Hello", content?.content) assertEquals(messageToReact.id, content?.reference) diff --git a/library/src/main/java/org/xmtp/android/library/Client.kt b/library/src/main/java/org/xmtp/android/library/Client.kt index 2d1a83292..0bc5246c1 100644 --- a/library/src/main/java/org/xmtp/android/library/Client.kt +++ b/library/src/main/java/org/xmtp/android/library/Client.kt @@ -26,7 +26,7 @@ data class ClientOptions( val dbEncryptionKey: ByteArray, val historySyncUrl: String = when (api.env) { XMTPEnvironment.PRODUCTION -> "https://message-history.production.ephemera.network/" - XMTPEnvironment.LOCAL -> "http://0.0.0.0:5558" + XMTPEnvironment.LOCAL -> "http://10.0.2.2:5558" else -> "https://message-history.dev.ephemera.network/" }, val dbDirectory: String? = null, @@ -64,10 +64,10 @@ class Client() { logger = XMTPLogger(), host = environment.env.getUrl(), isSecure = environment.isSecure, - accountAddress = address + accountAddress = address.lowercase() ) if (inboxId.isNullOrBlank()) { - inboxId = generateInboxId(address, 0.toULong()) + inboxId = generateInboxId(address.lowercase(), 0.toULong()) } return inboxId } @@ -85,7 +85,7 @@ class Client() { inboxId: String, environment: XMTPEnvironment, ) : this() { - this.address = address + this.address = address.lowercase() this.preferences = PrivatePreferences(client = this, ffiClient = libXMTPClient) this.ffiClient = libXMTPClient this.conversations = @@ -170,7 +170,7 @@ class Client() { isSecure = options.api.isSecure, db = dbPath, encryptionKey = options.dbEncryptionKey, - accountAddress = accountAddress, + accountAddress = accountAddress.lowercase(), inboxId = inboxId, nonce = 0.toULong(), legacySignedPrivateKeyProto = null,