[IMPROVEMENT] Honor "Message_AudioRecorderEnabled" (#1764)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
7a4dfef533
commit
48e512db1e
|
@ -89,6 +89,9 @@ export default {
|
|||
Message_AllowStarring: {
|
||||
type: 'valueAsBoolean'
|
||||
},
|
||||
Message_AudioRecorderEnabled: {
|
||||
type: 'valueAsBoolean'
|
||||
},
|
||||
Message_GroupingPeriod: {
|
||||
type: 'valueAsNumber'
|
||||
},
|
||||
|
|
|
@ -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 <SendButton onPress={submit} theme={theme} />;
|
||||
}
|
||||
if (recordAudioMessageEnabled) {
|
||||
return (
|
||||
<>
|
||||
<AudioButton onPress={recordAudioMessage} theme={theme} />
|
||||
<FileButton onPress={showFileActions} theme={theme} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
return <FileButton onPress={showFileActions} theme={theme} />;
|
||||
});
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
|
|
|
@ -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 <SendButton theme={theme} onPress={submit} />;
|
||||
}
|
||||
if (recordAudioMessageEnabled) {
|
||||
return <AudioButton theme={theme} onPress={recordAudioMessage} />;
|
||||
}
|
||||
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;
|
||||
|
|
|
@ -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}
|
||||
/>
|
||||
</View>
|
||||
|
@ -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 = ({
|
||||
|
|
Loading…
Reference in New Issue