summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-08-09 11:47:26 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-08-09 12:28:48 -0300
commit5dec7ac11971f53ea8583c24b9eceb8ff28a776c (patch)
tree1d2ffb28df19cf5839f4d9b088785ae955a8cbda
parent31aac87d59c348e60822642c5ba6c936eaed3dc7 (diff)
downloadmullvadvpn-5dec7ac11971f53ea8583c24b9eceb8ff28a776c.tar.xz
mullvadvpn-5dec7ac11971f53ea8583c24b9eceb8ff28a776c.zip
Check if notification is already shown first
Don't replace active notification with a new one that has the same message.
-rw-r--r--app/notification-controller.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/notification-controller.js b/app/notification-controller.js
index ff2c80db50..eafdea0445 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) {
+ return;
+ }
+
const newNotification = new Notification(remote.app.getName(), { body: message, silent: true });
this._activeNotification = newNotification;