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

Fix mobile browser detection for Rainbow mobile wallet #190

Merged
merged 2 commits into from
May 20, 2024

Conversation

johnson86tw
Copy link
Member

@johnson86tw johnson86tw commented May 20, 2024

Previously, isMobileAppBrowser could not be detected as true in the Rainbow embedded browser, causing it to connect to rdns.

The unique aspect of the Rainbow mobile wallet is that it has both an eip6963 provider and window.ethereum.

Solution

Corrected and renamed as isMobileBrowser.

Other considerations

Originally, the intention was to change the strategy to prioritize EIP6963, then fallback to fetching window.ethereum, and finally remove the mobile browser detection mechanism.

However, this approach encountered a roadblock: when a desktop browser disconnects the sole EIP6963 provider and reloads the page, it automatically reconnects to that provider.

As a result, this strategy was abandoned in favor of continuing to use the mobile browser detection mechanism:

If auto-connect is disabled, clicking "connect" in any mobile browser will directly connect to window.ethereum (if available).

If auto-connect is enabled, any mobile browser will automatically connect to window.ethereum upon page load (if available).

@johnson86tw johnson86tw merged commit 0a847fc into main May 20, 2024
1 check passed
@johnson86tw johnson86tw deleted the fix/detect-mobile-browser branch May 20, 2024 04:46
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.

1 participant