Skip to content

Commit

Permalink
Add context to other create method, connected wallet groups button
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Feb 1, 2024
1 parent 483a479 commit cd4e28d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,14 @@ class XMTPModule : Module() {
preCreateIdentityCallback.takeIf { hasCreateIdentityCallback == true }
val preEnableIdentityCallback: PreEventCallback? =
preEnableIdentityCallback.takeIf { hasEnableIdentityCallback == true }
val context = if (enableAlphaMls == true) context else null

val options = ClientOptions(
api = apiEnvironments(environment, appVersion),
preCreateIdentityCallback = preCreateIdentityCallback,
preEnableIdentityCallback = preEnableIdentityCallback,
enableAlphaMls = enableAlphaMls == true
enableAlphaMls = enableAlphaMls == true,
appContext = context
)
clients[address] = Client().create(account = reactSigner, options = options)
ContentJson.Companion
Expand All @@ -209,8 +212,8 @@ class XMTPModule : Module() {
preCreateIdentityCallback.takeIf { hasCreateIdentityCallback == true }
val preEnableIdentityCallback: PreEventCallback? =
preEnableIdentityCallback.takeIf { hasEnableIdentityCallback == true }

val context = if (enableAlphaMls == true) context else null

val options = ClientOptions(
api = apiEnvironments(environment, appVersion),
preCreateIdentityCallback = preCreateIdentityCallback,
Expand All @@ -227,9 +230,11 @@ class XMTPModule : Module() {
AsyncFunction("createFromKeyBundle") { keyBundle: String, environment: String, appVersion: String?, enableAlphaMls: Boolean? ->
try {
logV("createFromKeyBundle")
val context = if (enableAlphaMls == true) context else null
val options = ClientOptions(
api = apiEnvironments(environment, appVersion),
enableAlphaMls = enableAlphaMls == true
enableAlphaMls = enableAlphaMls == true,
appContext = context
)
val bundle =
PrivateKeyOuterClass.PrivateKeyBundle.parseFrom(
Expand Down
18 changes: 18 additions & 0 deletions example/src/LaunchScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,24 @@ export default function LaunchScreen({
}}
/>
</View>
<View key="connected-groups-local" style={{ margin: 16 }}>
<Button
title="Use Connected Wallet with Groups (local)"
color="purple"
onPress={() => {
configureWallet(
'local',
XMTP.Client.create(signer, {
env: 'local',
appVersion,
preCreateIdentityCallback,
preEnableIdentityCallback,
enableAlphaMls: true,
})
)
}}
/>
</View>
</>
)}
<Divider key="divider-generated" />
Expand Down

0 comments on commit cd4e28d

Please sign in to comment.