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

Display pending notifications after connect flow (#9011)

The notification window is now kept open after the connect flow if
there are still pending confirmations. Previously, the notification
window would be closed after the connect flow no matter what, and any
pending confirmations would never be shown to the user.

This was accomplished by redirecting to the home screen after the
connect flow. The logic for deciding whether or not to close the window
is already handled by the home page. This does have the unfortunate
side-effect of briefly rendering the home page before the window
closes, but this is a minor problem that exists already in a number of
other scenarios, and it will be fixed in a subsequent PR.

Fixes #8973
This commit is contained in:
Mark Stacey 2020-07-16 09:13:29 -03:00 committed by GitHub
parent 7333d821b8
commit b97cd1dc04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 21 deletions

View File

@ -26,7 +26,6 @@ export default class PermissionConnect extends Component {
addressLastConnectedMap: PropTypes.object.isRequired,
lastConnectedInfo: PropTypes.object.isRequired,
permissionsRequestId: PropTypes.string,
hasAdditionalPermissionsRequests: PropTypes.bool.isRequired,
history: PropTypes.object.isRequired,
connectPath: PropTypes.string.isRequired,
confirmPermissionPath: PropTypes.string.isRequired,
@ -129,6 +128,7 @@ export default class PermissionConnect extends Component {
}
redirect (approved) {
const { history } = this.props
this.setState({
redirecting: true,
permissionsApproved: approved,
@ -136,20 +136,7 @@ export default class PermissionConnect extends Component {
this.removeBeforeUnload()
if (approved) {
setTimeout(this._doRedirect.bind(this), APPROVE_TIMEOUT)
} else {
this._doRedirect()
}
}
_doRedirect () {
const { history, hasAdditionalPermissionsRequests } = this.props
if (
!hasAdditionalPermissionsRequests &&
getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION
) {
global.platform.closeCurrentWindow()
setTimeout(() => history.push(DEFAULT_ROUTE), APPROVE_TIMEOUT)
} else {
history.push(DEFAULT_ROUTE)
}

View File

@ -34,11 +34,6 @@ const mapStateToProps = (state, ownProps) => {
const permissionsRequest = permissionsRequests
.find((permissionsRequest) => permissionsRequest.metadata.id === permissionsRequestId)
// used to determine whether to redirect or show the next permissions request
const hasAdditionalPermissionsRequests = permissionsRequest
? permissionsRequests.length > 1
: permissionsRequests.length > 0
const { metadata = {} } = permissionsRequest || {}
const { origin } = metadata
const nativeCurrency = getNativeCurrency(state)
@ -83,7 +78,6 @@ const mapStateToProps = (state, ownProps) => {
return {
permissionsRequest,
permissionsRequestId,
hasAdditionalPermissionsRequests,
accounts: accountsWithLabels,
currentAddress,
origin,