Skip to content
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

Allow Disconnect of MWA #960

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

alex-fung
Copy link

@alex-fung alex-fung commented May 9, 2024

Currently, if other wallets are available on a dApp on Android, the only one that can be used is the MWA. This PR updates the WalletProvider so that it won't be auto-selected and can be disconnected if other wallets are available.

Comments posted at alex-fung#1 are already addressed (opened against wrong branch)

Before:
https://github.com/anza-xyz/wallet-adapter/assets/2409008/19a522f9-d8f1-4ad9-8374-03ac8ca35de8

After:
With MWA and another wallet:
https://github.com/anza-xyz/wallet-adapter/assets/2409008/36dca9c4-b585-4017-a84a-0fadeb8c10eb
With just MWA:
https://github.com/anza-xyz/wallet-adapter/assets/2409008/da684467-2791-428d-8783-3a9c5485542c

Copy link
Contributor

@Funkatronics Funkatronics left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and approved by me, but I am not a maintainer here unfortunately. Will need input from @jordaaash or @steveluscher

@alirezaayande92

This comment was marked as spam.

Copy link
Collaborator

@steveluscher steveluscher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood; thanks for this!

I think the original presumption was that there are no wallets that work (or yield a good experience) on mobile web, but I presume TipLink is out there to prove that wrong.

Can you add, to this PR, a quick screencast of how your loadable wallet works so that folks can understand the motivation for this change?

@@ -78,7 +78,9 @@ export function WalletProvider({
}, [adaptersWithStandardAdapters, mobileWalletAdapter]);
const [walletName, setWalletName] = useLocalStorage<WalletName | null>(
localStorageKey,
getIsMobile(adaptersWithStandardAdapters) ? SolanaMobileWalletAdapterWalletName : null
adaptersWithStandardAdapters.length === 0 && getIsMobile(adaptersWithStandardAdapters)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. This has the effect of, if any adapter is included, to not select MWA. The problem with this in practice is that almost all dapps will include adapters, even ones they don't need because they've been deprecated by Standard Wallets, or ones that simply don't work at all on the platform. This is especially true because most dapps I've seen don't use separate mobile builds with conditional compilation of included adapters.

This basically means that it's always going to be false, and we're never even going to do the getIsMobile check. Now, I'm probably fine with eliminating all preference for MWA, but I want to be clear that's what we're doing here, and if so, we might as well just do it outright and remove these checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants