[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: {
|
Message_AllowStarring: {
|
||||||
type: 'valueAsBoolean'
|
type: 'valueAsBoolean'
|
||||||
},
|
},
|
||||||
|
Message_AudioRecorderEnabled: {
|
||||||
|
type: 'valueAsBoolean'
|
||||||
|
},
|
||||||
Message_GroupingPeriod: {
|
Message_GroupingPeriod: {
|
||||||
type: 'valueAsNumber'
|
type: 'valueAsNumber'
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,17 +4,20 @@ import PropTypes from 'prop-types';
|
||||||
import { SendButton, AudioButton, FileButton } from './buttons';
|
import { SendButton, AudioButton, FileButton } from './buttons';
|
||||||
|
|
||||||
const RightButtons = React.memo(({
|
const RightButtons = React.memo(({
|
||||||
theme, showSend, submit, recordAudioMessage, showFileActions
|
theme, showSend, submit, recordAudioMessage, recordAudioMessageEnabled, showFileActions
|
||||||
}) => {
|
}) => {
|
||||||
if (showSend) {
|
if (showSend) {
|
||||||
return <SendButton onPress={submit} theme={theme} />;
|
return <SendButton onPress={submit} theme={theme} />;
|
||||||
}
|
}
|
||||||
|
if (recordAudioMessageEnabled) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AudioButton onPress={recordAudioMessage} theme={theme} />
|
<AudioButton onPress={recordAudioMessage} theme={theme} />
|
||||||
<FileButton onPress={showFileActions} theme={theme} />
|
<FileButton onPress={showFileActions} theme={theme} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
return <FileButton onPress={showFileActions} theme={theme} />;
|
||||||
});
|
});
|
||||||
|
|
||||||
RightButtons.propTypes = {
|
RightButtons.propTypes = {
|
||||||
|
@ -22,6 +25,7 @@ RightButtons.propTypes = {
|
||||||
showSend: PropTypes.bool,
|
showSend: PropTypes.bool,
|
||||||
submit: PropTypes.func.isRequired,
|
submit: PropTypes.func.isRequired,
|
||||||
recordAudioMessage: PropTypes.func.isRequired,
|
recordAudioMessage: PropTypes.func.isRequired,
|
||||||
|
recordAudioMessageEnabled: PropTypes.bool,
|
||||||
showFileActions: PropTypes.func.isRequired
|
showFileActions: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,23 @@ import PropTypes from 'prop-types';
|
||||||
import { SendButton, AudioButton } from './buttons';
|
import { SendButton, AudioButton } from './buttons';
|
||||||
|
|
||||||
const RightButtons = React.memo(({
|
const RightButtons = React.memo(({
|
||||||
theme, showSend, submit, recordAudioMessage
|
theme, showSend, submit, recordAudioMessage, recordAudioMessageEnabled
|
||||||
}) => {
|
}) => {
|
||||||
if (showSend) {
|
if (showSend) {
|
||||||
return <SendButton theme={theme} onPress={submit} />;
|
return <SendButton theme={theme} onPress={submit} />;
|
||||||
}
|
}
|
||||||
|
if (recordAudioMessageEnabled) {
|
||||||
return <AudioButton theme={theme} onPress={recordAudioMessage} />;
|
return <AudioButton theme={theme} onPress={recordAudioMessage} />;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
RightButtons.propTypes = {
|
RightButtons.propTypes = {
|
||||||
theme: PropTypes.string,
|
theme: PropTypes.string,
|
||||||
showSend: PropTypes.bool,
|
showSend: PropTypes.bool,
|
||||||
submit: PropTypes.func.isRequired,
|
submit: PropTypes.func.isRequired,
|
||||||
recordAudioMessage: PropTypes.func.isRequired
|
recordAudioMessage: PropTypes.func.isRequired,
|
||||||
|
recordAudioMessageEnabled: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
export default RightButtons;
|
export default RightButtons;
|
||||||
|
|
|
@ -85,6 +85,7 @@ class MessageBox extends Component {
|
||||||
replyWithMention: PropTypes.bool,
|
replyWithMention: PropTypes.bool,
|
||||||
FileUpload_MediaTypeWhiteList: PropTypes.string,
|
FileUpload_MediaTypeWhiteList: PropTypes.string,
|
||||||
FileUpload_MaxFileSize: PropTypes.number,
|
FileUpload_MaxFileSize: PropTypes.number,
|
||||||
|
Message_AudioRecorderEnabled: PropTypes.bool,
|
||||||
getCustomEmoji: PropTypes.func,
|
getCustomEmoji: PropTypes.func,
|
||||||
editCancel: PropTypes.func.isRequired,
|
editCancel: PropTypes.func.isRequired,
|
||||||
editRequest: PropTypes.func.isRequired,
|
editRequest: PropTypes.func.isRequired,
|
||||||
|
@ -781,7 +782,7 @@ class MessageBox extends Component {
|
||||||
recording, showEmojiKeyboard, showSend, mentions, trackingType, commandPreview, showCommandPreview
|
recording, showEmojiKeyboard, showSend, mentions, trackingType, commandPreview, showCommandPreview
|
||||||
} = this.state;
|
} = this.state;
|
||||||
const {
|
const {
|
||||||
editing, message, replying, replyCancel, user, getCustomEmoji, theme
|
editing, message, replying, replyCancel, user, getCustomEmoji, theme, Message_AudioRecorderEnabled
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const isAndroidTablet = isTablet && isAndroid ? {
|
const isAndroidTablet = isTablet && isAndroid ? {
|
||||||
|
@ -842,6 +843,7 @@ class MessageBox extends Component {
|
||||||
showSend={showSend}
|
showSend={showSend}
|
||||||
submit={this.submit}
|
submit={this.submit}
|
||||||
recordAudioMessage={this.recordAudioMessage}
|
recordAudioMessage={this.recordAudioMessage}
|
||||||
|
recordAudioMessageEnabled={Message_AudioRecorderEnabled}
|
||||||
showFileActions={this.showFileActions}
|
showFileActions={this.showFileActions}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
@ -891,7 +893,8 @@ const mapStateToProps = state => ({
|
||||||
threadsEnabled: state.settings.Threads_enabled,
|
threadsEnabled: state.settings.Threads_enabled,
|
||||||
user: getUserSelector(state),
|
user: getUserSelector(state),
|
||||||
FileUpload_MediaTypeWhiteList: state.settings.FileUpload_MediaTypeWhiteList,
|
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 = ({
|
const dispatchToProps = ({
|
||||||
|
|
Loading…
Reference in New Issue