Add show / hide apps button

This commit is contained in:
Richard Lewis 2017-05-17 10:58:59 +01:00
parent d81adb234a
commit e22712514e

View file

@ -32,6 +32,8 @@ export default class MessageComposer extends React.Component {
this.onCallClick = this.onCallClick.bind(this); this.onCallClick = this.onCallClick.bind(this);
this.onHangupClick = this.onHangupClick.bind(this); this.onHangupClick = this.onHangupClick.bind(this);
this.onUploadClick = this.onUploadClick.bind(this); this.onUploadClick = this.onUploadClick.bind(this);
this.onShowAppsClick = this.onShowAppsClick.bind(this);
this.onHideAppsClick = this.onHideAppsClick.bind(this);
this.onUploadFileSelected = this.onUploadFileSelected.bind(this); this.onUploadFileSelected = this.onUploadFileSelected.bind(this);
this.onVoiceCallClick = this.onVoiceCallClick.bind(this); this.onVoiceCallClick = this.onVoiceCallClick.bind(this);
this.onInputContentChanged = this.onInputContentChanged.bind(this); this.onInputContentChanged = this.onInputContentChanged.bind(this);
@ -145,6 +147,7 @@ export default class MessageComposer extends React.Component {
} }
onCallClick(ev) { onCallClick(ev) {
console.warn("Call but clicked!");
dis.dispatch({ dis.dispatch({
action: 'place_call', action: 'place_call',
type: ev.shiftKey ? "screensharing" : "video", type: ev.shiftKey ? "screensharing" : "video",
@ -160,6 +163,22 @@ export default class MessageComposer extends React.Component {
}); });
} }
onShowAppsClick(ev) {
console.warn("Showing apps");
dis.dispatch({
action: 'showApps',
room_id: this.props.room.roomId,
});
}
onHideAppsClick(ev) {
dis.dispatch({
action: 'hideApps',
room_id: this.props.room.roomId,
});
console.warn("Hiding apps");
}
onInputContentChanged(content: string, selection: {start: number, end: number}) { onInputContentChanged(content: string, selection: {start: number, end: number}) {
this.setState({ this.setState({
autocompleteQuery: content, autocompleteQuery: content,
@ -241,14 +260,13 @@ export default class MessageComposer extends React.Component {
alt={e2eTitle} title={e2eTitle} alt={e2eTitle} title={e2eTitle}
/> />
); );
var callButton, videoCallButton, hangupButton; var callButton, videoCallButton, hangupButton, showAppsButton, hideAppsButton;
if (this.props.callState && this.props.callState !== 'ended') { if (this.props.callState && this.props.callState !== 'ended') {
hangupButton = hangupButton =
<div key="controls_hangup" className="mx_MessageComposer_hangup" onClick={this.onHangupClick}> <div key="controls_hangup" className="mx_MessageComposer_hangup" onClick={this.onHangupClick}>
<img src="img/hangup.svg" alt="Hangup" title="Hangup" width="25" height="26"/> <img src="img/hangup.svg" alt="Hangup" title="Hangup" width="25" height="26"/>
</div>; </div>;
} } else {
else {
callButton = callButton =
<div key="controls_call" className="mx_MessageComposer_voicecall" onClick={this.onVoiceCallClick} title="Voice call"> <div key="controls_call" className="mx_MessageComposer_voicecall" onClick={this.onVoiceCallClick} title="Voice call">
<TintableSvg src="img/icon-call.svg" width="35" height="35"/> <TintableSvg src="img/icon-call.svg" width="35" height="35"/>
@ -259,6 +277,19 @@ export default class MessageComposer extends React.Component {
</div>; </div>;
} }
// Apps
if (this.props.showAppsState && this.props.showAppsState == 'visible') {
hideAppsButton =
<div key="hide_apps" className="mx_MessageComposer_hideApps" onClick={this.onCallClick} title="Hide Apps">
<TintableSvg src="img/icons-apps-active.svg" width="35" height="35"/>
</div>;
} else {
showAppsButton =
<div key="show_apps" className="mx_MessageComposer_showApps" onClick={this.onCallClick} title="Show Apps">
<TintableSvg src="img/icons-apps.svg" width="35" height="35"/>
</div>;
}
var canSendMessages = this.props.room.currentState.maySendMessage( var canSendMessages = this.props.room.currentState.maySendMessage(
MatrixClientPeg.get().credentials.userId); MatrixClientPeg.get().credentials.userId);
@ -308,7 +339,9 @@ export default class MessageComposer extends React.Component {
uploadButton, uploadButton,
hangupButton, hangupButton,
callButton, callButton,
videoCallButton videoCallButton,
showAppsButton,
hideAppsButton,
); );
} else { } else {
controls.push( controls.push(