1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

remove home page flicker on notification close

This commit is contained in:
Erik Marks 2020-06-10 22:09:04 -07:00
parent 51956b2a14
commit c090bc7f40
2 changed files with 8 additions and 6 deletions

View File

@ -11,7 +11,7 @@ import PermissionPageContainer from '../../components/app/permission-page-contai
import ChooseAccount from './choose-account' import ChooseAccount from './choose-account'
import PermissionsRedirect from './redirect' import PermissionsRedirect from './redirect'
const APPROVE_TIMEOUT = 1500 const APPROVE_TIMEOUT = 1200
export default class PermissionConnect extends Component { export default class PermissionConnect extends Component {
static propTypes = { static propTypes = {
@ -28,7 +28,7 @@ export default class PermissionConnect extends Component {
addressLastConnectedMap: PropTypes.object.isRequired, addressLastConnectedMap: PropTypes.object.isRequired,
lastConnectedInfo: PropTypes.object.isRequired, lastConnectedInfo: PropTypes.object.isRequired,
permissionsRequestId: PropTypes.string, permissionsRequestId: PropTypes.string,
hasPermissionsRequests: PropTypes.bool.isRequired, hasPendingPermissionsRequests: PropTypes.bool.isRequired,
history: PropTypes.object.isRequired, history: PropTypes.object.isRequired,
connectPath: PropTypes.string.isRequired, connectPath: PropTypes.string.isRequired,
confirmPermissionPath: PropTypes.string.isRequired, confirmPermissionPath: PropTypes.string.isRequired,
@ -137,7 +137,7 @@ export default class PermissionConnect extends Component {
} }
redirect (approved) { redirect (approved) {
const { history, hasPermissionsRequests } = this.props const { history, hasPendingPermissionsRequests } = this.props
this.setState({ this.setState({
redirecting: true, redirecting: true,
@ -147,7 +147,7 @@ export default class PermissionConnect extends Component {
const doRedirect = () => { const doRedirect = () => {
if ( if (
!hasPermissionsRequests && !hasPendingPermissionsRequests &&
getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION
) { ) {
global.platform.closeCurrentWindow() global.platform.closeCurrentWindow()

View File

@ -32,7 +32,9 @@ const mapStateToProps = (state, ownProps) => {
const permissionsRequest = permissionsRequests const permissionsRequest = permissionsRequests
.find((permissionsRequest) => permissionsRequest.metadata.id === permissionsRequestId) .find((permissionsRequest) => permissionsRequest.metadata.id === permissionsRequestId)
const hasPermissionsRequests = permissionsRequests.length > 0 const hasPendingPermissionsRequests = permissionsRequest
? permissionsRequests.length > 1
: permissionsRequests.length > 0
const { metadata = {} } = permissionsRequest || {} const { metadata = {} } = permissionsRequest || {}
const { origin } = metadata const { origin } = metadata
@ -64,7 +66,7 @@ const mapStateToProps = (state, ownProps) => {
return { return {
permissionsRequest, permissionsRequest,
permissionsRequestId, permissionsRequestId,
hasPermissionsRequests, hasPendingPermissionsRequests,
accounts: accountsWithLabels, accounts: accountsWithLabels,
origin, origin,
newAccountNumber: accountsWithLabels.length + 1, newAccountNumber: accountsWithLabels.length + 1,