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

Install and lazy loading of Crypto Wallets #9757

Open
bbondy opened this issue May 12, 2020 · 0 comments · May be fixed by brave/brave-core#5513
Open

Install and lazy loading of Crypto Wallets #9757

bbondy opened this issue May 12, 2020 · 0 comments · May be fixed by brave/brave-core#5513

Comments

@bbondy
Copy link
Member

@bbondy bbondy commented May 12, 2020

Overview

Due to the way we implicitly download the Crypto Wallets extension (MetaMask fork) on first use, we have several users that have extra network activity and resource usage that they don’t want or need.

This spec will make it so explicit action is needed for the extension to be downloaded, and will also lazy load the extension if it’s already installed on first use.

Not part of this spec

  • Reducing network activity within the Crypto Wallets extension when it is loaded.

Targeted Platforms

  • Desktop

Description

Explicitly Installing Crypto Wallets

If the user does not have Crypto Wallets installed, but navigates to brave://wallet. They will get a first screen equivalent to the following popup which is built-in via web-ui and NOT part of the Crypto Wallets extension. It will no longer be a popup and will take up the whole screen under the red / purple gradient settings bar.

Screen Shot 2020-05-12 at 3 13 38 PM

Re-opt in for Crypto Wallets if not setup

If a user has not setup Crypto Wallets yet, but the user does have the extension installed, then they will be considered as not installed, and it will show the above screen asking the user to Install. We will check if the user has setup Crypto Wallets based on if the wallet seed is stored in preferences already. These users will be considered as “not installed” in the sections below. I.e. they will need explicit opt-in for the extension to ever be loaded.

Changes to Dapp detection infobar

When a user visits a Dapp page, they are already presented with this infobar:

Screen Shot 2020-05-12 at 3 14 04 PM

The behaviour of the Setup button will change. If the user clicks Setup, a new tab will open with brave://wallet and the infobar will disappear. The page will not reload anymore. This will not auto install the Crypto Wallets extension anymore.

For the equivalent infobar when MetaMask is installed, we’ll change “Use Crypto Wallets” to “Setup Crypto Wallets”. If the user clicks it, it will navigate to brave://wallet and will not auto install the Crypto Wallets extension anymore.

Screen Shot 2020-05-12 at 3 14 43 PM

Startup behaviour

When the Crypto Wallets extension is installed, it will be by default lazily loaded henceforth. So on startup, Crypto Wallets will not be loaded.

The extension will be loaded in the following cases:

  • If the user visits brave://wallet, the extension will be loaded if it is already installed.
  • If the user visits a Dapp page and has Crypto Wallets set as the Dapp provider, but the extension is not loaded yet, the built-in web3 detection will show a new infobar message asking if the user would like to load Crypto Wallets. “Would you like to start Crypto Wallets for web3 support on this page? [ Yes ] [ Settings ]. If the user selects Yes, the extension will be loaded and the page will be reloaded. If the user clicks Settings it will go to the Crypto Wallets settings section described below. The user can also use the [ x ] to get rid of the infobar. If the user has any other Dapp provider setting, no infobar will be shown. If the user would like to stop setting this infobar, they can turn off Crypto Wallets as the Dapp provider in settings.
  • If the new setting described below is on, then on startup it will be loaded.

Settings

A new setting will be added under the existing Web3 provider for using Dapps setting called “Load Crypto Wallets on startup”. It will be defaulted to off.

QA Plan

Test cases 1:

  • Fresh profile, go to brave://wallet, make sure process doesn’t start (You can check via Brave’s Task Manager in the hamburger menu under More Tools).
  • Click the button in Crypto Wallets to opt-in. Task Manager should show that the extension is loaded. Chrome:/settings/extensions should have Crypto Wallets set as the App provider.
  • Close the browser and re-open, you should see Crypto Wallets not listed in Task Manager.
  • Open the browser and the process shouldn’t be there, navigate to brave://wallet again and it should automatically start the process and load the Crypto Wallets interface.
  • Go to Crypto Kitties while the process is still already started, it should not show an infowar and window.web3 should be available in the developer console.
  • Close the browser and re-open it, the crypto kitties tab should prompt for loading the extension.
  • Clicking on Start Crypto Wallets and reload should start the process in task manager and reload the page. window.web3 should be available.
  • Go to settings and click on Load Crypto Wallets on startup
  • Close and open the browser, go to the crypto kitties page and it should not prompt you. It should just have window.web3 available.

Test cases 2:

  • Fresh profile, go to crypto kitties.
  • It should prompt you with an infowar to setup Crypto Wallets. Clicking on Setup should open a new tab and let you opt-in.
  • Going back to the crypto kitties page and manually reloading should have web3 available.

Test case 3:

  • Fresh profile, install MetaMask
  • Go to crypto kitties and in the infowar select to use MetaMask
  • Going to settings should show that MetaMask is selected
  • Going to crypto wallets and opting in, should not change the setting of MetaMask.
  • Closing the browser and then going to Crypto kitties should have web3 available without an infobar. I.e. the lazy loading is only for Crypto Wallets, not MetaMask.

Test case 4:

  • Fresh profile, install MetaMask
  • Go to crypto kitties and in the infowar select to use Crypto Wallets
  • Settings should show Crypto Wallets as the Dapp provider
  • Closing the browser and then going to Crypto kitties should have an infobar asking to start crypto wallets.

Test case 5:

  • Use a profile that existed from a previous version of Brave that had Crypto Wallets fully setup
  • Check to make sure no process for crypto wallets exists in the task manager
  • Navigate to brave://wallet, it should load the extension

Test case 6:

  • Use a profile that existed from a previous version of Brave that had Crypto Wallets installed but not setup
  • Check to make sure no process for crypto wallets exists in the task manager
  • Navigate to brave://wallet, it should NOT load the extension, but require an opt-in
@bbondy bbondy linked a pull request that will close this issue May 12, 2020
10 of 32 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.