-
Notifications
You must be signed in to change notification settings - Fork 107
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
Add React Native bridge method to query wallet availability #168
base: main
Are you sure you want to change the base?
Add React Native bridge method to query wallet availability #168
Conversation
@@ -132,7 +132,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion') | |||
dependencies { | |||
//noinspection GradleDynamicVersion | |||
implementation "com.facebook.react:react-native:+" // From node_modules | |||
implementation "com.solanamobile:mobile-wallet-adapter-clientlib:0.2.0" | |||
implementation "com.solanamobile:mobile-wallet-adapter-clientlib:0.2.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hasn't been published yet; to verify that this code compiled, I published to my local Maven repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh can you lazytwitter me and share how to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To finish this up, the new method would have to be threaded through js/packages/mobile-wallet-adapter-protocol/src/__forks__/react-native/transact.ts
.
…but hold up on that. I have some feedback on #169.
@@ -41,6 +41,15 @@ class SolanaMobileWalletAdapterModule(reactContext: ReactApplicationContext) : | |||
return "SolanaMobileWalletAdapter" | |||
} | |||
|
|||
@ReactMethod | |||
fun isWalletAvailable(promise: Promise) { | |||
promise.resolve( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since isWalletEndpointAvailable
is sync, we don't need to do the promise dance. This @ReactMethod
can just return a boolean.
@@ -41,6 +41,15 @@ class SolanaMobileWalletAdapterModule(reactContext: ReactApplicationContext) : | |||
return "SolanaMobileWalletAdapter" | |||
} | |||
|
|||
@ReactMethod | |||
fun isWalletAvailable(promise: Promise) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned that we haven't covered the case where:
- You start a dApp
- It tells you the wallet is not available
- You install the wallet
- You return to your dApp
If your dApp doesn't revalidate every time you foreground it, it will still claim that the wallet is not installed when in fact, it is.
I might add an event emitter to this in the RN SDK that rechecks wallet availability every time the app is foregrounded. I'll finish this up. |
No description provided.