diff --git a/library/src/androidTest/java/org/xmtp/android/library/ClientTest.kt b/library/src/androidTest/java/org/xmtp/android/library/ClientTest.kt index 55889e5a3..59bcb4956 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/ClientTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/ClientTest.kt @@ -55,7 +55,7 @@ class ClientTest { appContext = context, dbEncryptionKey = key ) - val inboxId = runBlocking { Client.getOrCreateInboxId(options, fakeWallet.address) } + val inboxId = runBlocking { Client.getOrCreateInboxId(options.api, fakeWallet.address) } val client = runBlocking { Client().create( account = fakeWallet, 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 5dda00093..3445effef 100644 --- a/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt +++ b/library/src/androidTest/java/org/xmtp/android/library/ConversationsTest.kt @@ -190,8 +190,6 @@ class ConversationsTest { boClient.conversations.sync() } val boDm = runBlocking { boClient.findConversation(dm.id) } - alixClient.dropLocalDatabaseConnection() - alixClient.deleteLocalDatabase() val alixClient2 = runBlocking { Client().create( @@ -199,7 +197,8 @@ class ConversationsTest { options = ClientOptions( ClientOptions.Api(XMTPEnvironment.LOCAL, false), appContext = context, - dbEncryptionKey = key + dbEncryptionKey = key, + dbDirectory = context.filesDir.absolutePath.toString() ) ) } 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 749126042..dd4e16ad0 100644 --- a/library/src/main/java/org/xmtp/android/library/Client.kt +++ b/library/src/main/java/org/xmtp/android/library/Client.kt @@ -58,11 +58,11 @@ class Client() { registry } - suspend fun getOrCreateInboxId(options: ClientOptions, address: String): String { + suspend fun getOrCreateInboxId(environment: ClientOptions.Api, address: String): String { var inboxId = getInboxIdForAddress( logger = XMTPLogger(), - host = options.api.env.getUrl(), - isSecure = options.api.isSecure, + host = environment.env.getUrl(), + isSecure = environment.isSecure, accountAddress = address ) if (inboxId.isNullOrBlank()) { @@ -101,7 +101,7 @@ class Client() { signingKey: SigningKey? = null, ): Client { val accountAddress = address.lowercase() - val inboxId = getOrCreateInboxId(clientOptions, accountAddress) + val inboxId = getOrCreateInboxId(clientOptions.api, accountAddress) val (ffiClient, dbPath) = createFfiClient( accountAddress, diff --git a/library/src/main/java/org/xmtp/android/library/Conversation.kt b/library/src/main/java/org/xmtp/android/library/Conversation.kt index 8177e858e..dc6310667 100644 --- a/library/src/main/java/org/xmtp/android/library/Conversation.kt +++ b/library/src/main/java/org/xmtp/android/library/Conversation.kt @@ -112,6 +112,13 @@ sealed class Conversation { } } + suspend fun publishMessages() { + return when (this) { + is Group -> group.publishMessages() + is Dm -> dm.publishMessages() + } + } + val client: Client get() { return when (this) {