Skip to content

Commit b6f9ca0

Browse files
committed
When accepting calls, go to the right room. Relink video elements when CallView loads.
1 parent b53640f commit b6f9ca0

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎src/CallHandler.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ dis.register(function(payload) {
175175
}
176176
calls[payload.room_id].answer();
177177
_setCallState(calls[payload.room_id], payload.room_id, "connected");
178+
dis.dispatch({
179+
action: "view_room",
180+
room_id: payload.room_id
181+
});
178182
break;
179183
}
180184
});

‎src/controllers/molecules/MessageComposer.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ var KeyCode = {
3030

3131
module.exports = {
3232
componentWillMount: function() {
33-
this.dispatcherRef = dis.register(this.onAction);
3433
this.tabStruct = {
3534
completing: false,
3635
original: null,
@@ -126,6 +125,7 @@ module.exports = {
126125
},
127126

128127
componentDidMount: function() {
128+
this.dispatcherRef = dis.register(this.onAction);
129129
this.sentHistory.init(
130130
this.refs.textarea.getDOMNode(),
131131
this.props.room.roomId

‎src/controllers/molecules/voip/CallView.js‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ module.exports = {
3030

3131
componentDidMount: function() {
3232
this.dispatcherRef = dis.register(this.onAction);
33-
this.setState({
34-
call: null
35-
});
33+
if (this.props.room) {
34+
this.showCall(this.props.room.roomId);
35+
}
3636
},
3737

3838
componentWillUnmount: function() {
@@ -48,8 +48,12 @@ module.exports = {
4848
if (payload.action !== 'call_state') {
4949
return;
5050
}
51-
var call = CallHandler.getCall(payload.room_id);
52-
if (call && call.type === "video") {
51+
this.showCall(payload.room_id);
52+
},
53+
54+
showCall: function(roomId) {
55+
var call = CallHandler.getCall(roomId);
56+
if (call && call.type === "video" && call.state !== 'ended') {
5357
this.getVideoView().getLocalVideoElement().style.display = "initial";
5458
this.getVideoView().getRemoteVideoElement().style.display = "initial";
5559
call.setLocalVideoElement(this.getVideoView().getLocalVideoElement());

0 commit comments

Comments
 (0)