Skip to content

Commit

Permalink
fix up the example app
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Sep 18, 2024
1 parent 278d296 commit 646902f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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())
Expand Down
10 changes: 9 additions & 1 deletion library/src/main/java/org/xmtp/android/library/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -197,6 +200,8 @@ class Client() {
this.dbPath = dbPath
this.installationId = installationId
this.inboxId = inboxId
this.hasV2Client = true
this.environment = apiClient.environment
}

constructor(
Expand All @@ -205,6 +210,7 @@ class Client() {
dbPath: String,
installationId: String,
inboxId: String,
environment: XMTPEnvironment
) : this() {
this.address = address
this.contacts = Contacts(client = this)
Expand All @@ -215,6 +221,7 @@ class Client() {
this.installationId = installationId
this.inboxId = inboxId
this.hasV2Client = false
this.environment = environment
}

suspend fun buildFrom(
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 646902f

Please sign in to comment.