2015-11-26 19:38:56 +03:00
|
|
|
/*
|
2016-01-07 07:06:39 +03:00
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2015-11-26 19:38:56 +03:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
var React = require('react');
|
|
|
|
var MatrixClientPeg = require('../../../MatrixClientPeg');
|
|
|
|
var dis = require("../../../dispatcher");
|
|
|
|
var CallHandler = require("../../../CallHandler");
|
|
|
|
|
|
|
|
module.exports = React.createClass({
|
|
|
|
displayName: 'IncomingCallBox',
|
|
|
|
|
2016-09-15 16:39:34 +03:00
|
|
|
propTypes: {
|
|
|
|
incomingCall: React.PropTypes.object,
|
|
|
|
},
|
|
|
|
|
2015-11-26 19:38:56 +03:00
|
|
|
onAnswerClick: function() {
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'answer',
|
2015-12-17 05:49:09 +03:00
|
|
|
room_id: this.props.incomingCall.roomId
|
2015-11-26 19:38:56 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
onRejectClick: function() {
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'hangup',
|
2015-12-17 05:49:09 +03:00
|
|
|
room_id: this.props.incomingCall.roomId
|
2015-11-26 19:38:56 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
2016-09-15 16:39:34 +03:00
|
|
|
var room = null;
|
|
|
|
if (this.props.incomingCall) {
|
|
|
|
room = MatrixClientPeg.get().getRoom(this.props.incomingCall.roomId);
|
|
|
|
}
|
2015-11-26 19:38:56 +03:00
|
|
|
|
2015-12-17 05:49:09 +03:00
|
|
|
var caller = room ? room.name : "unknown";
|
2016-09-15 16:39:34 +03:00
|
|
|
|
2015-11-26 19:38:56 +03:00
|
|
|
return (
|
2015-12-17 05:49:09 +03:00
|
|
|
<div className="mx_IncomingCallBox" id="incomingCallBox">
|
2015-11-26 19:38:56 +03:00
|
|
|
<img className="mx_IncomingCallBox_chevron" src="img/chevron-left.png" width="9" height="16" />
|
|
|
|
<div className="mx_IncomingCallBox_title">
|
2015-12-17 05:49:09 +03:00
|
|
|
Incoming { this.props.incomingCall ? this.props.incomingCall.type : '' } call from { caller }
|
2015-11-26 19:38:56 +03:00
|
|
|
</div>
|
|
|
|
<div className="mx_IncomingCallBox_buttons">
|
|
|
|
<div className="mx_IncomingCallBox_buttons_cell">
|
|
|
|
<div className="mx_IncomingCallBox_buttons_decline" onClick={this.onRejectClick}>
|
|
|
|
Decline
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="mx_IncomingCallBox_buttons_cell">
|
|
|
|
<div className="mx_IncomingCallBox_buttons_accept" onClick={this.onAnswerClick}>
|
|
|
|
Accept
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|