mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-01-05 21:54:05 -06:00
Merge pull request #293 from KiranNiranjan/ELECTRON-284
Electron-284 (Changed the bring to front API)
This commit is contained in:
commit
9ca227ccb9
@ -8,14 +8,15 @@ const logLevels = require('./enums/logLevels.js');
|
|||||||
/**
|
/**
|
||||||
* Method that checks if user has enabled the bring to front feature
|
* Method that checks if user has enabled the bring to front feature
|
||||||
* if so then activates the main window
|
* if so then activates the main window
|
||||||
* @param windowName - Name of the window to activate
|
* @param {String} windowName - Name of the window to activate
|
||||||
|
* @param {String} reason - The reason for which the window is to be activated
|
||||||
*/
|
*/
|
||||||
function bringToFront(windowName) {
|
function bringToFront(windowName, reason) {
|
||||||
|
|
||||||
getConfigField('bringToFront')
|
getConfigField('bringToFront')
|
||||||
.then((bringToFrontSetting) => {
|
.then((bringToFrontSetting) => {
|
||||||
if (typeof bringToFrontSetting === 'boolean' && bringToFrontSetting) {
|
if (typeof bringToFrontSetting === 'boolean' && bringToFrontSetting) {
|
||||||
log.send(logLevels.INFO, 'Window has been activated for: bringToFront');
|
log.send(logLevels.INFO, 'Window has been activated for: ' + reason);
|
||||||
windowMgr.activate(windowName || 'main');
|
windowMgr.activate(windowName || 'main');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -16,7 +16,8 @@ const cmds = keyMirror({
|
|||||||
registerProtocolHandler: null,
|
registerProtocolHandler: null,
|
||||||
registerActivityDetection: null,
|
registerActivityDetection: null,
|
||||||
showNotificationSettings: null,
|
showNotificationSettings: null,
|
||||||
sanitize: null
|
sanitize: null,
|
||||||
|
bringToFront: null
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
@ -103,11 +103,6 @@ electron.ipcMain.on(apiName, (event, arg) => {
|
|||||||
break;
|
break;
|
||||||
case apiCmds.activate:
|
case apiCmds.activate:
|
||||||
if (typeof arg.windowName === 'string') {
|
if (typeof arg.windowName === 'string') {
|
||||||
// validates the user bring to front config and activates the wrapper
|
|
||||||
if (typeof arg.reason === 'string' && arg.reason === 'bringToFront') {
|
|
||||||
bringToFront(arg.windowName);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
windowMgr.activate(arg.windowName);
|
windowMgr.activate(arg.windowName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -134,6 +129,12 @@ electron.ipcMain.on(apiName, (event, arg) => {
|
|||||||
sanitize(arg.windowName);
|
sanitize(arg.windowName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case apiCmds.bringToFront:
|
||||||
|
// validates the user bring to front config and activates the wrapper
|
||||||
|
if (typeof arg.reason === 'string' && arg.reason === 'notification') {
|
||||||
|
bringToFront(arg.windowName, arg.reason);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,11 +151,22 @@ function createAPI() {
|
|||||||
/**
|
/**
|
||||||
* Brings window forward and gives focus.
|
* Brings window forward and gives focus.
|
||||||
* @param {String} windowName Name of window. Note: main window name is 'main'
|
* @param {String} windowName Name of window. Note: main window name is 'main'
|
||||||
* @param {String} reason, The reason for which the window is to be activated
|
|
||||||
*/
|
*/
|
||||||
activate: function(windowName, reason) {
|
activate: function(windowName) {
|
||||||
local.ipcRenderer.send(apiName, {
|
local.ipcRenderer.send(apiName, {
|
||||||
cmd: apiCmds.activate,
|
cmd: apiCmds.activate,
|
||||||
|
windowName: windowName
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Brings window forward and gives focus.
|
||||||
|
* @param {String} windowName Name of window. Note: main window name is 'main'
|
||||||
|
* @param {String} reason, The reason for which the window is to be activated
|
||||||
|
*/
|
||||||
|
bringToFront: function(windowName, reason) {
|
||||||
|
local.ipcRenderer.send(apiName, {
|
||||||
|
cmd: apiCmds.bringToFront,
|
||||||
windowName: windowName,
|
windowName: windowName,
|
||||||
reason: reason
|
reason: reason
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user