mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
remove cancel redirect
This commit is contained in:
parent
e86fc77d16
commit
3eb33ef492
@ -14,7 +14,6 @@ import ChooseAccount from './choose-account'
|
||||
import PermissionsRedirect from './redirect'
|
||||
|
||||
const APPROVE_TIMEOUT = 1500
|
||||
const REJECT_TIMEOUT = 750
|
||||
|
||||
export default class PermissionConnect extends Component {
|
||||
static propTypes = {
|
||||
@ -105,7 +104,10 @@ export default class PermissionConnect extends Component {
|
||||
const { permissionsRequest, lastConnectedInfo, targetDomainMetadata } = this.props
|
||||
const { redirecting, origin, targetDomainMetadata: savedMetadata } = this.state
|
||||
|
||||
if (savedMetadata.name !== targetDomainMetadata?.name) {
|
||||
if (
|
||||
permissionsRequest &&
|
||||
savedMetadata.name !== targetDomainMetadata?.name
|
||||
) {
|
||||
this.setState({
|
||||
targetDomainMetadata,
|
||||
})
|
||||
@ -139,16 +141,16 @@ export default class PermissionConnect extends Component {
|
||||
})
|
||||
this.removeBeforeUnload()
|
||||
|
||||
const timeout = approved ? APPROVE_TIMEOUT : REJECT_TIMEOUT
|
||||
const redirectFunction = getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION
|
||||
? () => window.close()
|
||||
: () => history.push(DEFAULT_ROUTE)
|
||||
|
||||
if (getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION) {
|
||||
if (approved) {
|
||||
setTimeout(async () => {
|
||||
global.platform.closeCurrentWindow()
|
||||
}, timeout)
|
||||
redirectFunction()
|
||||
}, APPROVE_TIMEOUT)
|
||||
} else {
|
||||
setTimeout(async () => {
|
||||
history.push(DEFAULT_ROUTE)
|
||||
}, timeout)
|
||||
redirectFunction()
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,11 +160,8 @@ export default class PermissionConnect extends Component {
|
||||
|
||||
if (requestId) {
|
||||
await rejectPermissionsRequest(requestId)
|
||||
|
||||
if (getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION) {
|
||||
window.close()
|
||||
} else {
|
||||
this.redirectFlow(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -223,11 +222,10 @@ export default class PermissionConnect extends Component {
|
||||
<div className="permissions-connect">
|
||||
{ this.renderTopBar() }
|
||||
{
|
||||
redirecting
|
||||
redirecting && permissionsApproved
|
||||
? (
|
||||
<PermissionsRedirect
|
||||
domainMetadata={targetDomainMetadata}
|
||||
permissionsRejected={ permissionsApproved === false }
|
||||
/>
|
||||
)
|
||||
: (
|
||||
|
@ -47,19 +47,6 @@
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
&__reject {
|
||||
position: absolute;
|
||||
background: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
i {
|
||||
color: #D73A49;
|
||||
transform: scale(3);
|
||||
}
|
||||
}
|
||||
|
||||
&__identicon, .icon-with-fallback__identicon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
|
@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
|
||||
import IconWithFallBack from '../../../components/ui/icon-with-fallback'
|
||||
import { I18nContext } from '../../../contexts/i18n'
|
||||
|
||||
export default function PermissionsRedirect ({ domainMetadata, permissionsRejected }) {
|
||||
export default function PermissionsRedirect ({ domainMetadata }) {
|
||||
|
||||
const t = useContext(I18nContext)
|
||||
|
||||
@ -11,14 +11,11 @@ export default function PermissionsRedirect ({ domainMetadata, permissionsReject
|
||||
<div className="page-container permissions-redirect-container">
|
||||
<div className="permissions-redirect-container__content">
|
||||
<div className="permission-result">
|
||||
{ permissionsRejected ? t('cancelling') : t('connecting') }
|
||||
{ t('connecting') }
|
||||
<div className="permission-result__icons">
|
||||
<IconWithFallBack icon={domainMetadata.icon} name={domainMetadata.name} />
|
||||
<div className="permission-result__center-icon">
|
||||
{ permissionsRejected
|
||||
? <span className="permission-result__reject" ><i className="fa fa-times-circle" /></span>
|
||||
: <span className="permission-result__check" />
|
||||
}
|
||||
<span className="permission-result__check" />
|
||||
{ renderBrokenLine() }
|
||||
</div>
|
||||
<div className="permission-result__identicon-container">
|
||||
@ -43,9 +40,4 @@ export default function PermissionsRedirect ({ domainMetadata, permissionsReject
|
||||
|
||||
PermissionsRedirect.propTypes = {
|
||||
domainMetadata: PropTypes.object.isRequired,
|
||||
permissionsRejected: PropTypes.bool,
|
||||
}
|
||||
|
||||
PermissionsRedirect.defaultProps = {
|
||||
permissionsRejected: null,
|
||||
}
|
||||
|
@ -173,17 +173,15 @@ export default class Routes extends Component {
|
||||
return true
|
||||
}
|
||||
|
||||
if (windowType === ENVIRONMENT_TYPE_POPUP) {
|
||||
return this.onConfirmPage() || hasPermissionsRequests
|
||||
if (windowType === ENVIRONMENT_TYPE_POPUP && this.onConfirmPage()) {
|
||||
return true
|
||||
}
|
||||
|
||||
const isHandlingPermissionsRequest = Boolean(matchPath(location.pathname, {
|
||||
path: CONNECT_ROUTE, exact: false,
|
||||
}))
|
||||
})) || hasPermissionsRequests
|
||||
|
||||
if (hasPermissionsRequests || isHandlingPermissionsRequest) {
|
||||
return true
|
||||
}
|
||||
return isHandlingPermissionsRequest
|
||||
}
|
||||
|
||||
render () {
|
||||
|
Loading…
Reference in New Issue
Block a user