From 03c7998c112a661a0d382827b2611839dc29a156 Mon Sep 17 00:00:00 2001 From: Jonas Hermsmeier Date: Tue, 15 May 2018 18:58:10 +0200 Subject: [PATCH] feat(gui): Add desktop notification setting This adds a setting to disable desktop notifications, to be controlled via configuration file Change-Type: feat --- lib/gui/app/os/notification.js | 6 ++++++ lib/shared/store.js | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/gui/app/os/notification.js b/lib/gui/app/os/notification.js index f7499c6b..c85c589d 100644 --- a/lib/gui/app/os/notification.js +++ b/lib/gui/app/os/notification.js @@ -17,6 +17,7 @@ 'use strict' const electron = require('electron') +const settings = require('../models/settings') /** * @summary Send a notification @@ -41,6 +42,11 @@ const electron = require('electron') * }); */ exports.send = (title, options) => { + // Bail out if desktop notifications are disabled + if (!settings.get('desktopNotifications')) { + return null + } + // `app.dock` is only defined in OS X if (electron.remote.app.dock) { electron.remote.app.dock.bounce() diff --git a/lib/shared/store.js b/lib/shared/store.js index 2975b339..d4d1be29 100644 --- a/lib/shared/store.js +++ b/lib/shared/store.js @@ -104,7 +104,8 @@ const DEFAULT_STATE = Immutable.fromJS({ updatesEnabled: packageJSON.updates.enabled && !_.includes([ 'rpm', 'deb' ], packageJSON.packageType), includeUnstableUpdateChannel: !release.isStableRelease(packageJSON.version), lastSleptUpdateNotifier: null, - lastSleptUpdateNotifierVersion: null + lastSleptUpdateNotifierVersion: null, + desktopNotifications: true } })