MessageComposer: Trigger Jitsi app from call buttons

This commit is contained in:
Robert Swain 2017-06-13 15:35:13 +02:00
parent 5d898dd098
commit 91eabbba60
3 changed files with 37 additions and 11 deletions

View file

@ -12,6 +12,12 @@ class ModularWidgets {
name: 'Grafana', name: 'Grafana',
description: 'Graph and monitor all the things!', description: 'Graph and monitor all the things!',
}, },
{
type: 'jitsi',
icon: 'http://localhost:8000/static/jitsi.png',
name: 'jitsi',
description: 'Jitsi video conference',
},
{ {
type: 'custom', type: 'custom',
icon: 'http://localhost:8000/static/blocks.png', icon: 'http://localhost:8000/static/blocks.png',

View file

@ -94,7 +94,7 @@ export default React.createClass({
</span> </span>
</div> </div>
<div className="mx_AppTileBody"> <div className="mx_AppTileBody">
<iframe ref="appFrame" src={this.props.url}></iframe> <iframe ref="appFrame" src={this.props.url} allowFullScreen="true"></iframe>
</div> </div>
</div> </div>
); );

View file

@ -153,21 +153,41 @@ export default class MessageComposer extends React.Component {
}); });
} }
onCallClick(ev) { _startCallApp(isAudioConf) {
console.warn("Call but clicked!");
dis.dispatch({ dis.dispatch({
action: 'place_call', action: 'appsDrawer',
type: ev.shiftKey ? "screensharing" : "video", show: true,
room_id: this.props.room.roomId,
}); });
const appsStateEvents = this.props.room.currentState.getStateEvents('im.vector.modular.widgets', '');
let appsStateEvent = {};
if (appsStateEvents) {
appsStateEvent = appsStateEvents.getContent();
}
if (!appsStateEvent.videoConf) {
appsStateEvent.videoConf = {
type: 'jitsi',
url: 'http://localhost:8000/jitsi.html',
data: {
confId: this.props.room.roomId.replace(/[^A-Za-z0-9]/g, '_') + Date.now(),
isAudioConf: isAudioConf,
},
};
MatrixClientPeg.get().sendStateEvent(
this.props.room.roomId,
'im.vector.modular.widgets',
appsStateEvent,
'',
).then(() => console.log('Sent state'), (e) => console.error(e));
}
}
onCallClick(ev) {
this._startCallApp(false);
} }
onVoiceCallClick(ev) { onVoiceCallClick(ev) {
dis.dispatch({ this._startCallApp(true);
action: 'place_call',
type: 'voice',
room_id: this.props.room.roomId,
});
} }
onShowAppsClick(ev) { onShowAppsClick(ev) {