|
|
@ -6,9 +6,7 @@ import { |
|
|
|
ENVIRONMENT_TYPE_FULLSCREEN, |
|
|
|
ENVIRONMENT_TYPE_FULLSCREEN, |
|
|
|
ENVIRONMENT_TYPE_NOTIFICATION, |
|
|
|
ENVIRONMENT_TYPE_NOTIFICATION, |
|
|
|
} from '../../../../app/scripts/lib/enums' |
|
|
|
} from '../../../../app/scripts/lib/enums' |
|
|
|
import { |
|
|
|
import { DEFAULT_ROUTE } from '../../helpers/constants/routes' |
|
|
|
DEFAULT_ROUTE, |
|
|
|
|
|
|
|
} from '../../helpers/constants/routes' |
|
|
|
|
|
|
|
import PermissionPageContainer from '../../components/app/permission-page-container' |
|
|
|
import PermissionPageContainer from '../../components/app/permission-page-container' |
|
|
|
import ChooseAccount from './choose-account' |
|
|
|
import ChooseAccount from './choose-account' |
|
|
|
import PermissionsRedirect from './redirect' |
|
|
|
import PermissionsRedirect from './redirect' |
|
|
@ -30,6 +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, |
|
|
|
history: PropTypes.object.isRequired, |
|
|
|
history: PropTypes.object.isRequired, |
|
|
|
connectPath: PropTypes.string.isRequired, |
|
|
|
connectPath: PropTypes.string.isRequired, |
|
|
|
confirmPermissionPath: PropTypes.string.isRequired, |
|
|
|
confirmPermissionPath: PropTypes.string.isRequired, |
|
|
@ -138,7 +137,7 @@ export default class PermissionConnect extends Component { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
redirect (approved) { |
|
|
|
redirect (approved) { |
|
|
|
const { history } = this.props |
|
|
|
const { history, hasPermissionsRequests } = this.props |
|
|
|
|
|
|
|
|
|
|
|
this.setState({ |
|
|
|
this.setState({ |
|
|
|
redirecting: true, |
|
|
|
redirecting: true, |
|
|
@ -146,16 +145,21 @@ export default class PermissionConnect extends Component { |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.removeBeforeUnload() |
|
|
|
this.removeBeforeUnload() |
|
|
|
|
|
|
|
|
|
|
|
const redirectFunction = getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION |
|
|
|
const doRedirect = () => { |
|
|
|
? () => window.close() |
|
|
|
if ( |
|
|
|
: () => history.push(DEFAULT_ROUTE) |
|
|
|
!hasPermissionsRequests && |
|
|
|
|
|
|
|
getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
global.platform.closeCurrentWindow() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
history.push(DEFAULT_ROUTE) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (approved) { |
|
|
|
if (approved) { |
|
|
|
setTimeout(async () => { |
|
|
|
setTimeout(doRedirect, APPROVE_TIMEOUT) |
|
|
|
redirectFunction() |
|
|
|
|
|
|
|
}, APPROVE_TIMEOUT) |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
redirectFunction() |
|
|
|
doRedirect() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|