Merge pull request #2343 from resin-io/disable-notifications

feat(gui): Add desktop notification setting
Close #2254
This commit is contained in:
Jonas Hermsmeier 2018-05-16 00:51:49 +02:00 committed by GitHub
commit fb1c381ab7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -17,6 +17,7 @@
'use strict' 'use strict'
const electron = require('electron') const electron = require('electron')
const settings = require('../models/settings')
/** /**
* @summary Send a notification * @summary Send a notification
@ -41,6 +42,11 @@ const electron = require('electron')
* }); * });
*/ */
exports.send = (title, options) => { 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 // `app.dock` is only defined in OS X
if (electron.remote.app.dock) { if (electron.remote.app.dock) {
electron.remote.app.dock.bounce() 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), updatesEnabled: packageJSON.updates.enabled && !_.includes([ 'rpm', 'deb' ], packageJSON.packageType),
includeUnstableUpdateChannel: !release.isStableRelease(packageJSON.version), includeUnstableUpdateChannel: !release.isStableRelease(packageJSON.version),
lastSleptUpdateNotifier: null, lastSleptUpdateNotifier: null,
lastSleptUpdateNotifierVersion: null lastSleptUpdateNotifierVersion: null,
desktopNotifications: true
} }
}) })