diff options
author | kumavis <kumavis@users.noreply.github.com> | 2019-05-04 01:32:05 +0800 |
---|---|---|
committer | Frankie <frankie.diamond@gmail.com> | 2019-05-04 01:32:05 +0800 |
commit | 2845398c3d824e5da1830ba7905ffdbf8149cf9e (patch) | |
tree | a95ca83b7cf8ac42cef5ad08d29e8240f8bf1e30 /ui | |
parent | 2ff522604b2a5f45697087613de5efb9bba58790 (diff) | |
download | tangerine-wallet-browser-2845398c3d824e5da1830ba7905ffdbf8149cf9e.tar tangerine-wallet-browser-2845398c3d824e5da1830ba7905ffdbf8149cf9e.tar.gz tangerine-wallet-browser-2845398c3d824e5da1830ba7905ffdbf8149cf9e.tar.bz2 tangerine-wallet-browser-2845398c3d824e5da1830ba7905ffdbf8149cf9e.tar.lz tangerine-wallet-browser-2845398c3d824e5da1830ba7905ffdbf8149cf9e.tar.xz tangerine-wallet-browser-2845398c3d824e5da1830ba7905ffdbf8149cf9e.tar.zst tangerine-wallet-browser-2845398c3d824e5da1830ba7905ffdbf8149cf9e.zip |
Refactor ProviderApprovalController to use rpc and publicConfigStore (#6410)
* Ensure home screen does not render if there are unapproved txs (#6501)
* Ensure that the confirm screen renders before the home screen if there are unapproved txs.
* Only render confirm screen before home screen on mount.
* inpage - revert _metamask api to isEnabled isApproved isUnlocked
Diffstat (limited to 'ui')
4 files changed, 20 insertions, 21 deletions
diff --git a/ui/app/components/app/provider-page-container/provider-page-container.component.js b/ui/app/components/app/provider-page-container/provider-page-container.component.js index 910def2a3..1c655d404 100644 --- a/ui/app/components/app/provider-page-container/provider-page-container.component.js +++ b/ui/app/components/app/provider-page-container/provider-page-container.component.js @@ -5,12 +5,11 @@ import { PageContainerFooter } from '../../ui/page-container' export default class ProviderPageContainer extends PureComponent { static propTypes = { - approveProviderRequest: PropTypes.func.isRequired, + approveProviderRequestByOrigin: PropTypes.func.isRequired, + rejectProviderRequestByOrigin: PropTypes.func.isRequired, origin: PropTypes.string.isRequired, - rejectProviderRequest: PropTypes.func.isRequired, siteImage: PropTypes.string, siteTitle: PropTypes.string.isRequired, - tabID: PropTypes.string.isRequired, }; static contextTypes = { @@ -29,7 +28,7 @@ export default class ProviderPageContainer extends PureComponent { } onCancel = () => { - const { tabID, rejectProviderRequest } = this.props + const { origin, rejectProviderRequestByOrigin } = this.props this.context.metricsEvent({ eventOpts: { category: 'Auth', @@ -37,11 +36,11 @@ export default class ProviderPageContainer extends PureComponent { name: 'Canceled', }, }) - rejectProviderRequest(tabID) + rejectProviderRequestByOrigin(origin) } onSubmit = () => { - const { approveProviderRequest, tabID } = this.props + const { approveProviderRequestByOrigin, origin } = this.props this.context.metricsEvent({ eventOpts: { category: 'Auth', @@ -49,7 +48,7 @@ export default class ProviderPageContainer extends PureComponent { name: 'Confirmed', }, }) - approveProviderRequest(tabID) + approveProviderRequestByOrigin(origin) } render () { diff --git a/ui/app/pages/provider-approval/provider-approval.component.js b/ui/app/pages/provider-approval/provider-approval.component.js index 1f1d68da7..70d3d0007 100644 --- a/ui/app/pages/provider-approval/provider-approval.component.js +++ b/ui/app/pages/provider-approval/provider-approval.component.js @@ -4,9 +4,9 @@ import ProviderPageContainer from '../../components/app/provider-page-container' export default class ProviderApproval extends Component { static propTypes = { - approveProviderRequest: PropTypes.func.isRequired, + approveProviderRequestByOrigin: PropTypes.func.isRequired, + rejectProviderRequestByOrigin: PropTypes.func.isRequired, providerRequest: PropTypes.object.isRequired, - rejectProviderRequest: PropTypes.func.isRequired, }; static contextTypes = { @@ -14,13 +14,13 @@ export default class ProviderApproval extends Component { }; render () { - const { approveProviderRequest, providerRequest, rejectProviderRequest } = this.props + const { approveProviderRequestByOrigin, providerRequest, rejectProviderRequestByOrigin } = this.props return ( <ProviderPageContainer - approveProviderRequest={approveProviderRequest} + approveProviderRequestByOrigin={approveProviderRequestByOrigin} + rejectProviderRequestByOrigin={rejectProviderRequestByOrigin} origin={providerRequest.origin} tabID={providerRequest.tabID} - rejectProviderRequest={rejectProviderRequest} siteImage={providerRequest.siteImage} siteTitle={providerRequest.siteTitle} /> diff --git a/ui/app/pages/provider-approval/provider-approval.container.js b/ui/app/pages/provider-approval/provider-approval.container.js index d53c0ae4d..1e167ddb7 100644 --- a/ui/app/pages/provider-approval/provider-approval.container.js +++ b/ui/app/pages/provider-approval/provider-approval.container.js @@ -1,11 +1,11 @@ import { connect } from 'react-redux' import ProviderApproval from './provider-approval.component' -import { approveProviderRequest, rejectProviderRequest } from '../../store/actions' +import { approveProviderRequestByOrigin, rejectProviderRequestByOrigin } from '../../store/actions' function mapDispatchToProps (dispatch) { return { - approveProviderRequest: tabID => dispatch(approveProviderRequest(tabID)), - rejectProviderRequest: tabID => dispatch(rejectProviderRequest(tabID)), + approveProviderRequestByOrigin: origin => dispatch(approveProviderRequestByOrigin(origin)), + rejectProviderRequestByOrigin: origin => dispatch(rejectProviderRequestByOrigin(origin)), } } diff --git a/ui/app/store/actions.js b/ui/app/store/actions.js index f594d9002..e7b855119 100644 --- a/ui/app/store/actions.js +++ b/ui/app/store/actions.js @@ -343,8 +343,8 @@ var actions = { createCancelTransaction, createSpeedUpTransaction, - approveProviderRequest, - rejectProviderRequest, + approveProviderRequestByOrigin, + rejectProviderRequestByOrigin, clearApprovedOrigins, setFirstTimeFlowType, @@ -2680,15 +2680,15 @@ function setPendingTokens (pendingTokens) { } } -function approveProviderRequest (tabID) { +function approveProviderRequestByOrigin (origin) { return (dispatch) => { - background.approveProviderRequest(tabID) + background.approveProviderRequestByOrigin(origin) } } -function rejectProviderRequest (tabID) { +function rejectProviderRequestByOrigin (origin) { return (dispatch) => { - background.rejectProviderRequest(tabID) + background.rejectProviderRequestByOrigin(origin) } } |