-
Notifications
You must be signed in to change notification settings - Fork 113
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
clientlib: add a method to query wallet endpoint availability #169
Conversation
@creativedrewy not sure if we want helper library wrappers for this method - it's so straightforward it might be worth just having consumers call it directly from clientlib @steveluscher I started on the matching changes for RN. I'm embarrassed with how quickly I didn't know the syntax conventions, so I just stopped 🥸: #168 |
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.
Love it! If we want to make a convenience library, we can do it on top of this functionality. But I would say it isn't required for now.
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.
Ooh. I don't love this. Here's a situation we're guaranteed to get into:
- You start a dApp
- It tells you no wallet is available
- You leave the dApp and go install one
- You return to the dApp expecting the ‘no wallet available prompt’ to begone
If the dApp doesn't revalidate wallet availability every time you foreground it, the UI will still claim that no wallet is not installed when in fact, one is.
I've seen this pattern before on regular @solana/wallet-adapter
and it resulted in one of the most regrettable architecture decisions in that library: infinite wallet availability polling.
Counterproposals:
- Leave things the way they are. At the moment that someone goes to take a wallet-y action, throw a wallet-not-found type error so the dApp can show a ‘go install a wallet’ prompt.
- Offer both a one-shot method as in this PR and an event emitter that emits a
walletAvailabilityChange
event, the payload of which is a boolean.
@steveluscher It would be pretty easy in the sample Android apps to re-query on lifecycle methods. That's pretty common to do in Android land. |
Android doesn't let background processes watch for app package installation/removal. While an app is in the background, it's not able to wake up on this change in system state, and so can't emit or process a relevant synthetic event, such as wallet availability changes. The only option for a standard app is to check wallet availability each time the app comes to the foreground. It's polling, but at least it's event-driven and not time-driven 🤷♂️. |
3e96d92
to
c7aac72
Compare
@steveluscher @sdlaver yeah, the "polling" method is what I was referring to. In the activity, when |
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.
Fixes #152