mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-25 04:06:42 +00:00
Merge pull request #2343 from resin-io/disable-notifications
feat(gui): Add desktop notification setting Close #2254
This commit is contained in:
commit
fb1c381ab7
@ -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()
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user