2017-11-17 19:52:48 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { injectIntl, defineMessages } from 'react-intl';
|
2021-11-10 00:20:34 +08:00
|
|
|
import Styled from './styles';
|
2017-11-17 19:52:48 +08:00
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
descriptionHelp: {
|
|
|
|
id: 'app.audioModal.helpText',
|
|
|
|
description: 'Text decription for the audio help',
|
|
|
|
},
|
|
|
|
backLabel: {
|
|
|
|
id: 'app.audio.backLabel',
|
|
|
|
description: 'audio settings back button label',
|
2019-09-27 21:52:29 +08:00
|
|
|
},
|
|
|
|
noSSL: {
|
|
|
|
id: 'app.audioModal.help.noSSL',
|
|
|
|
description: 'Text decription for domain not using https',
|
|
|
|
},
|
|
|
|
macNotAllowed: {
|
|
|
|
id: 'app.audioModal.help.macNotAllowed',
|
|
|
|
description: 'Text decription for mac needed to enable OS setting',
|
|
|
|
},
|
|
|
|
});
|
2017-11-17 19:52:48 +08:00
|
|
|
|
|
|
|
class Help extends Component {
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
handleBack,
|
2019-09-30 22:54:34 +08:00
|
|
|
audioErr,
|
2017-11-17 19:52:48 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2019-09-30 22:54:34 +08:00
|
|
|
const { code, MIC_ERROR } = audioErr;
|
|
|
|
|
2019-09-27 21:52:29 +08:00
|
|
|
let helpMessage = null;
|
|
|
|
|
2019-09-30 22:54:34 +08:00
|
|
|
switch (code) {
|
|
|
|
case MIC_ERROR.NO_SSL:
|
2019-09-27 21:52:29 +08:00
|
|
|
helpMessage = intl.formatMessage(intlMessages.noSSL);
|
|
|
|
break;
|
2019-09-30 22:54:34 +08:00
|
|
|
case MIC_ERROR.MAC_OS_BLOCK:
|
2019-09-27 21:52:29 +08:00
|
|
|
helpMessage = intl.formatMessage(intlMessages.macNotAllowed);
|
|
|
|
break;
|
2019-09-30 22:54:34 +08:00
|
|
|
case MIC_ERROR.NO_PERMISSION:
|
2019-09-27 21:52:29 +08:00
|
|
|
default:
|
|
|
|
helpMessage = intl.formatMessage(intlMessages.descriptionHelp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2017-11-17 19:52:48 +08:00
|
|
|
return (
|
2021-11-10 00:20:34 +08:00
|
|
|
<Styled.Help>
|
|
|
|
<Styled.Text>
|
2019-09-27 21:52:29 +08:00
|
|
|
{ helpMessage }
|
2021-11-10 00:20:34 +08:00
|
|
|
</Styled.Text>
|
|
|
|
<Styled.EnterAudio>
|
|
|
|
<Styled.BackButton
|
2017-11-17 19:52:48 +08:00
|
|
|
label={intl.formatMessage(intlMessages.backLabel)}
|
2019-09-27 21:52:29 +08:00
|
|
|
size="md"
|
|
|
|
color="primary"
|
2017-11-17 19:52:48 +08:00
|
|
|
onClick={handleBack}
|
|
|
|
ghost
|
|
|
|
/>
|
2021-11-10 00:20:34 +08:00
|
|
|
</Styled.EnterAudio>
|
|
|
|
</Styled.Help>
|
2019-09-27 21:52:29 +08:00
|
|
|
);
|
2017-11-17 19:52:48 +08:00
|
|
|
}
|
2019-09-27 21:52:29 +08:00
|
|
|
}
|
2017-11-17 19:52:48 +08:00
|
|
|
|
|
|
|
export default injectIntl(Help);
|