Skip to content

Commit

Permalink
Merge pull request #183 from xmtp/np/register-codecs
Browse files Browse the repository at this point in the history
fix: register codecs on create of clients in android
  • Loading branch information
nplasterer authored Dec 16, 2023
2 parents 0a69bf5 + c1d4217 commit 9e6c8d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class XMTPModule : Module() {
signer = reactSigner
val options = ClientOptions(api = apiEnvironments(environment, appVersion))
clients[address] = Client().create(account = reactSigner, options = options)
ContentJson.Companion
signer = null
sendEvent("authed")
}
Expand All @@ -160,6 +161,7 @@ class XMTPModule : Module() {
val privateKey = PrivateKeyBuilder()
val options = ClientOptions(api = apiEnvironments(environment, appVersion))
val randomClient = Client().create(account = privateKey, options = options)
ContentJson.Companion
clients[randomClient.address] = randomClient
randomClient.address
}
Expand All @@ -176,6 +178,7 @@ class XMTPModule : Module() {
)
)
val client = Client().buildFromBundle(bundle = bundle, options = options)
ContentJson.Companion
clients[client.address] = client
client.address
} catch (e: Exception) {
Expand Down
8 changes: 8 additions & 0 deletions example/src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ test('can make a client', async () => {
env: 'local',
appVersion: 'Testing/0.0.0',
})
client.register(new RemoteAttachmentCodec())
if (Object.keys(client.codecRegistry).length !== 2) {
throw new Error(
`Codecs length should be 2 not ${
Object.keys(client.codecRegistry).length
}`
)
}
return client.address.length > 0
})

Expand Down

0 comments on commit 9e6c8d2

Please sign in to comment.