aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/AppStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores/AppStore.js')
-rw-r--r--src/stores/AppStore.js40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index 0b7c60bce..3e6d4d288 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);
@@ -67,6 +67,7 @@ export default class AppStore extends Store {
67 this._setLocale.bind(this), 67 this._setLocale.bind(this),
68 this._handleMiner.bind(this), 68 this._handleMiner.bind(this),
69 this._handleMinerThrottle.bind(this), 69 this._handleMinerThrottle.bind(this),
70 this._muteAppHandler.bind(this),
70 ]); 71 ]);
71 } 72 }
72 73
@@ -115,6 +116,14 @@ export default class AppStore extends Store {
115 } 116 }
116 }); 117 });
117 118
119 // Handle deep linking (franz://)
120 ipcRenderer.on('navigateFromDeepLink', (event, data) => {
121 const { url } = data;
122 if (!url) return;
123
124 this.stores.router.push(data.url);
125 });
126
118 // Check system idle time every minute 127 // Check system idle time every minute
119 setInterval(() => { 128 setInterval(() => {
120 this.idleTime = idleTimer.getIdleTime(); 129 this.idleTime = idleTimer.getIdleTime();
@@ -137,7 +146,7 @@ export default class AppStore extends Store {
137 this.actions.service.setActivePrev(); 146 this.actions.service.setActivePrev();
138 }); 147 });
139 148
140 // Global Mute 149 // Global Mute
141 key( 150 key(
142 '⌘+shift+m ctrl+shift+m', () => { 151 '⌘+shift+m ctrl+shift+m', () => {
143 this.actions.app.toggleMuteApp(); 152 this.actions.app.toggleMuteApp();
@@ -150,6 +159,8 @@ export default class AppStore extends Store {
150 159
151 // Actions 160 // Actions
152 @action _notify({ title, options, notificationId, serviceId = null }) { 161 @action _notify({ title, options, notificationId, serviceId = null }) {
162 if (this.stores.settings.all.isAppMuted) return;
163
153 const notification = new window.Notification(title, options); 164 const notification = new window.Notification(title, options);
154 notification.onclick = (e) => { 165 notification.onclick = (e) => {
155 if (serviceId) { 166 if (serviceId) {
@@ -160,6 +171,11 @@ export default class AppStore extends Store {
160 }); 171 });
161 172
162 this.actions.service.setActive({ serviceId }); 173 this.actions.service.setActive({ serviceId });
174
175 if (!isMac) {
176 const mainWindow = remote.getCurrentWindow();
177 mainWindow.restore();
178 }
163 } 179 }
164 }; 180 };
165 } 181 }
@@ -217,7 +233,9 @@ export default class AppStore extends Store {
217 this.healthCheckRequest.execute(); 233 this.healthCheckRequest.execute();
218 } 234 }
219 235
220 @action _muteApp({ isMuted }) { 236 @action _muteApp({ isMuted, overrideSystemMute = true }) {
237 this.isSystemMuteOverriden = overrideSystemMute;
238
221 this.actions.settings.update({ 239 this.actions.settings.update({
222 settings: { 240 settings: {
223 isAppMuted: isMuted, 241 isAppMuted: isMuted,
@@ -296,6 +314,14 @@ export default class AppStore extends Store {
296 } 314 }
297 } 315 }
298 316
317 _muteAppHandler() {
318 const showMessageBadgesEvenWhenMuted = this.stores.ui.showMessageBadgesEvenWhenMuted;
319
320 if (!showMessageBadgesEvenWhenMuted) {
321 this.actions.app.setBadge({ unreadDirectMessageCount: 0, unreadIndirectMessageCount: 0 });
322 }
323 }
324
299 // Helpers 325 // Helpers
300 async _appStartsCounter() { 326 async _appStartsCounter() {
301 // we need to wait until the settings request is resolved 327 // we need to wait until the settings request is resolved
@@ -326,6 +352,12 @@ export default class AppStore extends Store {
326 } 352 }
327 353
328 _systemDND() { 354 _systemDND() {
329 this.isSystemMuted = getDoNotDisturb(); 355 const dnd = getDoNotDisturb();
356 if (dnd === this.stores.settings.all.isAppMuted || !this.isSystemMuteOverriden) {
357 this.actions.app.muteApp({
358 isMuted: dnd,
359 overrideSystemMute: false,
360 });
361 }
330 } 362 }
331} 363}