Electron-43 (Configure Notification Position) (#142)

* ELECTRON-43 - Implemented Alert settings functionality

* ELECTRON-43
1. Added multiple monitor support for notifications in windows
2. Implemented a settings window to change notification position
3. Completed implementing configure alert position window

* ELECTRON-43 - Refactored code and changed config data

* ELECTRON-43
1. Refactored the code
2. Added modal property to browser window

* ELECTRON-43
1. Resolved conflicts
2. Made config default display value to null
3. Renamed api method from 'showAlertSettings' to 'showNotificationSettings' for consistency
4. Fixed some bugs
This commit is contained in:
Kiran Niranjan
2017-06-17 03:59:56 +05:30
committed by Lynn
parent d5f04ce152
commit 2b6ec2aeb8
12 changed files with 469 additions and 7 deletions

View File

@@ -33,6 +33,8 @@ let willQuitApp = false;
let isOnline = true;
let boundsChangeWindow;
let alwaysOnTop = false;
let position = 'lower-right';
let display;
// note: this file is built using browserify in prebuild step.
const preloadMainScript = path.join(__dirname, 'preload/_preloadMain.js');
@@ -140,6 +142,8 @@ function doCreateMainWindow(initialUrl, initialBounds) {
if (!isOnline) {
loadErrors.showNetworkConnectivityError(mainWindow, url, retry);
} else {
// updates the notify config with user preference
notify.updateConfig({position: position, display: display});
// removes all existing notifications when main window reloads
notify.reset();
log.send(logLevels.INFO, 'loaded main window url: ' + url);
@@ -416,6 +420,12 @@ eventEmitter.on('isAlwaysOnTop', (boolean) => {
isAlwaysOnTop(boolean);
});
// node event emitter for notification settings
eventEmitter.on('notificationSettings', (notificationSettings) => {
position = notificationSettings.position;
display = notificationSettings.display;
});
module.exports = {
createMainWindow: createMainWindow,
getMainWindow: getMainWindow,