Skip to content

Commit 7e30c0f

Browse files
committed
Add CallHandler to handle call logic and make VideoViews/WaveformViews.
1 parent 28cebab commit 7e30c0f

5 files changed

Lines changed: 87 additions & 17 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Copyright 2015 OpenMarket Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
'use strict';
18+
19+
var React = require('react');
20+
21+
var MatrixClientPeg = require("../../../../../src/MatrixClientPeg");
22+
var ComponentBroker = require('../../../../../src/ComponentBroker');
23+
var CallHandlerController = require(
24+
"../../../../../src/controllers/molecules/voip/CallHandler"
25+
);
26+
var VideoView = ComponentBroker.get('molecules/voip/VideoView');
27+
28+
module.exports = React.createClass({
29+
displayName: 'CallHandler',
30+
mixins: [CallHandlerController],
31+
render: function(){
32+
return (
33+
<div></div>
34+
);
35+
}
36+
});

‎skins/base/views/organisms/RoomView.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var classNames = require("classnames");
2626
var MessageTile = ComponentBroker.get('molecules/MessageTile');
2727
var RoomHeader = ComponentBroker.get('molecules/RoomHeader');
2828
var MessageComposer = ComponentBroker.get('molecules/MessageComposer');
29-
var VideoView = ComponentBroker.get("molecules/voip/VideoView");
29+
var CallHandler = ComponentBroker.get("molecules/voip/CallHandler");
3030

3131
var RoomViewController = require("../../../../src/controllers/organisms/RoomView");
3232

@@ -69,7 +69,7 @@ module.exports = React.createClass({
6969
<div className="mx_RoomView">
7070
<RoomHeader room={this.state.room} />
7171
<div className="mx_RoomView_auxPanel">
72-
<VideoView/>
72+
<CallHandler room={this.state.room}/>
7373
</div>
7474
<div ref="messageWrapper" className="mx_RoomView_messagePanel" onScroll={this.onMessageListScroll}>
7575
<div className="mx_RoomView_messageListWrapper">

‎src/ComponentBroker.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ require('../skins/base/views/molecules/RoomDropTarget');
9696
require('../skins/base/views/molecules/DirectoryMenu');
9797
require('../skins/base/views/atoms/voip/VideoFeed');
9898
require('../skins/base/views/molecules/voip/VideoView');
99+
require('../skins/base/views/molecules/voip/CallHandler');
99100

100101

101102
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
Copyright 2015 OpenMarket Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
'use strict';
18+
19+
var dis = require("../../../dispatcher");
20+
21+
module.exports = {
22+
23+
componentDidMount: function() {
24+
this.dispatcherRef = dis.register(this.onAction);
25+
},
26+
27+
componentWillUnmount: function() {
28+
dis.unregister(this.dispatcherRef);
29+
},
30+
31+
onAction: function(payload) {
32+
// if we were given a room_id to track, don't handle anything else.
33+
if (payload.room_id && this.props.room &&
34+
this.props.room.roomId !== payload.room_id) {
35+
return;
36+
}
37+
38+
switch (payload.action) {
39+
case 'place_call':
40+
console.log("Place %s call in %s", payload.type, payload.room_id);
41+
break;
42+
case 'incoming_call':
43+
console.log("Incoming call: %s", payload.call);
44+
break;
45+
}
46+
}
47+
};
48+

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

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,5 @@ limitations under the License.
1919
var dis = require("../../../dispatcher");
2020

2121
module.exports = {
22-
23-
componentDidMount: function() {
24-
this.dispatcherRef = dis.register(this.onAction);
25-
},
26-
27-
onAction: function(payload) {
28-
switch(payload.action) {
29-
case 'place_call':
30-
console.log("Place %s call in %s", payload.type, payload.room_id);
31-
break;
32-
case 'incoming_call':
33-
console.log("Incoming call: %s", payload.call);
34-
break;
35-
}
36-
}
3722
};
3823

0 commit comments

Comments
 (0)