summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-08-09 13:10:50 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-08-09 13:10:50 -0300
commitef986b6d725772f2b7e6b351b40bae4257c41127 (patch)
tree4e10086d765201f1cb787b5ad4901b0b37eb4a2d
parent31aac87d59c348e60822642c5ba6c936eaed3dc7 (diff)
parentc9f175e75e4be92aed41d18a7d4d0d3569fa8f0b (diff)
downloadmullvadvpn-ef986b6d725772f2b7e6b351b40bae4257c41127.tar.xz
mullvadvpn-ef986b6d725772f2b7e6b351b40bae4257c41127.zip
Merge branch 'hide-notifications-when-window-is-active'
-rw-r--r--CHANGELOG.md2
-rw-r--r--app/notification-controller.js6
2 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 38c14687b5..f5bf5c6012 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,7 +28,7 @@ Line wrap the file at 100 chars. Th
session.
- Account token can be copied to the clipboard by clicking on it in the account settings screen.
- Automatically scroll to selected country/city in locations view.
-- Show system notifications when connection state changes.
+- Show system notifications when connection state changes and the window is not visible.
- Add launch view displayed when connecting to system service.
### Changed
diff --git a/app/notification-controller.js b/app/notification-controller.js
index ff2c80db50..1d6138d404 100644
--- a/app/notification-controller.js
+++ b/app/notification-controller.js
@@ -7,6 +7,12 @@ export default class NotificationController {
show(message: string) {
const lastNotification = this._activeNotification;
+ const sameAsLastNotification = lastNotification && lastNotification.body === message;
+
+ if (sameAsLastNotification || remote.getCurrentWindow().isVisible()) {
+ return;
+ }
+
const newNotification = new Notification(remote.app.getName(), { body: message, silent: true });
this._activeNotification = newNotification;