2020-02-24 23:58:26 +01:00
|
|
|
import { compose } from 'redux'
|
2019-03-25 17:13:23 +01:00
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import { withRouter } from 'react-router-dom'
|
|
|
|
import {
|
|
|
|
displayWarning,
|
|
|
|
setFeatureFlag,
|
|
|
|
showModal,
|
|
|
|
setShowFiatConversionOnTestnetsPreference,
|
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,
|
2019-03-25 17:13:23 +01:00
|
|
|
} from '../../../store/actions'
|
2020-05-26 08:11:58 +02:00
|
|
|
import { getPreferences } from '../../../selectors'
|
2020-08-18 21:18:25 +02: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,
|
|
|
|
} = state
|
|
|
|
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,
|
2019-03-25 17:13:23 +01:00
|
|
|
} = metamask
|
2020-05-26 08:11:58 +02:00
|
|
|
const { showFiatInTestnets, autoLockTimeLimit } = getPreferences(state)
|
2019-03-25 17:13:23 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
warning,
|
|
|
|
sendHexData,
|
|
|
|
advancedInlineGas,
|
|
|
|
showFiatInTestnets,
|
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,
|
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) => {
|
2019-03-25 17:13:23 +01:00
|
|
|
return dispatch(setShowFiatConversionOnTestnetsPreference(value))
|
|
|
|
},
|
2020-02-15 21:34:12 +01:00
|
|
|
setAutoLockTimeLimit: (value) => {
|
2020-01-21 23:09:53 +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) {
|
|
|
|
dispatch(turnThreeBoxSyncingOnAndInitialize())
|
|
|
|
} else {
|
|
|
|
dispatch(setThreeBoxSyncingPermission(newThreeBoxSyncingState))
|
|
|
|
}
|
|
|
|
},
|
2020-02-15 21:34:12 +01:00
|
|
|
setIpfsGateway: (value) => {
|
2019-12-12 20:28:07 +01:00
|
|
|
return dispatch(setIpfsGateway(value))
|
|
|
|
},
|
2019-03-25 17:13:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default compose(
|
|
|
|
withRouter,
|
2020-07-14 17:20:41 +02:00
|
|
|
connect(mapStateToProps, mapDispatchToProps),
|
2019-03-25 17:13:23 +01:00
|
|
|
)(AdvancedTab)
|