diff --git a/example/src/main/java/org/xmtp/android/example/MainViewModel.kt b/example/src/main/java/org/xmtp/android/example/MainViewModel.kt index 7e0d30a2d..ffaa068ac 100644 --- a/example/src/main/java/org/xmtp/android/example/MainViewModel.kt +++ b/example/src/main/java/org/xmtp/android/example/MainViewModel.kt @@ -86,7 +86,7 @@ class MainViewModel : ViewModel() { MainListItem.Footer( id = "footer", ClientManager.client.address, - ClientManager.client.apiClient.environment.name + ClientManager.client.environment.name ) ) _uiState.value = UiState.Success(listItems) diff --git a/example/src/main/java/org/xmtp/android/example/connect/ConnectWalletViewModel.kt b/example/src/main/java/org/xmtp/android/example/connect/ConnectWalletViewModel.kt index 56903b37a..b773b5e88 100644 --- a/example/src/main/java/org/xmtp/android/example/connect/ConnectWalletViewModel.kt +++ b/example/src/main/java/org/xmtp/android/example/connect/ConnectWalletViewModel.kt @@ -90,7 +90,7 @@ class ConnectWalletViewModel(application: Application) : AndroidViewModel(applic Client.register(codec = GroupUpdatedCodec()) _uiState.value = ConnectUiState.Success( wallet.address, - PrivateKeyBundleV1Builder.encodeData(client.privateKeyBundleV1) + PrivateKeyBundleV1Builder.encodeData(client.v1keys) ) } catch (e: XMTPException) { _uiState.value = ConnectUiState.Error(e.message.orEmpty()) @@ -115,7 +115,7 @@ class ConnectWalletViewModel(application: Application) : AndroidViewModel(applic Client.register(codec = GroupUpdatedCodec()) _uiState.value = ConnectUiState.Success( wallet.address, - PrivateKeyBundleV1Builder.encodeData(client.privateKeyBundleV1) + PrivateKeyBundleV1Builder.encodeData(client.v1keys) ) } catch (e: Exception) { _uiState.value = ConnectUiState.Error(e.message.orEmpty()) 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 9d886a309..b70cd9944 100644 --- a/library/src/main/java/org/xmtp/android/library/Client.kt +++ b/library/src/main/java/org/xmtp/android/library/Client.kt @@ -2,6 +2,7 @@ package org.xmtp.android.library import android.content.Context import android.os.Build +import android.os.Environment import android.util.Log import com.google.crypto.tink.subtle.Base64 import com.google.gson.GsonBuilder @@ -94,6 +95,8 @@ class Client() { var dbPath: String = "" lateinit var inboxId: String var hasV2Client: Boolean = true + lateinit var environment: XMTPEnvironment + companion object { private const val TAG = "Client" @@ -197,6 +200,8 @@ class Client() { this.dbPath = dbPath this.installationId = installationId this.inboxId = inboxId + this.hasV2Client = true + this.environment = apiClient.environment } constructor( @@ -205,6 +210,7 @@ class Client() { dbPath: String, installationId: String, inboxId: String, + environment: XMTPEnvironment ) : this() { this.address = address this.contacts = Contacts(client = this) @@ -215,6 +221,7 @@ class Client() { this.installationId = installationId this.inboxId = inboxId this.hasV2Client = false + this.environment = environment } suspend fun buildFrom( @@ -308,7 +315,8 @@ class Client() { client, dbPath, client.installationId().toHex(), - client.inboxId() + client.inboxId(), + options.api.env ) } ?: throw XMTPException("Error creating V3 client: libXMTPClient is null") } catch (e: Exception) {