Use SettingsStore for notification settings
Signed-off-by: Travis Ralstron <travpc@gmail.com>
This commit is contained in:
parent
69939e2fe3
commit
63607f29e7
1 changed files with 37 additions and 18 deletions
|
@ -20,6 +20,7 @@ import sdk from 'matrix-react-sdk';
|
||||||
import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler';
|
import { _t, _tJsx } from 'matrix-react-sdk/lib/languageHandler';
|
||||||
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
|
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
|
||||||
import UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore';
|
import UserSettingsStore from 'matrix-react-sdk/lib/UserSettingsStore';
|
||||||
|
import SettingsStore, {SettingLevel} from "matrix-react-sdk/lib/settings/SettingsStore";
|
||||||
import Modal from 'matrix-react-sdk/lib/Modal';
|
import Modal from 'matrix-react-sdk/lib/Modal';
|
||||||
import {
|
import {
|
||||||
NotificationUtils,
|
NotificationUtils,
|
||||||
|
@ -112,12 +113,33 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onEnableDesktopNotificationsChange: function(event) {
|
onEnableDesktopNotificationsChange: function(event) {
|
||||||
UserSettingsStore.setEnableNotifications(event.target.checked);
|
SettingsStore.setValue(
|
||||||
|
"notificationsEnabled", null,
|
||||||
|
SettingLevel.DEVICE,
|
||||||
|
event.target.checked,
|
||||||
|
).finally(() => {
|
||||||
|
this.forceUpdate();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onEnableDesktopNotificationBodyChange: function(event) {
|
onEnableDesktopNotificationBodyChange: function(event) {
|
||||||
UserSettingsStore.setEnableNotificationBody(event.target.checked);
|
SettingsStore.setValue(
|
||||||
|
"notificationBodyEnabled", null,
|
||||||
|
SettingLevel.DEVICE,
|
||||||
|
event.target.checked,
|
||||||
|
).finally(() => {
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onEnableAudioNotificationsChange: function(event) {
|
||||||
|
SettingsStore.setValue(
|
||||||
|
"audioNotificationsEnabled", null,
|
||||||
|
SettingLevel.DEVICE,
|
||||||
|
event.target.checked,
|
||||||
|
).finally(() => {
|
||||||
|
this.forceUpdate();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onEnableEmailNotificationsChange: function(address, event) {
|
onEnableEmailNotificationsChange: function(address, event) {
|
||||||
|
@ -824,7 +846,7 @@ module.exports = React.createClass({
|
||||||
<input id="enableDesktopNotifications"
|
<input id="enableDesktopNotifications"
|
||||||
ref="enableDesktopNotifications"
|
ref="enableDesktopNotifications"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={ UserSettingsStore.getEnableNotifications() }
|
checked={ SettingsStore.getValue("notificationsEnabled") }
|
||||||
onChange={ this.onEnableDesktopNotificationsChange } />
|
onChange={ this.onEnableDesktopNotificationsChange } />
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_UserNotifSettings_labelCell">
|
<div className="mx_UserNotifSettings_labelCell">
|
||||||
|
@ -839,7 +861,7 @@ module.exports = React.createClass({
|
||||||
<input id="enableDesktopNotificationBody"
|
<input id="enableDesktopNotificationBody"
|
||||||
ref="enableDesktopNotificationBody"
|
ref="enableDesktopNotificationBody"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={ UserSettingsStore.getEnableNotificationBody() }
|
checked={ SettingsStore.getValue("notificationBodyEnabled") }
|
||||||
onChange={ this.onEnableDesktopNotificationBodyChange } />
|
onChange={ this.onEnableDesktopNotificationBodyChange } />
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_UserNotifSettings_labelCell">
|
<div className="mx_UserNotifSettings_labelCell">
|
||||||
|
@ -854,11 +876,8 @@ module.exports = React.createClass({
|
||||||
<input id="enableDesktopAudioNotifications"
|
<input id="enableDesktopAudioNotifications"
|
||||||
ref="enableDesktopAudioNotifications"
|
ref="enableDesktopAudioNotifications"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={ UserSettingsStore.getEnableAudioNotifications() }
|
checked={ SettingsStore.getValue("audioNotificationsEnabled") }
|
||||||
onChange={ (e) => {
|
onChange={ this.onEnableAudioNotificationsChange } />
|
||||||
UserSettingsStore.setEnableAudioNotifications(e.target.checked);
|
|
||||||
this.forceUpdate();
|
|
||||||
}} />
|
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_UserNotifSettings_labelCell">
|
<div className="mx_UserNotifSettings_labelCell">
|
||||||
<label htmlFor="enableDesktopAudioNotifications">
|
<label htmlFor="enableDesktopAudioNotifications">
|
||||||
|
|
Loading…
Reference in a new issue