aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2017-11-30 00:12:16 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2017-11-30 00:12:16 +0100
commit3045b47d869da4e62e9403c63652baeb7b349e1d (patch)
treeae579477cd09b4683b78eb473ebc7abbb88ffc20 /src
parentfix(App): App mute now disables notifications as well (diff)
downloadferdium-app-3045b47d869da4e62e9403c63652baeb7b349e1d.tar.gz
ferdium-app-3045b47d869da4e62e9403c63652baeb7b349e1d.tar.zst
ferdium-app-3045b47d869da4e62e9403c63652baeb7b349e1d.zip
fix(App): Allow to turn on notifications when system dnd is enabled
Diffstat (limited to 'src')
-rw-r--r--src/actions/app.js1
-rw-r--r--src/containers/layout/AppLayoutContainer.js6
-rw-r--r--src/stores/AppStore.js14
-rw-r--r--src/stores/SettingsStore.js3
4 files changed, 16 insertions, 8 deletions
diff --git a/src/actions/app.js b/src/actions/app.js
index 25ff9344d..e4f648fc9 100644
--- a/src/actions/app.js
+++ b/src/actions/app.js
@@ -22,6 +22,7 @@ export default {
22 healthCheck: {}, 22 healthCheck: {},
23 muteApp: { 23 muteApp: {
24 isMuted: PropTypes.bool.isRequired, 24 isMuted: PropTypes.bool.isRequired,
25 overrideSystemMute: PropTypes.bool,
25 }, 26 },
26 toggleMuteApp: {}, 27 toggleMuteApp: {},
27}; 28};
diff --git a/src/containers/layout/AppLayoutContainer.js b/src/containers/layout/AppLayoutContainer.js
index 7c6ceccd6..da0896844 100644
--- a/src/containers/layout/AppLayoutContainer.js
+++ b/src/containers/layout/AppLayoutContainer.js
@@ -73,13 +73,11 @@ export default class AppLayoutContainer extends Component {
73 ); 73 );
74 } 74 }
75 75
76 const isMuted = settings.all.isAppMuted || app.isSystemMuted;
77
78 const sidebar = ( 76 const sidebar = (
79 <Sidebar 77 <Sidebar
80 services={services.allDisplayed} 78 services={services.allDisplayed}
81 setActive={setActive} 79 setActive={setActive}
82 isAppMuted={isMuted} 80 isAppMuted={settings.all.isAppMuted}
83 openSettings={openSettings} 81 openSettings={openSettings}
84 closeSettings={closeSettings} 82 closeSettings={closeSettings}
85 reorder={reorder} 83 reorder={reorder}
@@ -99,7 +97,7 @@ export default class AppLayoutContainer extends Component {
99 setWebviewReference={setWebviewReference} 97 setWebviewReference={setWebviewReference}
100 openWindow={openWindow} 98 openWindow={openWindow}
101 reload={reload} 99 reload={reload}
102 isAppMuted={isMuted} 100 isAppMuted={settings.all.isAppMuted}
103 update={updateService} 101 update={updateService}
104 /> 102 />
105 ); 103 );
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index 71b41e499..0cfe08a28 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -45,7 +45,7 @@ export default class AppStore extends Store {
45 miner = null; 45 miner = null;
46 @observable minerHashrate = 0.0; 46 @observable minerHashrate = 0.0;
47 47
48 @observable isSystemMuted = false; 48 @observable isSystemMuteOverridden = false;
49 49
50 constructor(...args) { 50 constructor(...args) {
51 super(...args); 51 super(...args);
@@ -219,7 +219,9 @@ export default class AppStore extends Store {
219 this.healthCheckRequest.execute(); 219 this.healthCheckRequest.execute();
220 } 220 }
221 221
222 @action _muteApp({ isMuted }) { 222 @action _muteApp({ isMuted, overrideSystemMute = true }) {
223 this.isSystemMuteOverriden = overrideSystemMute;
224
223 this.actions.settings.update({ 225 this.actions.settings.update({
224 settings: { 226 settings: {
225 isAppMuted: isMuted, 227 isAppMuted: isMuted,
@@ -328,6 +330,12 @@ export default class AppStore extends Store {
328 } 330 }
329 331
330 _systemDND() { 332 _systemDND() {
331 this.isSystemMuted = getDoNotDisturb(); 333 const dnd = getDoNotDisturb();
334 if (dnd === this.stores.settings.all.isAppMuted || !this.isSystemMuteOverriden) {
335 this.actions.app.muteApp({
336 isMuted: dnd,
337 overrideSystemMute: false,
338 });
339 }
332 } 340 }
333} 341}
diff --git a/src/stores/SettingsStore.js b/src/stores/SettingsStore.js
index 30058f41d..33473f16d 100644
--- a/src/stores/SettingsStore.js
+++ b/src/stores/SettingsStore.js
@@ -5,6 +5,7 @@ import Store from './lib/Store';
5import Request from './lib/Request'; 5import Request from './lib/Request';
6import CachedRequest from './lib/CachedRequest'; 6import CachedRequest from './lib/CachedRequest';
7import { gaEvent } from '../lib/analytics'; 7import { gaEvent } from '../lib/analytics';
8import SettingsModel from '../models/Settings';
8 9
9export default class SettingsStore extends Store { 10export default class SettingsStore extends Store {
10 @observable allSettingsRequest = new CachedRequest(this.api.local, 'getSettings'); 11 @observable allSettingsRequest = new CachedRequest(this.api.local, 'getSettings');
@@ -25,7 +26,7 @@ export default class SettingsStore extends Store {
25 } 26 }
26 27
27 @computed get all() { 28 @computed get all() {
28 return this.allSettingsRequest.result || {}; 29 return this.allSettingsRequest.result || new SettingsModel();
29 } 30 }
30 31
31 @action async _update({ settings }) { 32 @action async _update({ settings }) {