From e22712514eec3c8037a0a77449b1494bccc160f3 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Wed, 17 May 2017 10:58:59 +0100 Subject: [PATCH] Add show / hide apps button --- src/components/views/rooms/MessageComposer.js | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index 8a3b128908..90b738f343 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -32,6 +32,8 @@ export default class MessageComposer extends React.Component { this.onCallClick = this.onCallClick.bind(this); this.onHangupClick = this.onHangupClick.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.onVoiceCallClick = this.onVoiceCallClick.bind(this); this.onInputContentChanged = this.onInputContentChanged.bind(this); @@ -145,6 +147,7 @@ export default class MessageComposer extends React.Component { } onCallClick(ev) { + console.warn("Call but clicked!"); dis.dispatch({ action: 'place_call', 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}) { this.setState({ autocompleteQuery: content, @@ -241,14 +260,13 @@ export default class MessageComposer extends React.Component { alt={e2eTitle} title={e2eTitle} /> ); - var callButton, videoCallButton, hangupButton; + var callButton, videoCallButton, hangupButton, showAppsButton, hideAppsButton; if (this.props.callState && this.props.callState !== 'ended') { hangupButton =
Hangup
; - } - else { + } else { callButton =
@@ -259,6 +277,19 @@ export default class MessageComposer extends React.Component {
; } + // Apps + if (this.props.showAppsState && this.props.showAppsState == 'visible') { + hideAppsButton = +
+ +
; + } else { + showAppsButton = +
+ +
; + } + var canSendMessages = this.props.room.currentState.maySendMessage( MatrixClientPeg.get().credentials.userId); @@ -308,7 +339,9 @@ export default class MessageComposer extends React.Component { uploadButton, hangupButton, callButton, - videoCallButton + videoCallButton, + showAppsButton, + hideAppsButton, ); } else { controls.push(