2015-11-26 19:38:56 +03:00
|
|
|
/*
|
|
|
|
Copyright 2015 OpenMarket Ltd
|
|
|
|
|
|
|
|
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',
|
|
|
|
|
|
|
|
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() {
|
|
|
|
|
2015-12-17 05:49:09 +03:00
|
|
|
var room = MatrixClientPeg.get().getRoom(this.props.incomingCall.roomId);
|
|
|
|
var caller = room ? room.name : "unknown";
|
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>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|