also warn when quitting mid-call
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/21833/head
parent
b6fd771b9a
commit
356d29939c
|
@ -100,6 +100,10 @@ module.exports = React.createClass({
|
||||||
this._checkSize();
|
this._checkSize();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
componentDidMount: function() {
|
||||||
|
window.addEventListener('beforeunload', this.onPageUnload);
|
||||||
|
},
|
||||||
|
|
||||||
componentDidUpdate: function() {
|
componentDidUpdate: function() {
|
||||||
this._checkSize();
|
this._checkSize();
|
||||||
},
|
},
|
||||||
|
@ -111,6 +115,7 @@ module.exports = React.createClass({
|
||||||
client.removeListener("sync", this.onSyncStateChange);
|
client.removeListener("sync", this.onSyncStateChange);
|
||||||
client.removeListener("RoomMember.typing", this.onRoomMemberTyping);
|
client.removeListener("RoomMember.typing", this.onRoomMemberTyping);
|
||||||
}
|
}
|
||||||
|
window.removeEventListener('beforeunload', this.onPageUnload);
|
||||||
},
|
},
|
||||||
|
|
||||||
onSyncStateChange: function(state, prevState) {
|
onSyncStateChange: function(state, prevState) {
|
||||||
|
@ -128,6 +133,13 @@ module.exports = React.createClass({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onPageUnload(event) {
|
||||||
|
if (this.props.hasActiveCall) {
|
||||||
|
return event.returnValue =
|
||||||
|
'You seem to be in a call, are you sure you want to quit?';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Check whether current size is greater than 0, if yes call props.onVisible
|
// Check whether current size is greater than 0, if yes call props.onVisible
|
||||||
_checkSize: function () {
|
_checkSize: function () {
|
||||||
if (this.props.onVisible && this._getSize()) {
|
if (this.props.onVisible && this._getSize()) {
|
||||||
|
|
Loading…
Reference in New Issue