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-16 19:11:01 +02:00
|
|
|
setThreeBoxSyncingPermission,
|
2019-09-26 09:24:52 +02:00
|
|
|
turnThreeBoxSyncingOnAndInitialize,
|
2019-09-27 06:30:36 +02:00
|
|
|
setUseNonceField,
|
2019-12-12 20:28:07 +01:00
|
|
|
setIpfsGateway,
|
2021-11-08 16:28:40 +01:00
|
|
|
setLedgerTransportPreference,
|
2021-05-05 15:58:29 +02:00
|
|
|
setDismissSeedBackUpReminder,
|
2022-03-22 20:14:59 +01:00
|
|
|
setUseTokenDetection,
|
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 {
|
2020-12-03 00:25:19 +01:00
|
|
|
featureFlags: { sendHexData, advancedInlineGas } = {},
|
2019-09-16 19:11:01 +02:00
|
|
|
threeBoxSyncingAllowed,
|
|
|
|
threeBoxDisabled,
|
2019-09-27 06:30:36 +02:00
|
|
|
useNonceField,
|
2019-12-12 20:28:07 +01:00
|
|
|
ipfsGateway,
|
2021-10-21 21:17:03 +02:00
|
|
|
ledgerTransportType,
|
2021-05-05 15:58:29 +02:00
|
|
|
dismissSeedBackUpReminder,
|
2022-03-22 20:14:59 +01:00
|
|
|
useTokenDetection,
|
2021-02-04 19:15:23 +01:00
|
|
|
} = metamask;
|
2021-10-28 21:31:05 +02:00
|
|
|
const {
|
|
|
|
showFiatInTestnets,
|
|
|
|
showTestNetworks,
|
|
|
|
autoLockTimeLimit,
|
|
|
|
} = 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,
|
|
|
|
advancedInlineGas,
|
|
|
|
showFiatInTestnets,
|
2021-10-28 21:31:05 +02:00
|
|
|
showTestNetworks,
|
2020-01-21 23:09:53 +01:00
|
|
|
autoLockTimeLimit,
|
2019-09-16 19:11:01 +02:00
|
|
|
threeBoxSyncingAllowed,
|
|
|
|
threeBoxDisabled,
|
2019-09-27 06:30:36 +02:00
|
|
|
useNonceField,
|
2019-12-12 20:28:07 +01:00
|
|
|
ipfsGateway,
|
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,
|
2022-03-22 20:14:59 +01:00
|
|
|
useTokenDetection,
|
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 {
|
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' })),
|
|
|
|
setAdvancedInlineGasFeatureFlag: (shouldShow) =>
|
|
|
|
dispatch(setFeatureFlag('advancedInlineGas', shouldShow)),
|
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
|
|
|
},
|
2020-02-15 21:34:12 +01:00
|
|
|
setThreeBoxSyncingPermission: (newThreeBoxSyncingState) => {
|
2019-09-26 09:24:52 +02:00
|
|
|
if (newThreeBoxSyncingState) {
|
2021-02-04 19:15:23 +01:00
|
|
|
dispatch(turnThreeBoxSyncingOnAndInitialize());
|
2019-09-26 09:24:52 +02:00
|
|
|
} else {
|
2021-02-04 19:15:23 +01:00
|
|
|
dispatch(setThreeBoxSyncingPermission(newThreeBoxSyncingState));
|
2019-09-26 09:24:52 +02:00
|
|
|
}
|
|
|
|
},
|
2020-02-15 21:34:12 +01:00
|
|
|
setIpfsGateway: (value) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
return dispatch(setIpfsGateway(value));
|
2019-12-12 20:28:07 +01: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));
|
|
|
|
},
|
2022-03-22 20:14:59 +01:00
|
|
|
setUseTokenDetection: (value) => {
|
|
|
|
return dispatch(setUseTokenDetection(value));
|
|
|
|
},
|
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);
|