Move early-cancel stuff to constructor
This commit is contained in:
parent
ff3c52a736
commit
0f8dd102bf
1 changed files with 7 additions and 8 deletions
|
@ -34,9 +34,15 @@ export default class IncomingSasDialog extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
let phase = PHASE_START;
|
||||||
|
if (this.props.verifier.cancelled) {
|
||||||
|
console.log("Verifier was cancelled in the background.");
|
||||||
|
phase = PHASE_CANCELLED;
|
||||||
|
}
|
||||||
|
|
||||||
this._showSasEvent = null;
|
this._showSasEvent = null;
|
||||||
this.state = {
|
this.state = {
|
||||||
phase: PHASE_START,
|
phase: phase,
|
||||||
sasVerified: false,
|
sasVerified: false,
|
||||||
opponentProfile: null,
|
opponentProfile: null,
|
||||||
opponentProfileError: null,
|
opponentProfileError: null,
|
||||||
|
@ -46,13 +52,6 @@ export default class IncomingSasDialog extends React.Component {
|
||||||
this._fetchOpponentProfile();
|
this._fetchOpponentProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
|
||||||
if (this.props.verifier.cancelled) {
|
|
||||||
console.log("Verifier was cancelled in the background.");
|
|
||||||
this.setState({phase: PHASE_CANCELLED});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
if (this.state.phase !== PHASE_CANCELLED && this.state.phase !== PHASE_VERIFIED) {
|
if (this.state.phase !== PHASE_CANCELLED && this.state.phase !== PHASE_VERIFIED) {
|
||||||
this.props.verifier.cancel('User cancel');
|
this.props.verifier.cancel('User cancel');
|
||||||
|
|
Loading…
Reference in a new issue