From 43c278d813457650133b6aebf71081d8633414c3 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Thu, 8 Dec 2022 10:42:23 -0600 Subject: [PATCH] Privacy - Show default selected network after a custom network has been added during onboarding (#16789) * Privacy - Allow users to set a custom RPC from the onboarding process (#16767) * Privacy - Allow adding custom IPFS from onboarding (#16782) * Privacy - Show default selected network after a custom network has been added during onboarding * WIP: Show dropdown list of networks * Add network switcher to the onboarding advanced privacy screen * Fix duplicate imports * Provide default for networks * Update ui/helpers/utils/ipfs.js Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> * Fix lint * Remove unwanted changes * Fix lint Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> --- app/_locales/en/messages.json | 24 ++++ .../app/dropdowns/network-dropdown.js | 43 ++++-- ui/components/app/modals/modal.js | 5 + ui/helpers/utils/ipfs.js | 3 + .../add-network-modal/index.js | 43 ++++++ .../privacy-settings/index.scss | 9 ++ .../privacy-settings/privacy-settings.js | 127 +++++++++++++++++- .../privacy-settings/privacy-settings.test.js | 1 + .../privacy-settings/setting.js | 17 ++- ui/pages/routes/routes.component.js | 5 +- ui/pages/routes/routes.container.js | 2 + .../advanced-tab/advanced-tab.component.js | 8 +- .../networks-form/networks-form.js | 15 +-- .../networks-tab-content.js | 9 ++ .../settings/networks-tab/networks-tab.js | 4 + 15 files changed, 279 insertions(+), 36 deletions(-) create mode 100644 ui/helpers/utils/ipfs.js create mode 100644 ui/pages/onboarding-flow/add-network-modal/index.js diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index b24301cee..d023d962c 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -2583,6 +2583,27 @@ "on": { "message": "On" }, + "onboardingAdvancedPrivacyIPFSDescription": { + "message": "The IPFS gateway makes it possible to access and view data hosted by third parties. You can add a custom IPFS gateway or continue using the default." + }, + "onboardingAdvancedPrivacyIPFSInvalid": { + "message": "Please enter a valid URL" + }, + "onboardingAdvancedPrivacyIPFSTitle": { + "message": "Add custom IPFS Gateway" + }, + "onboardingAdvancedPrivacyIPFSValid": { + "message": "IPFS gateway URL is valid" + }, + "onboardingAdvancedPrivacyNetworkButton": { + "message": "Add custom network" + }, + "onboardingAdvancedPrivacyNetworkDescription": { + "message": "We use Infura as our remote procedure call (RPC) provider to offer the most reliable and private access to Ethereum data we can. You can choose your own RPC, but remember that any RPC will receive your IP address and Ethereum wallet to make transactions. Read our $1 to learn more about how Infura handles data." + }, + "onboardingAdvancedPrivacyNetworkTitle": { + "message": "Choose your network" + }, "onboardingCreateWallet": { "message": "Create a new wallet" }, @@ -2617,6 +2638,9 @@ "onboardingMetametricsInfuraTermsPolicyLink": { "message": "here" }, + "onboardingMetametricsModalTitle": { + "message": "Add custom network" + }, "onboardingMetametricsNeverCollect": { "message": "$1 collect information we don’t need to provide the service (such as keys, addresses, transaction hashes, or balances)", "description": "$1 represents `onboardingMetametricsNeverEmphasis`" diff --git a/ui/components/app/dropdowns/network-dropdown.js b/ui/components/app/dropdowns/network-dropdown.js index e23125111..3badd8c07 100644 --- a/ui/components/app/dropdowns/network-dropdown.js +++ b/ui/components/app/dropdowns/network-dropdown.js @@ -101,6 +101,9 @@ class NetworkDropdown extends Component { showTestnetMessageInDropdown: PropTypes.bool.isRequired, hideTestNetMessage: PropTypes.func.isRequired, history: PropTypes.object, + dropdownStyles: PropTypes.object, + hideElementsForOnboarding: PropTypes.bool, + onAddClick: PropTypes.func, }; handleClick(newProviderType) { @@ -122,16 +125,21 @@ class NetworkDropdown extends Component { } renderAddCustomButton() { + const { onAddClick } = this.props; return (
+ ) : null} + + + } + /> + + {t('onboardingAdvancedPrivacyIPFSDescription')} + + { + handleIPFSChange(e.target.value); + }} + /> + {ipfsURL ? ( + + {ipfsError || t('onboardingAdvancedPrivacyIPFSValid')} + + ) : null} + + + } + />