Enable "Add Popular Network" feature by default for all users (#16172)

* Enable "Add Popular Network" feature by default

* Fixing e2e tests

* Attempt to fix e2e tests

* Revert "Attempt to fix e2e tests"

This reverts commit d88e8944b8df8f7c3075753f8d8b3480439f8e30.

* Get e2e tests passing

Co-authored-by: Dan J Miller <danjm.com@gmail.com>
feature/default_network_editable
ryanml 2 years ago committed by seaona
parent de0e87e2b2
commit 005d2aff39
  1. 6
      app/_locales/de/messages.json
  2. 6
      app/_locales/el/messages.json
  3. 6
      app/_locales/en/messages.json
  4. 6
      app/_locales/es/messages.json
  5. 6
      app/_locales/fr/messages.json
  6. 6
      app/_locales/hi/messages.json
  7. 6
      app/_locales/id/messages.json
  8. 6
      app/_locales/ja/messages.json
  9. 6
      app/_locales/ko/messages.json
  10. 6
      app/_locales/pt/messages.json
  11. 6
      app/_locales/ru/messages.json
  12. 6
      app/_locales/tl/messages.json
  13. 6
      app/_locales/tr/messages.json
  14. 6
      app/_locales/vi/messages.json
  15. 6
      app/_locales/zh_CN/messages.json
  16. 12
      app/scripts/controllers/preferences.js
  17. 4
      app/scripts/metamask-controller.js
  18. 3
      test/e2e/fixtures/address-entry/state.json
  19. 3
      test/e2e/fixtures/connected-state/state.json
  20. 3
      test/e2e/fixtures/custom-rpc/state.json
  21. 3
      test/e2e/fixtures/custom-token/state.json
  22. 3
      test/e2e/fixtures/eip-1559-v2-dapp/state.json
  23. 3
      test/e2e/fixtures/eip-1559-v2/state.json
  24. 3
      test/e2e/fixtures/import-ui/state.json
  25. 3
      test/e2e/fixtures/imported-account/state.json
  26. 3
      test/e2e/fixtures/localization/state.json
  27. 3
      test/e2e/fixtures/metrics-enabled/state.json
  28. 3
      test/e2e/fixtures/navigate-transactions/state.json
  29. 3
      test/e2e/fixtures/onboarding/state.json
  30. 3
      test/e2e/fixtures/send-edit-v2/state.json
  31. 3
      test/e2e/fixtures/send-edit/state.json
  32. 3
      test/e2e/fixtures/special-settings/state.json
  33. 3
      test/e2e/fixtures/threebox-enabled/state.json
  34. 35
      test/e2e/tests/custom-rpc-history.spec.js
  35. 1
      ui/components/app/add-network/add-network.js
  36. 15
      ui/components/app/dropdowns/network-dropdown.js
  37. 4
      ui/components/app/whats-new-popup/whats-new-popup.js
  38. 7
      ui/helpers/constants/settings.js
  39. 2
      ui/helpers/utils/settings-search.test.js
  40. 3
      ui/pages/routes/routes.component.js
  41. 2
      ui/pages/routes/routes.container.js
  42. 40
      ui/pages/settings/experimental-tab/experimental-tab.component.js
  43. 5
      ui/pages/settings/experimental-tab/experimental-tab.container.js
  44. 14
      ui/pages/settings/networks-tab/networks-tab-subheader/networks-tab-subheader.js
  45. 19
      ui/pages/settings/networks-tab/networks-tab.js
  46. 20
      ui/selectors/selectors.js
  47. 12
      ui/store/actions.js

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "Wählen Sie dies aus, um den Gaspreis und die Limitkontrollen direkt auf den Senden- und Bestätigen-Bildschirmen anzuzeigen." "message": "Wählen Sie dies aus, um den Gaspreis und die Limitkontrollen direkt auf den Senden- und Bestätigen-Bildschirmen anzuzeigen."
}, },
"showCustomNetworkList": {
"message": "Benutzerdefinierte Netzwerkliste anzeigen"
},
"showCustomNetworkListDescription": {
"message": "Diese Option zeigt eine Liste von Netzwerken mit vorausgefüllten Details an, sobald ein neues Netzwerk hinzugefügt wird."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "Umwandlung auf Testnets anzeigen" "message": "Umwandlung auf Testnets anzeigen"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "Επιλέξτε αυτό για να εμφανίσετε τις τιμές αερίου και να περιορίσετε τα στοιχεία ελέγχου απευθείας στις οθόνες αποστολής και επιβεβαίωσης." "message": "Επιλέξτε αυτό για να εμφανίσετε τις τιμές αερίου και να περιορίσετε τα στοιχεία ελέγχου απευθείας στις οθόνες αποστολής και επιβεβαίωσης."
}, },
"showCustomNetworkList": {
"message": "Προβολή Λίστας Προσαρμοσμένων Δικτύων"
},
"showCustomNetworkListDescription": {
"message": "Επιλέξτε αυτό για να εμφανιστεί μια λίστα δικτύων με προσυμπληρωμένα στοιχεία κατά την προσθήκη ενός νέου δικτύου."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "Εμφάνιση Μετατροπής σε Δοκιμαστικά Δίκτυα" "message": "Εμφάνιση Μετατροπής σε Δοκιμαστικά Δίκτυα"
}, },

