2021-02-04 19:15:23 +01:00
|
|
|
import { compose } from 'redux';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import { withRouter } from 'react-router-dom';
|
2019-03-25 17:13:23 +01:00
|
|
|
import {
|
|
|
|
displayWarning,
|
|
|
|
setFeatureFlag,
|
|
|
|
showModal,
|
|
|
|
setShowFiatConversionOnTestnetsPreference,
|
2021-10-28 21:31:05 +02:00
|
|
|
setShowTestNetworks,
|
2020-01-21 23:09:53 +01:00
|
|
|
setAutoLockTimeLimit,
|
2019-09-27 06:30:36 +02:00
|
|
|
setUseNonceField,
|
2021-11-08 16:28:40 +01:00
|
|
|
setLedgerTransportPreference,
|
2021-05-05 15:58:29 +02:00
|
|
|
setDismissSeedBackUpReminder,
|
2023-02-06 17:47:50 +01:00
|
|
|
setDisabledRpcMethodPreference,
|
2022-08-09 20:36:32 +02:00
|
|
|
backupUserData,
|
|
|
|
restoreUserData,
|
2021-02-04 19:15:23 +01:00
|
|
|
} from '../../../store/actions';
|
|
|
|
import { getPreferences } from '../../../selectors';
|
2021-10-21 21:17:03 +02:00
|
|
|
import { doesUserHaveALedgerAccount } from '../../../ducks/metamask/metamask';
|
2021-02-04 19:15:23 +01:00
|
|
|
import AdvancedTab from './advanced-tab.component';
|
2019-03-25 17:13:23 +01:00
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
export const mapStateToProps = (state) => {
|
2019-03-25 17:13:23 +01:00
|
|
|
const {
|
2020-11-03 00:41:28 +01:00
|
|
|
appState: { warning },
|
|
|
|
metamask,
|
2021-02-04 19:15:23 +01:00
|
|
|
} = state;
|
2020-11-03 00:41:28 +01:00
|
|
|
const {
|
2023-03-27 08:45:17 +02:00
|
|
|
featureFlags: { sendHexData } = {},
|
2023-02-06 17:47:50 +01:00
|
|
|
disabledRpcMethodPreferences,
|
2019-09-27 06:30:36 +02:00
|
|
|
useNonceField,
|
2021-10-21 21:17:03 +02:00
|
|
|
ledgerTransportType,
|
2021-05-05 15:58:29 +02:00
|
|
|
dismissSeedBackUpReminder,
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(desktop)
|
2023-02-23 17:39:48 +01:00
|
|
|
desktopEnabled,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2021-02-04 19:15:23 +01:00
|
|
|
} = metamask;
|
2021-10-28 21:31:05 +02:00
|
|
|
const {
|
|
|
|
showFiatInTestnets,
|
|
|
|
showTestNetworks,
|
2022-05-10 18:57:11 +02:00
|
|
|
autoLockTimeLimit = 0,
|
2021-10-28 21:31:05 +02:00
|
|
|
} = getPreferences(state);
|
2019-03-25 17:13:23 +01:00
|
|
|
|
2021-10-21 21:17:03 +02:00
|
|
|
const userHasALedgerAccount = doesUserHaveALedgerAccount(state);
|
|
|
|
|
2019-03-25 17:13:23 +01:00
|
|
|
return {
|
|
|
|
warning,
|
|
|
|
sendHexData,
|
|
|
|
showFiatInTestnets,
|
2021-10-28 21:31:05 +02:00
|
|
|
showTestNetworks,
|
2020-01-21 23:09:53 +01:00
|
|
|
autoLockTimeLimit,
|
2019-09-27 06:30:36 +02:00
|
|
|
useNonceField,
|
2021-10-21 21:17:03 +02:00
|
|
|
ledgerTransportType,
|
2021-05-05 15:58:29 +02:00
|
|
|
dismissSeedBackUpReminder,
|
2021-10-21 21:17:03 +02:00
|
|
|
userHasALedgerAccount,
|
2023-02-06 17:47:50 +01:00
|
|
|
disabledRpcMethodPreferences,
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(desktop)
|
2023-02-23 17:39:48 +01:00
|
|
|
desktopEnabled,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
};
|
2019-03-25 17:13:23 +01:00
|
|
|
|
2020-02-15 21:34:12 +01:00
|
|
|
export const mapDispatchToProps = (dispatch) => {
|
2019-03-25 17:13:23 +01:00
|
|
|
return {
|
2022-08-09 20:36:32 +02:00
|
|
|
backupUserData: () => backupUserData(),
|
|
|
|
restoreUserData: (jsonString) => restoreUserData(jsonString),
|
2020-11-03 00:41:28 +01:00
|
|
|
setHexDataFeatureFlag: (shouldShow) =>
|
|
|
|
dispatch(setFeatureFlag('sendHexData', shouldShow)),
|
2020-02-15 21:34:12 +01:00
|
|
|
displayWarning: (warning) => dispatch(displayWarning(warning)),
|
2020-11-03 00:41:28 +01:00
|
|
|
showResetAccountConfirmationModal: () =>
|
|
|
|
dispatch(showModal({ name: 'CONFIRM_RESET_ACCOUNT' })),
|
2023-05-04 13:14:07 +02:00
|
|
|
showEthSignModal: () => dispatch(showModal({ name: 'ETH_SIGN' })),
|
2020-02-15 21:34:12 +01:00
|
|
|
setUseNonceField: (value) => dispatch(setUseNonceField(value)),
|
|
|
|
setShowFiatConversionOnTestnetsPreference: (value) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
return dispatch(setShowFiatConversionOnTestnetsPreference(value));
|
2019-03-25 17:13:23 +01:00
|
|
|
},
|
2021-10-28 21:31:05 +02:00
|
|
|
setShowTestNetworks: (value) => {
|
|
|
|
return dispatch(setShowTestNetworks(value));
|
|
|
|
},
|
2020-02-15 21:34:12 +01:00
|
|
|
setAutoLockTimeLimit: (value) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
return dispatch(setAutoLockTimeLimit(value));
|
2019-05-08 20:57:21 +02:00
|
|
|
},
|
2021-11-08 16:28:40 +01:00
|
|
|
setLedgerTransportPreference: (value) => {
|
|
|
|
return dispatch(setLedgerTransportPreference(value));
|
2021-05-05 15:58:29 +02:00
|
|
|
},
|
|
|
|
setDismissSeedBackUpReminder: (value) => {
|
|
|
|
return dispatch(setDismissSeedBackUpReminder(value));
|
|
|
|
},
|
2023-02-06 17:47:50 +01:00
|
|
|
setDisabledRpcMethodPreference: (methodName, isEnabled) => {
|
|
|
|
return dispatch(setDisabledRpcMethodPreference(methodName, isEnabled));
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
|
|
|
};
|
2019-03-25 17:13:23 +01:00
|
|
|
|
|
|
|
export default compose(
|
|
|
|
withRouter,
|
2020-07-14 17:20:41 +02:00
|
|
|
connect(mapStateToProps, mapDispatchToProps),
|
2021-02-04 19:15:23 +01:00
|
|
|
)(AdvancedTab);
|