Move position of incoming call buttons.

This commit is contained in:
Kegan Dougal 2015-07-16 16:32:11 +01:00
parent 50edc619af
commit 6b81022e28
6 changed files with 125 additions and 18 deletions

View file

@ -76,12 +76,6 @@ module.exports = {
action: 'hangup',
room_id: this.props.room.roomId
});
},
onAnswerClick: function() {
dis.dispatch({
action: 'answer',
room_id: this.props.room.roomId
});
}
};

View file

@ -0,0 +1,66 @@
/*
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.
*/
'use strict';
var dis = require("../../../dispatcher");
var CallHandler = require("../../../CallHandler");
module.exports = {
componentDidMount: function() {
this.dispatcherRef = dis.register(this.onAction);
},
componentWillUnmount: function() {
dis.unregister(this.dispatcherRef);
},
getInitialState: function() {
return {
incomingCallRoomId: null
}
},
onAction: function(payload) {
if (payload.action !== 'call_state') {
return;
}
var call = CallHandler.getCall(payload.room_id);
if (!call || call.call_state !== 'ringing') {
this.setState({
incomingCallRoomId: null
});
return;
}
this.setState({
incomingCallRoomId: call.roomId
});
},
onAnswerClick: function() {
dis.dispatch({
action: 'answer',
room_id: this.state.incomingCallRoomId
});
},
onRejectClick: function() {
dis.dispatch({
action: 'hangup',
room_id: this.state.incomingCallRoomId
});
}
};