aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2017-11-10 14:51:38 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2017-11-10 14:51:38 +0100
commit7d41227cb78bed23fcac4c8b40dcadae57c098bc (patch)
tree6f7e0a52d6f52b4cb1e2790562e49d14eeca6723
parentfeat(App): Add option to mute all services in sidebar (diff)
downloadferdium-app-7d41227cb78bed23fcac4c8b40dcadae57c098bc.tar.gz
ferdium-app-7d41227cb78bed23fcac4c8b40dcadae57c098bc.tar.zst
ferdium-app-7d41227cb78bed23fcac4c8b40dcadae57c098bc.zip
feat(App): Respect System DoNotDisturb mode for service audio
Closes #162
-rw-r--r--package.json1
-rw-r--r--src/containers/layout/AppLayoutContainer.js2
-rw-r--r--src/stores/AppStore.js13
-rw-r--r--yarn.lock35
4 files changed, 48 insertions, 3 deletions
diff --git a/package.json b/package.json
index 9b56cdf27..f9f6ca91c 100644
--- a/package.json
+++ b/package.json
@@ -26,6 +26,7 @@
26 "author": "Stefan Malzner <stefan@adlk.io>", 26 "author": "Stefan Malzner <stefan@adlk.io>",
27 "license": "Apache-2.0", 27 "license": "Apache-2.0",
28 "dependencies": { 28 "dependencies": {
29 "@meetfranz/electron-notification-state": "^1.0.0",
29 "@paulcbetts/system-idle-time": "^1.0.4", 30 "@paulcbetts/system-idle-time": "^1.0.4",
30 "address-rfc2822": "^2.0.1", 31 "address-rfc2822": "^2.0.1",
31 "auto-launch": "https://github.com/meetfranz/node-auto-launch.git", 32 "auto-launch": "https://github.com/meetfranz/node-auto-launch.git",
diff --git a/src/containers/layout/AppLayoutContainer.js b/src/containers/layout/AppLayoutContainer.js
index 5ef4fbb35..28b6a105f 100644
--- a/src/containers/layout/AppLayoutContainer.js
+++ b/src/containers/layout/AppLayoutContainer.js
@@ -81,7 +81,7 @@ export default class AppLayoutContainer extends Component {
81 <Sidebar 81 <Sidebar
82 services={allServices} 82 services={allServices}
83 setActive={setActive} 83 setActive={setActive}
84 isAppMuted={settings.all.isMuted} 84 isAppMuted={app.isSystemMuted || settings.all.isMuted}
85 openSettings={openSettings} 85 openSettings={openSettings}
86 closeSettings={closeSettings} 86 closeSettings={closeSettings}
87 reorder={reorder} 87 reorder={reorder}
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js
index 6580157d4..6e196144c 100644
--- a/src/stores/AppStore.js
+++ b/src/stores/AppStore.js
@@ -2,7 +2,7 @@ import { remote, ipcRenderer, shell } from 'electron';
2import { action, observable } from 'mobx'; 2import { action, observable } from 'mobx';
3import moment from 'moment'; 3import moment from 'moment';
4import key from 'keymaster'; 4import key from 'keymaster';
5// import path from 'path'; 5import { getDoNotDisturb } from '@meetfranz/electron-notification-state';
6import idleTimer from '@paulcbetts/system-idle-time'; 6import idleTimer from '@paulcbetts/system-idle-time';
7import AutoLaunch from 'auto-launch'; 7import AutoLaunch from 'auto-launch';
8 8
@@ -45,6 +45,8 @@ 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;
49
48 constructor(...args) { 50 constructor(...args) {
49 super(...args); 51 super(...args);
50 52
@@ -83,6 +85,11 @@ export default class AppStore extends Store {
83 // Needs to be delayed a bit 85 // Needs to be delayed a bit
84 this._autoStart(); 86 this._autoStart();
85 87
88 // Check if system is muted
89 // There are no events to subscribe so we need to poll everey 5s
90 this._systemDND();
91 setInterval(() => this._systemDND(), 5000);
92
86 // Check for updates once every 4 hours 93 // Check for updates once every 4 hours
87 setInterval(() => this._checkForUpdates(), CHECK_INTERVAL); 94 setInterval(() => this._checkForUpdates(), CHECK_INTERVAL);
88 // Check for an update in 30s (need a delay to prevent Squirrel Installer lock file issues) 95 // Check for an update in 30s (need a delay to prevent Squirrel Installer lock file issues)
@@ -311,4 +318,8 @@ export default class AppStore extends Store {
311 async _checkAutoStart() { 318 async _checkAutoStart() {
312 return autoLauncher.isEnabled() || false; 319 return autoLauncher.isEnabled() || false;
313 } 320 }
321
322 _systemDND() {
323 this.isSystemMuted = getDoNotDisturb();
324 }
314} 325}
diff --git a/yarn.lock b/yarn.lock
index 0bedbac27..6c3f807a4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -22,6 +22,14 @@
22 "7zip-bin-mac" "^1.0.1" 22 "7zip-bin-mac" "^1.0.1"
23 "7zip-bin-win" "^2.1.0" 23 "7zip-bin-win" "^2.1.0"
24 24
25"@meetfranz/electron-notification-state@^1.0.0":
26 version "1.0.0"
27 resolved "https://registry.yarnpkg.com/@meetfranz/electron-notification-state/-/electron-notification-state-1.0.0.tgz#75e9d774bdaf15991eacd92cde8469b348259d8c"
28 dependencies:
29 macos-notification-state "^1.1.0"
30 windows-notification-state "^1.3.0"
31 windows-quiet-hours "^1.2.2"
32
25"@paulcbetts/cld@^2.4.6": 33"@paulcbetts/cld@^2.4.6":
26 version "2.4.6" 34 version "2.4.6"
27 resolved "https://registry.yarnpkg.com/@paulcbetts/cld/-/cld-2.4.6.tgz#a992f6bc43cab212ac2c4488a671cf302f8b62e7" 35 resolved "https://registry.yarnpkg.com/@paulcbetts/cld/-/cld-2.4.6.tgz#a992f6bc43cab212ac2c4488a671cf302f8b62e7"
@@ -1168,6 +1176,10 @@ binary@^0.3.0:
1168 buffers "~0.1.1" 1176 buffers "~0.1.1"
1169 chainsaw "~0.1.0" 1177 chainsaw "~0.1.0"
1170 1178
1179bindings@^1.2.1, bindings@^1.3.0:
1180 version "1.3.0"
1181 resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.3.0.tgz#b346f6ecf6a95f5a815c5839fc7cdb22502f1ed7"
1182
1171bindings@~1.2.1: 1183bindings@~1.2.1:
1172 version "1.2.1" 1184 version "1.2.1"
1173 resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11" 1185 resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
@@ -4012,6 +4024,13 @@ macaddress@^0.2.7:
4012 version "0.2.8" 4024 version "0.2.8"
4013 resolved "https://registry.yarnpkg.com/macaddress/-/macaddress-0.2.8.tgz#5904dc537c39ec6dbefeae902327135fa8511f12" 4025 resolved "https://registry.yarnpkg.com/macaddress/-/macaddress-0.2.8.tgz#5904dc537c39ec6dbefeae902327135fa8511f12"
4014 4026
4027macos-notification-state@^1.1.0:
4028 version "1.1.0"
4029 resolved "https://registry.yarnpkg.com/macos-notification-state/-/macos-notification-state-1.1.0.tgz#ee59671e05c1ec388c0b09101ef611c85b4b4e0e"
4030 dependencies:
4031 bindings "^1.2.1"
4032 nan "^2.4.0"
4033
4015make-dir@^1.0.0: 4034make-dir@^1.0.0:
4016 version "1.0.0" 4035 version "1.0.0"
4017 resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.0.0.tgz#97a011751e91dd87cfadef58832ebb04936de978" 4036 resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-1.0.0.tgz#97a011751e91dd87cfadef58832ebb04936de978"
@@ -4243,7 +4262,7 @@ mute-stream@0.0.7, mute-stream@~0.0.4:
4243 version "0.0.7" 4262 version "0.0.7"
4244 resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" 4263 resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
4245 4264
4246nan@^2.0.0, nan@^2.0.5, nan@^2.3.0, nan@^2.3.2: 4265nan@^2.0.0, nan@^2.0.5, nan@^2.3.0, nan@^2.3.2, nan@^2.4.0, nan@^2.7.0:
4247 version "2.7.0" 4266 version "2.7.0"
4248 resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46" 4267 resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46"
4249 4268
@@ -6155,6 +6174,20 @@ window-size@^0.1.4:
6155 version "0.1.4" 6174 version "0.1.4"
6156 resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876" 6175 resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876"
6157 6176
6177windows-notification-state@^1.3.0:
6178 version "1.3.0"
6179 resolved "https://registry.yarnpkg.com/windows-notification-state/-/windows-notification-state-1.3.0.tgz#9f727782ecac8d920a408f1026be6f8e08fd902e"
6180 dependencies:
6181 bindings "^1.2.1"
6182 nan "^2.4.0"
6183
6184windows-quiet-hours@^1.2.2:
6185 version "1.2.4"
6186 resolved "https://registry.yarnpkg.com/windows-quiet-hours/-/windows-quiet-hours-1.2.4.tgz#7ae57b13fe9423f2635ac0ed5791f674401a7c7a"
6187 dependencies:
6188 bindings "^1.3.0"
6189 nan "^2.7.0"
6190
6158winreg@1.2.2: 6191winreg@1.2.2:
6159 version "1.2.2" 6192 version "1.2.2"
6160 resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.2.tgz#8509afa3b71c5bbd110a6d7c6247ec67736c598f" 6193 resolved "https://registry.yarnpkg.com/winreg/-/winreg-1.2.2.tgz#8509afa3b71c5bbd110a6d7c6247ec67736c598f"