1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

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>
This commit is contained in:
ryanml 2022-10-27 03:25:30 -07:00 committed by GitHub
parent c519d3ef91
commit 6c84e9604c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 59 additions and 274 deletions

View File

@ -3104,12 +3104,6 @@
"showAdvancedGasInlineDescription": {
"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": {
"message": "Umwandlung auf Testnets anzeigen"
},

View File

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

View File

@ -3147,12 +3147,6 @@
"showAdvancedGasInlineDescription": {
"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": {
"message": "Show conversion on test networks"
},

View File

@ -3104,12 +3104,6 @@
"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."
},
"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": {
"message": "Mostrar conversión en redes de prueba"
},

View File

@ -3104,12 +3104,6 @@
"showAdvancedGasInlineDescription": {
"message": "Sélectionnez cette option pour afficher le prix du carburant et les contrôles des limites directement sur les écrans denvoi 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 ladresse est préremplie lorsque vous ajoutez un nouveau réseau."
},
"showFiatConversionInTestnets": {
"message": "Afficher la conversion sur les testnets"
},

View File

@ -3104,12 +3104,6 @@
"showAdvancedGasInlineDescription": {
"message": "गैस मूल्य और सीमा नियंत्रण को सीधे भेजने और पुष्टि करने की स्क्रीन पर दिखाने के लिए इसका चयन करें।"
},
"showCustomNetworkList": {
"message": "कस्टम नेटवर्क की सूची दिखाएं"
},
"showCustomNetworkListDescription": {
"message": "नया नेटवर्क जोड़ते समय पहले से भरे हुए विवरण वाले नेटवर्कों की सूची दिखाने के लिए इसे चुनें।"
},
"showFiatConversionInTestnets": {
"message": "टेस्ट नेटवर्क पर रूपांतरण दिखाएं"
},

View File

@ -3104,12 +3104,6 @@
"showAdvancedGasInlineDescription": {
"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": {
"message": "Tampilkan konversi di jaringan uji"
},

View File

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

View File

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

View File

@ -3104,12 +3104,6 @@
"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."
},
"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": {
"message": "Mostrar conversão nas redes de teste"
},

View File

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

View File

@ -3104,12 +3104,6 @@
"showAdvancedGasInlineDescription": {
"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": {
"message": "Ipakita ang Conversion sa Testnets"
},

View File

@ -3104,12 +3104,6 @@
"showAdvancedGasInlineDescription": {
"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": {
"message": "Test ağlarında Dönüşümü göster"
},

View File

@ -3104,12 +3104,6 @@
"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."
},
"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": {
"message": "Hiển thị tỷ lệ quy đổi trên các mạng thử nghiệm"
},

View File

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

View File

@ -69,7 +69,6 @@ export default class PreferencesController {
? LEDGER_TRANSPORT_TYPES.WEBHID
: LEDGER_TRANSPORT_TYPES.U2F,
theme: 'light',
customNetworkListEnabled: false,
...opts.initState,
};
@ -188,17 +187,6 @@ export default class PreferencesController {
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
*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,7 +35,14 @@ describe('Stores custom RPC history', function () {
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 networkNameInput = customRpcInputs[1];
@ -85,7 +92,14 @@ describe('Stores custom RPC history', function () {
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 rpcUrlInput = customRpcInputs[2];
@ -123,7 +137,14 @@ describe('Stores custom RPC history', function () {
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 rpcUrlInput = customRpcInputs[2];
@ -215,7 +236,13 @@ describe('Stores custom RPC history', function () {
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
await driver.clickElement(
'.networks-tab__add-network-form-footer button.btn-secondary',

View File

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

View File

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

View File

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

View File

@ -322,13 +322,6 @@ export const SETTINGS_CONSTANTS = [
icon: 'fa fa-flask',
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'),
sectionMessage: (t) => t('backupUserData'),

View File

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

View File

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

View File

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

View File

@ -20,8 +20,6 @@ export default class ExperimentalTab extends PureComponent {
openSeaEnabled: PropTypes.bool,
eip1559V2Enabled: PropTypes.bool,
setEIP1559V2Enabled: PropTypes.func,
customNetworkListEnabled: PropTypes.bool,
setCustomNetworkListEnabled: PropTypes.func,
};
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() {
return (
<div className="settings-page__body">
{this.renderOpenSeaEnabledToggle()}
{this.renderCollectibleDetectionToggle()}
{this.renderEIP1559V2EnabledToggle()}
{this.renderCustomNetworkListToggle()}
</div>
);
}

View File

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

View File

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

View File

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

View File

@ -102,6 +102,14 @@ export function getCurrentChainId(state) {
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) {
const { qrHardware } = state.metamask;
return qrHardware || {};
@ -872,7 +880,7 @@ function getAllowedAnnouncementIds(state) {
10: true,
11: true,
12: false,
13: true,
13: false,
14: threeBoxSyncingAllowed,
15: true,
};
@ -1168,16 +1176,6 @@ export function getIstokenDetectionInactiveOnNonMainnetSupportedNetwork(state) {
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) {
const chainId = getCurrentChainId(state);

View File

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