@ -3136,12 +3136,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "Select this to show gas price and limit controls directly on the send and confirm screens." "message": "Select this to show gas price and limit controls directly on the send and confirm screens."
}, },
"showCustomNetworkList": {
"message": "Show custom network list"
},
"showCustomNetworkListDescription": {
"message": "Select this to show a list of networks with prefilled details when adding a new network."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "Show conversion on test networks" "message": "Show conversion on test networks"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "Seleccione esta opción para mostrar el precio del gas y limitar los controles directamente en las pantallas de envío y confirmación." "message": "Seleccione esta opción para mostrar el precio del gas y limitar los controles directamente en las pantallas de envío y confirmación."
}, },
"showCustomNetworkList": {
"message": "Mostrar lista de redes personalizadas"
},
"showCustomNetworkListDescription": {
"message": "Seleccione esto para mostrar una lista de redes con detalles precargados al agregar una red nueva."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "Mostrar conversión en redes de prueba" "message": "Mostrar conversión en redes de prueba"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "Sélectionnez cette option pour afficher le prix du carburant et les contrôles des limites directement sur les écrans d’envoi et de confirmation." "message": "Sélectionnez cette option pour afficher le prix du carburant et les contrôles des limites directement sur les écrans d’envoi et de confirmation."
}, },
"showCustomNetworkList": {
"message": "Afficher la liste des réseaux personnalisés"
},
"showCustomNetworkListDescription": {
"message": "Sélectionnez cette option pour afficher une liste de réseaux dont l’adresse est préremplie lorsque vous ajoutez un nouveau réseau."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "Afficher la conversion sur les testnets" "message": "Afficher la conversion sur les testnets"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "गस मय और सिरण कजन और पि करनन पर दििए इसक चयन कर।" "message": "गस मय और सिरण कजन और पि करनन पर दििए इसक चयन कर।"
}, },
"showCustomNetworkList": {
"message": "कसटम नटवरक कि"
},
"showCustomNetworkListDescription": {
"message": "नयटवरक ज समय पहल भरए विवरण वटवरििए इस।"
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "टट नटवरक पर रतरण दि" "message": "टट नटवरक पर रतरण दि"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "Pilih ini untuk menampilkan biaya gas dan kontrol batas secara langsung di layar kirim dan konfirmasi." "message": "Pilih ini untuk menampilkan biaya gas dan kontrol batas secara langsung di layar kirim dan konfirmasi."
}, },
"showCustomNetworkList": {
"message": "Tampilkan daftar jaringan khusus"
},
"showCustomNetworkListDescription": {
"message": "Pilih opsi ini untuk menampilkan daftar jaringan dengan detail yang telah diisi saat menambahkan jaringan baru."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "Tampilkan konversi di jaringan uji" "message": "Tampilkan konversi di jaringan uji"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "これを選択すると、ガス代と限度額のコントロールが送金画面と確認画面に直接表示されます。" "message": "これを選択すると、ガス代と限度額のコントロールが送金画面と確認画面に直接表示されます。"
}, },
"showCustomNetworkList": {
"message": "カスタムネットワークリストを表示"
},
"showCustomNetworkListDescription": {
"message": "新規ネットワークの追加時に事前に情報が入力済みのネットワークのリストを表示するには、これを選択します。"
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "テストネット上に変換を表示" "message": "テストネット上に変換を表示"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "이 항목을 선택하면 보내기 및 확인 화면에서 바로 가스 가격과 한도 조절을 확인할 수 있습니다." "message": "이 항목을 선택하면 보내기 및 확인 화면에서 바로 가스 가격과 한도 조절을 확인할 수 있습니다."
}, },
"showCustomNetworkList": {
"message": "커스텀 네트워크 표시"
},
"showCustomNetworkListDescription": {
"message": "이를 선택하면 새로 네트워크를 추가할 때 네트워크 목록에 상세 설명이 함께 나타납니다."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "테스트넷에 전환 표시" "message": "테스트넷에 전환 표시"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "Selecione isso para mostrar o preço do gás e limitar os controles diretamente nas telas de envio e de confirmação." "message": "Selecione isso para mostrar o preço do gás e limitar os controles diretamente nas telas de envio e de confirmação."
}, },
"showCustomNetworkList": {
"message": "Exibir lista de redes personalizadas"
},
"showCustomNetworkListDescription": {
"message": "Selecione esta opção para exibir uma lista de redes com as informações pré-preenchidas ao adicionar uma nova rede."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "Mostrar conversão nas redes de teste" "message": "Mostrar conversão nas redes de teste"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "Выберите это, чтобы отображать цену газа и управление лимитами непосредственно на экранах отправки и подтверждения." "message": "Выберите это, чтобы отображать цену газа и управление лимитами непосредственно на экранах отправки и подтверждения."
}, },
"showCustomNetworkList": {
"message": "Показать пользовательский список сетей"
},
"showCustomNetworkListDescription": {
"message": "Выберите это, чтобы отобразить список сетей с предварительно заполненными данными при добавлении новой сети."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "Показывать конвертацию в тестовых сетях" "message": "Показывать конвертацию в тестовых сетях"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "Piliin ito para direktang maipakita ang presyo ng gas at mga kontrol sa limitasyon sa mga screen ng pagpapadala at pagkumpirma." "message": "Piliin ito para direktang maipakita ang presyo ng gas at mga kontrol sa limitasyon sa mga screen ng pagpapadala at pagkumpirma."
}, },
"showCustomNetworkList": {
"message": "Ipakita ang Listahan ng Custom na Network"
},
"showCustomNetworkListDescription": {
"message": "Piliin ito para magpakita ng listahan ng mga network na may prefilled na mga detalye kapag nagdaragdag ng bagong network."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "Ipakita ang Conversion sa Testnets" "message": "Ipakita ang Conversion sa Testnets"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "Gaz fiyatı ve limit kontrollerini doğrudan gönder ve onayla ekranlarında göstermek için bunu seçin." "message": "Gaz fiyatı ve limit kontrollerini doğrudan gönder ve onayla ekranlarında göstermek için bunu seçin."
}, },
"showCustomNetworkList": {
"message": "Özel Ağ Listesini Göster"
},
"showCustomNetworkListDescription": {
"message": "Yeni bir ağ eklerken önceden doldurulan bilgilerle ağ listesini görüntülenmesi için bunu seçin."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "Test ağlarında Dönüşümü göster" "message": "Test ağlarında Dönüşümü göster"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "Chọn tùy chọn này để hiển thị các quyền kiểm soát giá gas và giới hạn ngay trên màn hình gửi và xác nhận." "message": "Chọn tùy chọn này để hiển thị các quyền kiểm soát giá gas và giới hạn ngay trên màn hình gửi và xác nhận."
}, },
"showCustomNetworkList": {
"message": "Hiển thị danh sách mạng tùy chỉnh"
},
"showCustomNetworkListDescription": {
"message": "Chọn tùy chọn này để hiển thị danh sách các mạng có thông tin được điền sẵn khi thêm mạng mới."
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "Hiển thị tỷ lệ quy đổi trên các mạng thử nghiệm" "message": "Hiển thị tỷ lệ quy đổi trên các mạng thử nghiệm"
}, },

