diff --git a/app/constants/settings.js b/app/constants/settings.js index 04298fbd3..513ff5f34 100644 --- a/app/constants/settings.js +++ b/app/constants/settings.js @@ -89,6 +89,9 @@ export default { Message_AllowStarring: { type: 'valueAsBoolean' }, + Message_AudioRecorderEnabled: { + type: 'valueAsBoolean' + }, Message_GroupingPeriod: { type: 'valueAsNumber' }, diff --git a/app/containers/MessageBox/RightButtons.android.js b/app/containers/MessageBox/RightButtons.android.js index 716d9a258..f05c1ede8 100644 --- a/app/containers/MessageBox/RightButtons.android.js +++ b/app/containers/MessageBox/RightButtons.android.js @@ -4,17 +4,20 @@ import PropTypes from 'prop-types'; import { SendButton, AudioButton, FileButton } from './buttons'; const RightButtons = React.memo(({ - theme, showSend, submit, recordAudioMessage, showFileActions + theme, showSend, submit, recordAudioMessage, recordAudioMessageEnabled, showFileActions }) => { if (showSend) { return ; } - return ( - <> - - - - ); + if (recordAudioMessageEnabled) { + return ( + <> + + + + ); + } + return ; }); RightButtons.propTypes = { @@ -22,6 +25,7 @@ RightButtons.propTypes = { showSend: PropTypes.bool, submit: PropTypes.func.isRequired, recordAudioMessage: PropTypes.func.isRequired, + recordAudioMessageEnabled: PropTypes.bool, showFileActions: PropTypes.func.isRequired }; diff --git a/app/containers/MessageBox/RightButtons.ios.js b/app/containers/MessageBox/RightButtons.ios.js index d0b16da90..62fbca5ee 100644 --- a/app/containers/MessageBox/RightButtons.ios.js +++ b/app/containers/MessageBox/RightButtons.ios.js @@ -4,19 +4,23 @@ import PropTypes from 'prop-types'; import { SendButton, AudioButton } from './buttons'; const RightButtons = React.memo(({ - theme, showSend, submit, recordAudioMessage + theme, showSend, submit, recordAudioMessage, recordAudioMessageEnabled }) => { if (showSend) { return ; } - return ; + if (recordAudioMessageEnabled) { + return ; + } + return null; }); RightButtons.propTypes = { theme: PropTypes.string, showSend: PropTypes.bool, submit: PropTypes.func.isRequired, - recordAudioMessage: PropTypes.func.isRequired + recordAudioMessage: PropTypes.func.isRequired, + recordAudioMessageEnabled: PropTypes.bool }; export default RightButtons; diff --git a/app/containers/MessageBox/index.js b/app/containers/MessageBox/index.js index 2c5f49686..af27c97d4 100644 --- a/app/containers/MessageBox/index.js +++ b/app/containers/MessageBox/index.js @@ -85,6 +85,7 @@ class MessageBox extends Component { replyWithMention: PropTypes.bool, FileUpload_MediaTypeWhiteList: PropTypes.string, FileUpload_MaxFileSize: PropTypes.number, + Message_AudioRecorderEnabled: PropTypes.bool, getCustomEmoji: PropTypes.func, editCancel: PropTypes.func.isRequired, editRequest: PropTypes.func.isRequired, @@ -781,7 +782,7 @@ class MessageBox extends Component { recording, showEmojiKeyboard, showSend, mentions, trackingType, commandPreview, showCommandPreview } = this.state; const { - editing, message, replying, replyCancel, user, getCustomEmoji, theme + editing, message, replying, replyCancel, user, getCustomEmoji, theme, Message_AudioRecorderEnabled } = this.props; const isAndroidTablet = isTablet && isAndroid ? { @@ -842,6 +843,7 @@ class MessageBox extends Component { showSend={showSend} submit={this.submit} recordAudioMessage={this.recordAudioMessage} + recordAudioMessageEnabled={Message_AudioRecorderEnabled} showFileActions={this.showFileActions} /> @@ -891,7 +893,8 @@ const mapStateToProps = state => ({ threadsEnabled: state.settings.Threads_enabled, user: getUserSelector(state), FileUpload_MediaTypeWhiteList: state.settings.FileUpload_MediaTypeWhiteList, - FileUpload_MaxFileSize: state.settings.FileUpload_MaxFileSize + FileUpload_MaxFileSize: state.settings.FileUpload_MaxFileSize, + Message_AudioRecorderEnabled: state.settings.Message_AudioRecorderEnabled }); const dispatchToProps = ({