Skip to content

Commit 0a3a3da

Browse files
committed
Display call logs in the UI.
Display placed/incoming calls, answers and hangups.
1 parent c4379e4 commit 0a3a3da

8 files changed

Lines changed: 223 additions & 1 deletion

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
var MatrixClientPeg = require("../../../../../src/MatrixClientPeg");
21+
var ComponentBroker = require('../../../../../src/ComponentBroker');
22+
var MCallAnswerTileController = require("../../../../../src/controllers/molecules/voip/MCallAnswerTile");
23+
var MessageTimestamp = ComponentBroker.get('atoms/MessageTimestamp');
24+
25+
module.exports = React.createClass({
26+
displayName: 'MCallAnswerTile',
27+
mixins: [MCallAnswerTileController],
28+
29+
getAnswerText: function(event) {
30+
var senderName = event.sender ? event.sender.name : "Someone";
31+
return senderName + " answered the call.";
32+
},
33+
34+
render: function() {
35+
// XXX: for now, just cheekily borrow the css from message tile...
36+
return (
37+
<div className="mx_MessageTile">
38+
<div className="mx_MessageTile_avatar">
39+
<img src={ this.props.mxEvent.sender ? MatrixClientPeg.get().getAvatarUrlForMember(this.props.mxEvent.sender, 40, 40, "crop") : null } width="40" height="40"/>
40+
</div>
41+
<MessageTimestamp ts={this.props.mxEvent.getTs()} />
42+
<span className="mx_SenderProfile"></span>
43+
<span className="mx_MessageTile_content">
44+
{this.getAnswerText(this.props.mxEvent)}
45+
</span>
46+
</div>
47+
);
48+
},
49+
});
50+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
var MatrixClientPeg = require("../../../../../src/MatrixClientPeg");
21+
var ComponentBroker = require('../../../../../src/ComponentBroker');
22+
var MCallHangupTileController = require("../../../../../src/controllers/molecules/voip/MCallHangupTile");
23+
var MessageTimestamp = ComponentBroker.get('atoms/MessageTimestamp');
24+
25+
module.exports = React.createClass({
26+
displayName: 'MCallHangupTile',
27+
mixins: [MCallHangupTileController],
28+
29+
getHangupText: function(event) {
30+
var senderName = event.sender ? event.sender.name : "Someone";
31+
return senderName + " hungup.";
32+
},
33+
34+
render: function() {
35+
// XXX: for now, just cheekily borrow the css from message tile...
36+
return (
37+
<div className="mx_MessageTile">
38+
<div className="mx_MessageTile_avatar">
39+
<img src={ this.props.mxEvent.sender ? MatrixClientPeg.get().getAvatarUrlForMember(this.props.mxEvent.sender, 40, 40, "crop") : null } width="40" height="40"/>
40+
</div>
41+
<MessageTimestamp ts={this.props.mxEvent.getTs()} />
42+
<span className="mx_SenderProfile"></span>
43+
<span className="mx_MessageTile_content">
44+
{this.getHangupText(this.props.mxEvent)}
45+
</span>
46+
</div>
47+
);
48+
},
49+
});
50+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
var MatrixClientPeg = require("../../../../../src/MatrixClientPeg");
21+
var ComponentBroker = require('../../../../../src/ComponentBroker');
22+
var MCallInviteTileController = require("../../../../../src/controllers/molecules/voip/MCallInviteTile");
23+
var MessageTimestamp = ComponentBroker.get('atoms/MessageTimestamp');
24+
25+
module.exports = React.createClass({
26+
displayName: 'MCallInviteTile',
27+
mixins: [MCallInviteTileController],
28+
29+
getInviteText: function(event) {
30+
var senderName = event.sender ? event.sender.name : "Someone";
31+
// FIXME: Find a better way to determine this from the event?
32+
var type = "voice";
33+
if (event.getContent().offer &&
34+
event.getContent().offer.sdp.indexOf('m=video') !== -1) {
35+
type = "video";
36+
}
37+
return senderName + " placed a " + type + " call.";
38+
},
39+
40+
render: function() {
41+
// XXX: for now, just cheekily borrow the css from message tile...
42+
return (
43+
<div className="mx_MessageTile">
44+
<div className="mx_MessageTile_avatar">
45+
<img src={ this.props.mxEvent.sender ? MatrixClientPeg.get().getAvatarUrlForMember(this.props.mxEvent.sender, 40, 40, "crop") : null } width="40" height="40"/>
46+
</div>
47+
<MessageTimestamp ts={this.props.mxEvent.getTs()} />
48+
<span className="mx_SenderProfile"></span>
49+
<span className="mx_MessageTile_content">
50+
{this.getInviteText(this.props.mxEvent)}
51+
</span>
52+
</div>
53+
);
54+
},
55+
});
56+

‎src/ComponentBroker.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ require('../skins/base/views/molecules/DirectoryMenu');
101101
require('../skins/base/views/atoms/voip/VideoFeed');
102102
require('../skins/base/views/molecules/voip/VideoView');
103103
require('../skins/base/views/molecules/voip/CallView');
104+
require('../skins/base/views/molecules/voip/MCallInviteTile');
105+
require('../skins/base/views/molecules/voip/MCallAnswerTile');
106+
require('../skins/base/views/molecules/voip/MCallHangupTile');
104107

105108

106109
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
module.exports = {
20+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
module.exports = {
20+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
module.exports = {
20+
};

‎src/controllers/organisms/RoomView.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ var ComponentBroker = require('../../ComponentBroker');
3030

3131
var tileTypes = {
3232
'm.room.message': ComponentBroker.get('molecules/MessageTile'),
33-
'm.room.member': ComponentBroker.get('molecules/MRoomMemberTile')
33+
'm.room.member': ComponentBroker.get('molecules/MRoomMemberTile'),
34+
'm.call.invite': ComponentBroker.get('molecules/voip/MCallInviteTile'),
35+
'm.call.answer': ComponentBroker.get('molecules/voip/MCallAnswerTile'),
36+
'm.call.hangup': ComponentBroker.get('molecules/voip/MCallHangupTile')
3437
};
3538

3639
module.exports = {

0 commit comments

Comments
 (0)