mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-01 00:28:06 +01:00
970e90ea70
* Delete unused code * Run threebox imports through migrations * Remove 3box feature flag * Remove unnecessary use of 'type' in threebox._updatePlugin * Fix threebox controller getLastUpdated * Turn off threebox by default * Rename restoredFromThreeBox to showRestorePrompt * Remove accientally added method from threebox controller * Restore from threebox on import from unlock screen * Throw on non 404 errors from Box.getconfig in new3Box
72 lines
2.3 KiB
JavaScript
72 lines
2.3 KiB
JavaScript
import Home from './home.component'
|
|
import { compose } from 'recompose'
|
|
import { connect } from 'react-redux'
|
|
import { withRouter } from 'react-router-dom'
|
|
import { unconfirmedTransactionsCountSelector } from '../../selectors/confirm-transaction'
|
|
import { getCurrentEthBalance } from '../../selectors/selectors'
|
|
import {
|
|
unsetMigratedPrivacyMode,
|
|
restoreFromThreeBox,
|
|
turnThreeBoxSyncingOn,
|
|
getThreeBoxLastUpdated,
|
|
setShowRestorePromptToFalse,
|
|
} from '../../store/actions'
|
|
import { setThreeBoxLastUpdated } from '../../ducks/app/app'
|
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
|
import { ENVIRONMENT_TYPE_POPUP } from '../../../../app/scripts/lib/enums'
|
|
|
|
const mapStateToProps = state => {
|
|
const { metamask, appState } = state
|
|
const {
|
|
suggestedTokens,
|
|
providerRequests,
|
|
migratedPrivacyMode,
|
|
seedPhraseBackedUp,
|
|
tokens,
|
|
threeBoxSynced,
|
|
showRestorePrompt,
|
|
selectedAddress,
|
|
} = metamask
|
|
const accountBalance = getCurrentEthBalance(state)
|
|
const { forgottenPassword, threeBoxLastUpdated } = appState
|
|
|
|
const isPopup = getEnvironmentType(window.location.href) === ENVIRONMENT_TYPE_POPUP
|
|
|
|
return {
|
|
forgottenPassword,
|
|
suggestedTokens,
|
|
unconfirmedTransactionsCount: unconfirmedTransactionsCountSelector(state),
|
|
providerRequests,
|
|
showPrivacyModeNotification: migratedPrivacyMode,
|
|
shouldShowSeedPhraseReminder: !seedPhraseBackedUp && (parseInt(accountBalance, 16) > 0 || tokens.length > 0),
|
|
isPopup,
|
|
threeBoxSynced,
|
|
showRestorePrompt,
|
|
selectedAddress,
|
|
threeBoxLastUpdated,
|
|
}
|
|
}
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
unsetMigratedPrivacyMode: () => dispatch(unsetMigratedPrivacyMode()),
|
|
turnThreeBoxSyncingOn: () => dispatch(turnThreeBoxSyncingOn()),
|
|
setupThreeBox: () => {
|
|
dispatch(getThreeBoxLastUpdated())
|
|
.then(lastUpdated => {
|
|
if (lastUpdated) {
|
|
dispatch(setThreeBoxLastUpdated(lastUpdated))
|
|
} else {
|
|
dispatch(setShowRestorePromptToFalse())
|
|
dispatch(turnThreeBoxSyncingOn())
|
|
}
|
|
})
|
|
},
|
|
restoreFromThreeBox: (address) => dispatch(restoreFromThreeBox(address)),
|
|
setShowRestorePromptToFalse: () => dispatch(setShowRestorePromptToFalse()),
|
|
})
|
|
|
|
export default compose(
|
|
withRouter,
|
|
connect(mapStateToProps, mapDispatchToProps)
|
|
)(Home)
|