Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small tweaks to tests and classes #321

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,15 @@ class ConversationsTest {
boClient.conversations.sync()
}
val boDm = runBlocking { boClient.findConversation(dm.id) }
alixClient.dropLocalDatabaseConnection()
alixClient.deleteLocalDatabase()

val alixClient2 = runBlocking {
Client().create(
account = alixWallet,
options = ClientOptions(
ClientOptions.Api(XMTPEnvironment.LOCAL, false),
appContext = context,
dbEncryptionKey = key
dbEncryptionKey = key,
dbDirectory = context.filesDir.absolutePath.toString()
)
)
}
Expand Down
8 changes: 4 additions & 4 deletions library/src/main/java/org/xmtp/android/library/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading