2019-03-25 17:13:23 +01:00
|
|
|
import AdvancedTab from './advanced-tab.component'
|
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'
|
2019-12-03 21:50:55 +01:00
|
|
|
import { preferencesSelector } from '../../../selectors/selectors'
|
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 { appState: { warning }, metamask } = state
|
|
|
|
const {
|
|
|
|
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-01-21 23:09:53 +01:00
|
|
|
const { showFiatInTestnets, autoLockTimeLimit } = preferencesSelector(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-02-15 21:34:12 +01:00
|
|
|
setHexDataFeatureFlag: (shouldShow) => dispatch(setFeatureFlag('sendHexData', shouldShow)),
|
|
|
|
displayWarning: (warning) => dispatch(displayWarning(warning)),
|
2019-03-25 17:13:23 +01:00
|
|
|
showResetAccountConfirmationModal: () => dispatch(showModal({ name: 'CONFIRM_RESET_ACCOUNT' })),
|
2020-02-15 21:34:12 +01:00
|
|
|
setAdvancedInlineGasFeatureFlag: (shouldShow) => dispatch(setFeatureFlag('advancedInlineGas', shouldShow)),
|
|
|
|
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,
|
|
|
|
connect(mapStateToProps, mapDispatchToProps)
|
|
|
|
)(AdvancedTab)
|