Replace apps button with stickers button in message composer.

This commit is contained in:
Richard Lewis 2018-01-09 16:02:17 +00:00
parent 6b0b25c2d2
commit 9abb160120

View file

@ -31,8 +31,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.onShowStickersClick = this.onShowStickersClick.bind(this);
this.onHideAppsClick = this.onHideAppsClick.bind(this); this.onHideStickersClick = this.onHideStickersClick.bind(this);
this.onUploadFileSelected = this.onUploadFileSelected.bind(this); this.onUploadFileSelected = this.onUploadFileSelected.bind(this);
this.uploadFiles = this.uploadFiles.bind(this); this.uploadFiles = this.uploadFiles.bind(this);
this.onVoiceCallClick = this.onVoiceCallClick.bind(this); this.onVoiceCallClick = this.onVoiceCallClick.bind(this);
@ -53,6 +53,7 @@ export default class MessageComposer extends React.Component {
wordCount: 0, wordCount: 0,
}, },
showFormatting: SettingsStore.getValue('MessageComposer.showFormatting'), showFormatting: SettingsStore.getValue('MessageComposer.showFormatting'),
showStickers: false,
}; };
} }
@ -189,18 +190,12 @@ export default class MessageComposer extends React.Component {
// this._startCallApp(true); // this._startCallApp(true);
} }
onShowAppsClick(ev) { onShowStickersClick(ev) {
dis.dispatch({ this.setState({showStickers: true});
action: 'appsDrawer',
show: true,
});
} }
onHideAppsClick(ev) { onHideStickersClick(ev) {
dis.dispatch({ this.setState({showStickers: false});
action: 'appsDrawer',
show: false,
});
} }
onInputContentChanged(content: string, selection: {start: number, end: number}) { onInputContentChanged(content: string, selection: {start: number, end: number}) {
@ -268,7 +263,7 @@ export default class MessageComposer extends React.Component {
alt={e2eTitle} title={e2eTitle} alt={e2eTitle} title={e2eTitle}
/>, />,
); );
let callButton, videoCallButton, hangupButton, showAppsButton, hideAppsButton; let callButton, videoCallButton, hangupButton, showStickersButton, hideStickersButton;
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}>
@ -286,15 +281,23 @@ export default class MessageComposer extends React.Component {
} }
// Apps // Apps
if (this.props.showApps) { if (this.state.showStickers) {
hideAppsButton = hideStickersButton =
<div key="controls_hide_apps" className="mx_MessageComposer_apps" onClick={this.onHideAppsClick} title={_t("Hide Apps")}> <div
<TintableSvg src="img/icons-hide-apps.svg" width="35" height="35" /> key="controls_hide_stickers"
className="mx_MessageComposer_stickers"
onClick={this.onHideStickersClick}
title={_t("Hide Stickers")}>
<TintableSvg src="img/icons-hide-stickers.svg" width="35" height="35" />
</div>; </div>;
} else { } else {
showAppsButton = showStickersButton =
<div key="show_apps" className="mx_MessageComposer_apps" onClick={this.onShowAppsClick} title={_t("Show Apps")}> <div
<TintableSvg src="img/icons-show-apps.svg" width="35" height="35" /> key="constrols_show_stickers"
className="mx_MessageComposer_stickers"
onClick={this.onShowStickersClick}
title={_t("Show Stickers")}>
<TintableSvg src="img/icons-show-stickers.svg" width="35" height="35" />
</div>; </div>;
} }
@ -343,8 +346,8 @@ export default class MessageComposer extends React.Component {
hangupButton, hangupButton,
callButton, callButton,
videoCallButton, videoCallButton,
showAppsButton, showStickersButton,
hideAppsButton, hideStickersButton,
); );
} else { } else {
controls.push( controls.push(
@ -409,7 +412,4 @@ MessageComposer.propTypes = {
// callback when a file to upload is chosen // callback when a file to upload is chosen
uploadFile: React.PropTypes.func.isRequired, uploadFile: React.PropTypes.func.isRequired,
// string representing the current room app drawer state
showApps: React.PropTypes.bool,
}; };