feat(gui): Add desktop notification setting

This adds a setting to disable desktop notifications, to be controlled
via configuration file

Change-Type: feat
This commit is contained in:
Jonas Hermsmeier 2018-05-15 18:58:10 +02:00
parent 35729fc36b
commit 03c7998c11
No known key found for this signature in database
GPG Key ID: 1B870F801A0CEE9F
2 changed files with 8 additions and 1 deletions

View File

@ -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()

View File

@ -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
}
})