fixed toggle click state change bug

better-alerts
Curtis ROck 2020-09-06 05:13:44 -05:00
rodzic f3b44c5560
commit 3d282f45fa
2 zmienionych plików z 3 dodań i 4 usunięć

Wyświetl plik

@ -33,7 +33,6 @@ const defaultSettings = ImmutableMap({
panes: ImmutableList(),
mainWindow: 'minimized',
sound: true,
flash: true,
}),
home: ImmutableMap({

Wyświetl plik

@ -36,18 +36,18 @@ class AudioToggle extends React.PureComponent {
};
handleToggleAudio = () => {
this.props.toggleAudio(this.props.settings.get('chats', 'sound') === true ? false : true);
this.props.toggleAudio(this.props.settings.getIn(['chats', 'sound']) === true ? false : true);
}
render() {
const { intl, settings, showLabel } = this.props;
let toggle = (
<SettingToggle settings={settings} settingPath={['chats', 'sound']} onChange={this.handleToggleAudio} icons={{ checked: <Icon id='volume-up' />, unchecked: <Icon id='volume-off' /> }} ariaLabel={settings.get('chats', 'sound') === 'light' ? intl.formatMessage(messages.switchToOff) : intl.formatMessage(messages.switchToOn)} />
<SettingToggle settings={settings} settingPath={['chats', 'sound']} onChange={this.handleToggleAudio} icons={{ checked: <Icon id='volume-up' />, unchecked: <Icon id='volume-off' /> }} ariaLabel={settings.get('chats', 'sound') === true ? intl.formatMessage(messages.switchToOff) : intl.formatMessage(messages.switchToOn)} />
);
if (showLabel) {
toggle = (
<SettingToggle settings={settings} settingPath={['chats', 'sound']} onChange={this.handleToggleAudio} icons={{ checked: <Icon id='volume-up' />, unchecked: <Icon id='volume-off' /> }} label={settings.get('chats', 'sound') === 'light' ? intl.formatMessage(messages.switchToOff) : intl.formatMessage(messages.switchToOn)} />
<SettingToggle settings={settings} settingPath={['chats', 'sound']} onChange={this.handleToggleAudio} icons={{ checked: <Icon id='volume-up' />, unchecked: <Icon id='volume-off' /> }} label={settings.get('chats', 'sound') === true ? intl.formatMessage(messages.switchToOff) : intl.formatMessage(messages.switchToOn)} />
);
}