Refactor notification to simplify event handling
This commit is contained in:
24
src/main.js
24
src/main.js
@@ -14,6 +14,7 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
var settings = require('./common/settings');
|
||||
const osVersion = require('./common/osVersion');
|
||||
var certificateStore = require('./main/certificateStore').load(path.resolve(app.getPath('userData'), 'certificate.json'));
|
||||
var appMenu = require('./main/menus/app');
|
||||
const allowProtocolDialog = require('./main/allowProtocolDialog');
|
||||
@@ -184,15 +185,19 @@ app.on('ready', function() {
|
||||
mainWindow.focus();
|
||||
});
|
||||
ipc.on('notified', function(event, arg) {
|
||||
trayIcon.displayBalloon({
|
||||
icon: path.resolve(__dirname, 'resources/appicon.png'),
|
||||
title: arg.title,
|
||||
content: arg.options.body
|
||||
});
|
||||
|
||||
/* Todo: add idle here */
|
||||
if (config.notifications.flashWindow == 2) {
|
||||
mainWindow.flashFrame(true);
|
||||
if (process.platform === 'win32') {
|
||||
if (config.notifications.flashWindow === 2) {
|
||||
mainWindow.flashFrame(true);
|
||||
}
|
||||
// On Windows 8.1 and Windows 8, a shortcut with a Application User Model ID must be installed to the Start screen.
|
||||
// In current version, use tray balloon for notification
|
||||
if (osVersion.isLowerThanOrEqualWindows8_1()) {
|
||||
trayIcon.displayBalloon({
|
||||
icon: path.resolve(__dirname, 'resources/appicon.png'),
|
||||
title: arg.title,
|
||||
content: arg.options.body
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -215,7 +220,6 @@ app.on('ready', function() {
|
||||
else {
|
||||
trayIcon.setImage(trayImages.normal);
|
||||
trayIcon.setToolTip(app.getName());
|
||||
mainWindow.flashFrame(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user