Permalink
Browse files

fix(App): Allow to turn on notifications when system dnd is enabled

  • Loading branch information...
adlk committed Nov 29, 2017
1 parent 0fa1caf commit 3045b47d869da4e62e9403c63652baeb7b349e1d
Showing with 16 additions and 8 deletions.
  1. +1 −0 src/actions/app.js
  2. +2 −4 src/containers/layout/AppLayoutContainer.js
  3. +11 −3 src/stores/AppStore.js
  4. +2 −1 src/stores/SettingsStore.js
@@ -22,6 +22,7 @@ export default {
healthCheck: {},
muteApp: {
isMuted: PropTypes.bool.isRequired,
overrideSystemMute: PropTypes.bool,
},
toggleMuteApp: {},
};
@@ -73,13 +73,11 @@ export default class AppLayoutContainer extends Component {
);
}
const isMuted = settings.all.isAppMuted || app.isSystemMuted;
const sidebar = (
<Sidebar
services={services.allDisplayed}
setActive={setActive}
isAppMuted={isMuted}
isAppMuted={settings.all.isAppMuted}
openSettings={openSettings}
closeSettings={closeSettings}
reorder={reorder}
@@ -99,7 +97,7 @@ export default class AppLayoutContainer extends Component {
setWebviewReference={setWebviewReference}
openWindow={openWindow}
reload={reload}
isAppMuted={isMuted}
isAppMuted={settings.all.isAppMuted}
update={updateService}
/>
);
@@ -45,7 +45,7 @@ export default class AppStore extends Store {
miner = null;
@observable minerHashrate = 0.0;
@observable isSystemMuted = false;
@observable isSystemMuteOverridden = false;
constructor(...args) {
super(...args);
@@ -219,7 +219,9 @@ export default class AppStore extends Store {
this.healthCheckRequest.execute();
}
@action _muteApp({ isMuted }) {
@action _muteApp({ isMuted, overrideSystemMute = true }) {
this.isSystemMuteOverriden = overrideSystemMute;
this.actions.settings.update({
settings: {
isAppMuted: isMuted,
@@ -328,6 +330,12 @@ export default class AppStore extends Store {
}
_systemDND() {
this.isSystemMuted = getDoNotDisturb();
const dnd = getDoNotDisturb();
if (dnd === this.stores.settings.all.isAppMuted || !this.isSystemMuteOverriden) {
this.actions.app.muteApp({
isMuted: dnd,
overrideSystemMute: false,
});
}
}
}
@@ -5,6 +5,7 @@ import Store from './lib/Store';
import Request from './lib/Request';
import CachedRequest from './lib/CachedRequest';
import { gaEvent } from '../lib/analytics';
import SettingsModel from '../models/Settings';
export default class SettingsStore extends Store {
@observable allSettingsRequest = new CachedRequest(this.api.local, 'getSettings');
@@ -25,7 +26,7 @@ export default class SettingsStore extends Store {
}
@computed get all() {
return this.allSettingsRequest.result || {};
return this.allSettingsRequest.result || new SettingsModel();
}
@action async _update({ settings }) {

0 comments on commit 3045b47

Please sign in to comment.