@ -3108,12 +3108,6 @@
"showAdvancedGasInlineDescription": { "showAdvancedGasInlineDescription": {
"message": "选择此项可直接在发送和确认界面显示燃料价格和上限控制。" "message": "选择此项可直接在发送和确认界面显示燃料价格和上限控制。"
}, },
"showCustomNetworkList": {
"message": "显示自定义网络列表"
},
"showCustomNetworkListDescription": {
"message": "选择此项,在添加新网络时就会显示附有预填详细信息的网络列表。"
},
"showFiatConversionInTestnets": { "showFiatConversionInTestnets": {
"message": "在测试网络上显示转换" "message": "在测试网络上显示转换"
}, },

@ -69,7 +69,6 @@ export default class PreferencesController {
? LEDGER_TRANSPORT_TYPES.WEBHID ? LEDGER_TRANSPORT_TYPES.WEBHID
: LEDGER_TRANSPORT_TYPES.U2F, : LEDGER_TRANSPORT_TYPES.U2F,
theme: 'light', theme: 'light',
customNetworkListEnabled: false,
...opts.initState, ...opts.initState,
}; };
@ -188,17 +187,6 @@ export default class PreferencesController {
this.store.updateState({ theme: val }); this.store.updateState({ theme: val });
} }
/**
* Setter for the `customNetworkListEnabled` property
*
* @param customNetworkListEnabled
*/
setCustomNetworkListEnabled(customNetworkListEnabled) {
this.store.updateState({
customNetworkListEnabled,
});
}
/** /**
* Add new methodData to state, to avoid requesting this information again through Infura * Add new methodData to state, to avoid requesting this information again through Infura
* *

@ -1642,10 +1642,6 @@ export default class MetamaskController extends EventEmitter {
preferencesController, preferencesController,
), ),
setTheme: preferencesController.setTheme.bind(preferencesController), setTheme: preferencesController.setTheme.bind(preferencesController),
setCustomNetworkListEnabled:
preferencesController.setCustomNetworkListEnabled.bind(
preferencesController,
),
// AssetsContractController // AssetsContractController
getTokenStandardAndDetails: this.getTokenStandardAndDetails.bind(this), getTokenStandardAndDetails: this.getTokenStandardAndDetails.bind(this),

@ -76,9 +76,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -66,9 +66,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -62,9 +62,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -78,9 +78,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -63,9 +63,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -63,9 +63,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -117,9 +117,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -62,9 +62,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -62,9 +62,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -66,9 +66,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -62,9 +62,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -37,9 +37,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -63,9 +63,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -63,9 +63,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -62,9 +62,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -73,9 +73,6 @@
"12": { "12": {
"isShown": true "isShown": true
}, },
"13": {
"isShown": true
},
"14": { "14": {
"isShown": true "isShown": true
}, },

@ -35,7 +35,14 @@ describe('Stores custom RPC history', function () {
await driver.clickElement({ text: 'Add network', tag: 'button' }); await driver.clickElement({ text: 'Add network', tag: 'button' });
await driver.findElement('.networks-tab__sub-header-text'); await driver.findElement('.add-network__networks-container');
await driver.clickElement({
text: 'Add a network manually',
tag: 'h6',
});
await driver.findElement('.networks-tab__subheader');
const customRpcInputs = await driver.findElements('input[type="text"]'); const customRpcInputs = await driver.findElements('input[type="text"]');
const networkNameInput = customRpcInputs[1]; const networkNameInput = customRpcInputs[1];
@ -85,7 +92,14 @@ describe('Stores custom RPC history', function () {
await driver.clickElement({ text: 'Add network', tag: 'button' }); await driver.clickElement({ text: 'Add network', tag: 'button' });
await driver.findElement('.networks-tab__sub-header-text'); await driver.findElement('.add-network__networks-container');
await driver.clickElement({
text: 'Add a network manually',
tag: 'h6',
});
await driver.findElement('.networks-tab__subheader');
const customRpcInputs = await driver.findElements('input[type="text"]'); const customRpcInputs = await driver.findElements('input[type="text"]');
const rpcUrlInput = customRpcInputs[2]; const rpcUrlInput = customRpcInputs[2];
@ -123,7 +137,14 @@ describe('Stores custom RPC history', function () {
await driver.clickElement({ text: 'Add network', tag: 'button' }); await driver.clickElement({ text: 'Add network', tag: 'button' });
await driver.findElement('.networks-tab__sub-header-text'); await driver.findElement('.add-network__networks-container');
await driver.clickElement({
text: 'Add a network manually',
tag: 'h6',
});
await driver.findElement('.networks-tab__subheader');
const customRpcInputs = await driver.findElements('input[type="text"]'); const customRpcInputs = await driver.findElements('input[type="text"]');
const rpcUrlInput = customRpcInputs[2]; const rpcUrlInput = customRpcInputs[2];
@ -215,7 +236,13 @@ describe('Stores custom RPC history', function () {
await driver.clickElement({ text: 'Add network', tag: 'button' }); await driver.clickElement({ text: 'Add network', tag: 'button' });
await driver.findVisibleElement('.settings-page__content'); await driver.findElement('.add-network__networks-container');
await driver.clickElement({
text: 'Add a network manually',
tag: 'h6',
});
// // cancel new custom rpc // // cancel new custom rpc
await driver.clickElement( await driver.clickElement(
'.networks-tab__add-network-form-footer button.btn-secondary', '.networks-tab__add-network-form-footer button.btn-secondary',

@ -258,6 +258,7 @@ const AddNetwork = () => {
> >
<Button <Button
type="link" type="link"
data-testid="add-network-manually"
onClick={(event) => { onClick={(event) => {
event.preventDefault(); event.preventDefault();
getEnvironmentType() === ENVIRONMENT_TYPE_POPUP getEnvironmentType() === ENVIRONMENT_TYPE_POPUP

@ -19,7 +19,6 @@ import { getEnvironmentType } from '../../../../app/scripts/lib/util';
import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app'; import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app';
import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics'; import { EVENT, EVENT_NAMES } from '../../../../shared/constants/metametrics';
import { import {
ADD_NETWORK_ROUTE,
ADD_POPULAR_CUSTOM_NETWORK, ADD_POPULAR_CUSTOM_NETWORK,
ADVANCED_ROUTE, ADVANCED_ROUTE,
} from '../../../helpers/constants/routes'; } from '../../../helpers/constants/routes';
@ -50,7 +49,6 @@ function mapStateToProps(state) {
frequentRpcListDetail: state.metamask.frequentRpcListDetail || [], frequentRpcListDetail: state.metamask.frequentRpcListDetail || [],
networkDropdownOpen: state.appState.networkDropdownOpen, networkDropdownOpen: state.appState.networkDropdownOpen,
showTestnetMessageInDropdown: state.metamask.showTestnetMessageInDropdown, showTestnetMessageInDropdown: state.metamask.showTestnetMessageInDropdown,
addPopularNetworkFeatureToggledOn: state.metamask.customNetworkListEnabled,
}; };
} }
@ -103,7 +101,6 @@ class NetworkDropdown extends Component {
showTestnetMessageInDropdown: PropTypes.bool.isRequired, showTestnetMessageInDropdown: PropTypes.bool.isRequired,
hideTestNetMessage: PropTypes.func.isRequired, hideTestNetMessage: PropTypes.func.isRequired,
history: PropTypes.object, history: PropTypes.object,
addPopularNetworkFeatureToggledOn: PropTypes.bool,
}; };
handleClick(newProviderType) { handleClick(newProviderType) {
@ -130,13 +127,11 @@ class NetworkDropdown extends Component {
<Button <Button
type="secondary" type="secondary"
onClick={() => { onClick={() => {
if (this.props.addPopularNetworkFeatureToggledOn) { getEnvironmentType() === ENVIRONMENT_TYPE_POPUP
this.props.history.push(ADD_POPULAR_CUSTOM_NETWORK); ? global.platform.openExtensionInBrowser(
} else { ADD_POPULAR_CUSTOM_NETWORK,
getEnvironmentType() === ENVIRONMENT_TYPE_POPUP )
? global.platform.openExtensionInBrowser(ADD_NETWORK_ROUTE) : this.props.history.push(ADD_POPULAR_CUSTOM_NETWORK);
: this.props.history.push(ADD_NETWORK_ROUTE);
}
this.props.hideNetworkDropdown(); this.props.hideNetworkDropdown();
}} }}
> >

@ -54,10 +54,6 @@ function getActionFunctionById(id, history) {
updateViewedNotifications({ 12: true }); updateViewedNotifications({ 12: true });
history.push(EXPERIMENTAL_ROUTE); history.push(EXPERIMENTAL_ROUTE);
}, },
13: () => {
updateViewedNotifications({ 13: true });
history.push(`${EXPERIMENTAL_ROUTE}#show-custom-network`);
},
14: () => { 14: () => {
updateViewedNotifications({ 14: true }); updateViewedNotifications({ 14: true });
history.push(`${ADVANCED_ROUTE}#backup-userdata`); history.push(`${ADVANCED_ROUTE}#backup-userdata`);

@ -322,13 +322,6 @@ export const SETTINGS_CONSTANTS = [
icon: 'fa fa-flask', icon: 'fa fa-flask',
featureFlag: 'COLLECTIBLES_V1', featureFlag: 'COLLECTIBLES_V1',
}, },
{
tabMessage: (t) => t('experimental'),
sectionMessage: (t) => t('showCustomNetworkList'),
descriptionMessage: (t) => t('showCustomNetworkListDescription'),
route: `${EXPERIMENTAL_ROUTE}#show-custom-network`,
icon: 'fa fa-flask',
},
{ {
tabMessage: (t) => t('advanced'), tabMessage: (t) => t('advanced'),
sectionMessage: (t) => t('backupUserData'), sectionMessage: (t) => t('backupUserData'),

@ -186,7 +186,7 @@ describe('Settings Search Utils', () => {
it('should get good experimental section number', () => { it('should get good experimental section number', () => {
expect(getNumberOfSettingsInSection(t, t('experimental'))).toStrictEqual( expect(getNumberOfSettingsInSection(t, t('experimental'))).toStrictEqual(
2, 1,
); );
}); });

@ -114,6 +114,7 @@ export default class Routes extends Component {
shouldShowSeedPhraseReminder: PropTypes.bool, shouldShowSeedPhraseReminder: PropTypes.bool,
portfolioTooltipIsBeingShown: PropTypes.bool, portfolioTooltipIsBeingShown: PropTypes.bool,
forgottenPassword: PropTypes.bool, forgottenPassword: PropTypes.bool,
isCurrentProviderCustom: PropTypes.bool,
}; };
static contextTypes = { static contextTypes = {
@ -377,6 +378,7 @@ export default class Routes extends Component {
currentChainId, currentChainId,
shouldShowSeedPhraseReminder, shouldShowSeedPhraseReminder,
portfolioTooltipIsBeingShown, portfolioTooltipIsBeingShown,
isCurrentProviderCustom,
} = this.props; } = this.props;
const loadMessage = const loadMessage =
loadingMessage || isNetworkLoading loadingMessage || isNetworkLoading
@ -388,6 +390,7 @@ export default class Routes extends Component {
currentChainId && currentChainId &&
!isTestNet && !isTestNet &&
!isNetworkUsed && !isNetworkUsed &&
!isCurrentProviderCustom &&
allAccountsOnNetworkAreEmpty; allAccountsOnNetworkAreEmpty;
const windowType = getEnvironmentType(); const windowType = getEnvironmentType();

@ -12,6 +12,7 @@ import {
getCurrentChainId, getCurrentChainId,
getShouldShowSeedPhraseReminder, getShouldShowSeedPhraseReminder,
getShowPortfolioTooltip, getShowPortfolioTooltip,
isCurrentProviderCustom,
} from '../../selectors'; } from '../../selectors';
import { import {
lockMetamask, lockMetamask,
@ -53,6 +54,7 @@ function mapStateToProps(state) {
shouldShowSeedPhraseReminder: getShouldShowSeedPhraseReminder(state), shouldShowSeedPhraseReminder: getShouldShowSeedPhraseReminder(state),
portfolioTooltipIsBeingShown: getShowPortfolioTooltip(state), portfolioTooltipIsBeingShown: getShowPortfolioTooltip(state),
forgottenPassword: state.metamask.forgottenPassword, forgottenPassword: state.metamask.forgottenPassword,
isCurrentProviderCustom: isCurrentProviderCustom(state),
}; };
} }

@ -20,8 +20,6 @@ export default class ExperimentalTab extends PureComponent {
openSeaEnabled: PropTypes.bool, openSeaEnabled: PropTypes.bool,
eip1559V2Enabled: PropTypes.bool, eip1559V2Enabled: PropTypes.bool,
setEIP1559V2Enabled: PropTypes.func, setEIP1559V2Enabled: PropTypes.func,
customNetworkListEnabled: PropTypes.bool,
setCustomNetworkListEnabled: PropTypes.func,
}; };
settingsRefs = Array( settingsRefs = Array(
@ -192,50 +190,12 @@ export default class ExperimentalTab extends PureComponent {
); );
} }
renderCustomNetworkListToggle() {
const { t } = this.context;
const { customNetworkListEnabled, setCustomNetworkListEnabled } =
this.props;
return (
<div ref={this.settingsRefs[5]} className="settings-page__content-row">
<div className="settings-page__content-item">
<span>{t('showCustomNetworkList')}</span>
<div className="settings-page__content-description">
{t('showCustomNetworkListDescription')}
</div>
</div>
<div className="settings-page__content-item">
<div className="settings-page__content-item-col">
<ToggleButton
value={customNetworkListEnabled}
onToggle={(value) => {
this.context.trackEvent({
category: EVENT.CATEGORIES.SETTINGS,
event: 'Enabled/Disable CustomNetworkList',
properties: {
action: 'Enabled/Disable CustomNetworkList',
legacy_event: true,
},
});
setCustomNetworkListEnabled(!value);
}}
offLabel={t('off')}
onLabel={t('on')}
/>
</div>
</div>
</div>
);
}
render() { render() {
return ( return (
<div className="settings-page__body"> <div className="settings-page__body">
{this.renderOpenSeaEnabledToggle()} {this.renderOpenSeaEnabledToggle()}
{this.renderCollectibleDetectionToggle()} {this.renderCollectibleDetectionToggle()}
{this.renderEIP1559V2EnabledToggle()} {this.renderEIP1559V2EnabledToggle()}
{this.renderCustomNetworkListToggle()}
</div> </div>
); );
} }

@ -5,13 +5,11 @@ import {
setUseCollectibleDetection, setUseCollectibleDetection,
setOpenSeaEnabled, setOpenSeaEnabled,
setEIP1559V2Enabled, setEIP1559V2Enabled,
setCustomNetworkListEnabled,
} from '../../../store/actions'; } from '../../../store/actions';
import { import {
getUseCollectibleDetection, getUseCollectibleDetection,
getOpenSeaEnabled, getOpenSeaEnabled,
getEIP1559V2Enabled, getEIP1559V2Enabled,
getIsCustomNetworkListEnabled,
} from '../../../selectors'; } from '../../../selectors';
import ExperimentalTab from './experimental-tab.component'; import ExperimentalTab from './experimental-tab.component';
@ -20,7 +18,6 @@ const mapStateToProps = (state) => {
useCollectibleDetection: getUseCollectibleDetection(state), useCollectibleDetection: getUseCollectibleDetection(state),
openSeaEnabled: getOpenSeaEnabled(state), openSeaEnabled: getOpenSeaEnabled(state),
eip1559V2Enabled: getEIP1559V2Enabled(state), eip1559V2Enabled: getEIP1559V2Enabled(state),
customNetworkListEnabled: getIsCustomNetworkListEnabled(state),
}; };
}; };
@ -30,8 +27,6 @@ const mapDispatchToProps = (dispatch) => {
dispatch(setUseCollectibleDetection(val)), dispatch(setUseCollectibleDetection(val)),
setOpenSeaEnabled: (val) => dispatch(setOpenSeaEnabled(val)), setOpenSeaEnabled: (val) => dispatch(setOpenSeaEnabled(val)),
setEIP1559V2Enabled: (val) => dispatch(setEIP1559V2Enabled(val)), setEIP1559V2Enabled: (val) => dispatch(setEIP1559V2Enabled(val)),
setCustomNetworkListEnabled: (val) =>
dispatch(setCustomNetworkListEnabled(val)),
}; };
}; };

@ -1,21 +1,13 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import { useSelector } from 'react-redux';
import { useI18nContext } from '../../../../hooks/useI18nContext'; import { useI18nContext } from '../../../../hooks/useI18nContext';
import { import { ADD_POPULAR_CUSTOM_NETWORK } from '../../../../helpers/constants/routes';
ADD_NETWORK_ROUTE,
ADD_POPULAR_CUSTOM_NETWORK,
} from '../../../../helpers/constants/routes';
import Button from '../../../../components/ui/button'; import Button from '../../../../components/ui/button';
import { getIsCustomNetworkListEnabled } from '../../../../selectors';
const NetworksFormSubheader = ({ addNewNetwork }) => { const NetworksFormSubheader = ({ addNewNetwork }) => {
const t = useI18nContext(); const t = useI18nContext();
const history = useHistory(); const history = useHistory();
const addPopularNetworkFeatureToggledOn = useSelector(
getIsCustomNetworkListEnabled,
);
return addNewNetwork ? ( return addNewNetwork ? (
<div className="networks-tab__subheader"> <div className="networks-tab__subheader">
@ -35,9 +27,7 @@ const NetworksFormSubheader = ({ addNewNetwork }) => {
type="primary" type="primary"
onClick={(event) => { onClick={(event) => {
event.preventDefault(); event.preventDefault();
addPopularNetworkFeatureToggledOn history.push(ADD_POPULAR_CUSTOM_NETWORK);
? history.push(ADD_POPULAR_CUSTOM_NETWORK)
: history.push(ADD_NETWORK_ROUTE);
}} }}
> >
{t('addANetwork')} {t('addANetwork')}

@ -5,7 +5,6 @@ import { useLocation, useHistory } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { useI18nContext } from '../../../hooks/useI18nContext'; import { useI18nContext } from '../../../hooks/useI18nContext';
import { import {
ADD_NETWORK_ROUTE,
ADD_POPULAR_CUSTOM_NETWORK, ADD_POPULAR_CUSTOM_NETWORK,
NETWORKS_FORM_ROUTE, NETWORKS_FORM_ROUTE,
} from '../../../helpers/constants/routes'; } from '../../../helpers/constants/routes';
@ -15,7 +14,6 @@ import { getEnvironmentType } from '../../../../app/scripts/lib/util';
import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../shared/constants/app'; import { ENVIRONMENT_TYPE_FULLSCREEN } from '../../../../shared/constants/app';
import { import {
getFrequentRpcListDetail, getFrequentRpcListDetail,
getIsCustomNetworkListEnabled,
getNetworksTabSelectedRpcUrl, getNetworksTabSelectedRpcUrl,
getProvider, getProvider,
} from '../../../selectors'; } from '../../../selectors';
@ -50,9 +48,6 @@ const NetworksTab = ({ addNewNetwork }) => {
const frequentRpcListDetail = useSelector(getFrequentRpcListDetail); const frequentRpcListDetail = useSelector(getFrequentRpcListDetail);
const provider = useSelector(getProvider); const provider = useSelector(getProvider);
const networksTabSelectedRpcUrl = useSelector(getNetworksTabSelectedRpcUrl); const networksTabSelectedRpcUrl = useSelector(getNetworksTabSelectedRpcUrl);
const addPopularNetworkFeatureToggledOn = useSelector(
getIsCustomNetworkListEnabled,
);
const frequentRpcNetworkListDetails = frequentRpcListDetail.map((rpc) => { const frequentRpcNetworkListDetails = frequentRpcListDetail.map((rpc) => {
return { return {
@ -127,15 +122,11 @@ const NetworksTab = ({ addNewNetwork }) => {
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
if (addPopularNetworkFeatureToggledOn) { isFullScreen
history.push(ADD_POPULAR_CUSTOM_NETWORK); ? history.push(ADD_POPULAR_CUSTOM_NETWORK)
} else { : global.platform.openExtensionInBrowser(
isFullScreen ADD_POPULAR_CUSTOM_NETWORK,
? history.push(ADD_NETWORK_ROUTE) );
: global.platform.openExtensionInBrowser(
ADD_NETWORK_ROUTE,
);
}
}} }}
> >
{t('addNetwork')} {t('addNetwork')}

@ -102,6 +102,14 @@ export function getCurrentChainId(state) {
return chainId; return chainId;
} }
export function isCurrentProviderCustom(state) {
const provider = getProvider(state);
return (
provider.type === NETWORK_TYPES.RPC &&
!Object.values(CHAIN_IDS).includes(provider.chainId)
);
}
export function getCurrentQRHardwareState(state) { export function getCurrentQRHardwareState(state) {
const { qrHardware } = state.metamask; const { qrHardware } = state.metamask;
return qrHardware || {}; return qrHardware || {};
@ -869,7 +877,7 @@ function getAllowedAnnouncementIds(state) {
10: true, 10: true,
11: true, 11: true,
12: false, 12: false,
13: true, 13: false,
14: threeBoxSyncingAllowed, 14: threeBoxSyncingAllowed,
15: true, 15: true,
}; };
@ -1165,16 +1173,6 @@ export function getIstokenDetectionInactiveOnNonMainnetSupportedNetwork(state) {
return isDynamicTokenListAvailable && !useTokenDetection && !isMainnet; return isDynamicTokenListAvailable && !useTokenDetection && !isMainnet;
} }
/**
* To get the `customNetworkListEnabled` value which determines whether we use the custom network list
*
* @param {*} state
* @returns Boolean
*/
export function getIsCustomNetworkListEnabled(state) {
return state.metamask.customNetworkListEnabled;
}
export function getIsCustomNetwork(state) { export function getIsCustomNetwork(state) {
const chainId = getCurrentChainId(state); const chainId = getCurrentChainId(state);

@ -3891,18 +3891,6 @@ export function setEnableEIP1559V2NoticeDismissed() {
return submitRequestToBackground('setEnableEIP1559V2NoticeDismissed', [true]); return submitRequestToBackground('setEnableEIP1559V2NoticeDismissed', [true]);
} }
export function setCustomNetworkListEnabled(customNetworkListEnabled) {
return async () => {
try {
await submitRequestToBackground('setCustomNetworkListEnabled', [
customNetworkListEnabled,
]);
} catch (error) {
log.error(error);
}
};
}
export function setFirstTimeUsedNetwork(chainId) { export function setFirstTimeUsedNetwork(chainId) {
return submitRequestToBackground('setFirstTimeUsedNetwork', [chainId]); return submitRequestToBackground('setFirstTimeUsedNetwork', [chainId]);
} }

Loading…
Cancel
Save