mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-22 08:57:00 -06:00
electron-97: refactored the code as per the ticket (points 2 & 6 covered)
This commit is contained in:
parent
7ab0f75e2e
commit
28bd9399aa
@ -95,6 +95,5 @@ module.exports = {
|
||||
send: send,
|
||||
setActivityWindow: setActivityWindow,
|
||||
activityDetection: activityDetection,
|
||||
monitorUserActivity: monitorUserActivity, // Exporting this for unit test
|
||||
initiateActivityDetection: initiateActivityDetection
|
||||
monitorUserActivity: monitorUserActivity, // Exporting this for unit tests
|
||||
};
|
@ -50,4 +50,4 @@ function setDataUrl(dataUrl, count) {
|
||||
module.exports = {
|
||||
show: show,
|
||||
setDataUrl: setDataUrl
|
||||
}
|
||||
};
|
||||
|
@ -12,11 +12,10 @@
|
||||
// renderer process, this will have to do. See github issue posted here to
|
||||
// electron: https://github.com/electron/electron/issues/9312
|
||||
|
||||
var { ipcRenderer } = require('electron');
|
||||
const { ipcRenderer } = require('electron');
|
||||
|
||||
|
||||
var nextId = 0;
|
||||
var includes = [].includes;
|
||||
let nextId = 0;
|
||||
let includes = [].includes;
|
||||
|
||||
function getNextId() {
|
||||
return ++nextId;
|
||||
@ -24,11 +23,11 @@ function getNextId() {
|
||||
|
||||
// |options.type| can not be empty and has to include 'window' or 'screen'.
|
||||
function isValid(options) {
|
||||
return ((options != null ? options.types : undefined) != null) && Array.isArray(options.types);
|
||||
return ((options !== null ? options.types : undefined) !== null) && Array.isArray(options.types);
|
||||
}
|
||||
|
||||
function getSources(options, callback) {
|
||||
var captureScreen, captureWindow, id;
|
||||
let captureScreen, captureWindow, id;
|
||||
if (!isValid(options)) {
|
||||
return callback(new Error('Invalid options'));
|
||||
}
|
||||
@ -36,31 +35,32 @@ function getSources(options, callback) {
|
||||
captureScreen = includes.call(options.types, 'screen');
|
||||
|
||||
let updatedOptions = options;
|
||||
if (updatedOptions.thumbnailSize == null) {
|
||||
if (updatedOptions.thumbnailSize === null) {
|
||||
updatedOptions.thumbnailSize = {
|
||||
width: 150,
|
||||
height: 150
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
id = getNextId();
|
||||
ipcRenderer.send('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', captureWindow, captureScreen, updatedOptions.thumbnailSize, id);
|
||||
|
||||
return ipcRenderer.once('ELECTRON_RENDERER_DESKTOP_CAPTURER_RESULT_' + id, function(event, sources) {
|
||||
var source;
|
||||
let source;
|
||||
callback(null, (function() {
|
||||
var i, len, results
|
||||
let i, len, results;
|
||||
results = [];
|
||||
for (i = 0, len = sources.length; i < len; i++) {
|
||||
source = sources[i]
|
||||
source = sources[i];
|
||||
results.push({
|
||||
id: source.id,
|
||||
name: source.name,
|
||||
thumbnail: source.thumbnail
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
return results
|
||||
return results;
|
||||
|
||||
}()));
|
||||
});
|
||||
}
|
||||
|
@ -11,14 +11,14 @@ const logLevels = require('../enums/logLevels.js');
|
||||
* @param {String} url Url that failed
|
||||
* @param {String} errorDesc Description of error
|
||||
* @param {Number} errorCode Error code
|
||||
* @param {callback} retryCallback Callback when user clicks reload
|
||||
* @param {function} retryCallback Callback when user clicks reload
|
||||
*/
|
||||
function showLoadFailure(win, url, errorDesc, errorCode, retryCallback) {
|
||||
let msg;
|
||||
if (url) {
|
||||
msg = 'Error loading URL:\n' + url;
|
||||
} else {
|
||||
msg = 'Error loading window'
|
||||
msg = 'Error loading window';
|
||||
}
|
||||
if (errorDesc) {
|
||||
msg += '\n\n' + errorDesc;
|
||||
@ -29,7 +29,7 @@ function showLoadFailure(win, url, errorDesc, errorCode, retryCallback) {
|
||||
|
||||
electron.dialog.showMessageBox(win, {
|
||||
type: 'error',
|
||||
buttons: [ 'Reload', 'Ignore' ],
|
||||
buttons: ['Reload', 'Ignore'],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
noLink: true,
|
||||
@ -38,7 +38,7 @@ function showLoadFailure(win, url, errorDesc, errorCode, retryCallback) {
|
||||
}, response);
|
||||
|
||||
log.send(logLevels.WARNING, 'Load failure msg: ' + errorDesc +
|
||||
' errorCode: ' + errorCode + ' for url:' + url);
|
||||
' errorCode: ' + errorCode + ' for url:' + url);
|
||||
|
||||
// async handle of user input
|
||||
function response(buttonId) {
|
||||
@ -53,11 +53,11 @@ function showLoadFailure(win, url, errorDesc, errorCode, retryCallback) {
|
||||
* Show message indicating network connectivity has been lost.
|
||||
* @param {BrowserWindow} win Window to host dialog
|
||||
* @param {String} url Url that failed
|
||||
* @param {callback} retryCallback Callback when user clicks reload
|
||||
* @param {function} retryCallback Callback when user clicks reload
|
||||
*/
|
||||
function showNetworkConnectivityError(win, url, retryCallback) {
|
||||
var errorDesc = 'Network connectivity has been lost, check your internet connection.';
|
||||
let errorDesc = 'Network connectivity has been lost, check your internet connection.';
|
||||
showLoadFailure(win, url, errorDesc, 0, retryCallback);
|
||||
}
|
||||
|
||||
module.exports = { showLoadFailure, showNetworkConnectivityError };
|
||||
module.exports = { showLoadFailure, showNetworkConnectivityError };
|
@ -22,7 +22,7 @@ local.ipcRenderer.on('downloadProgress', () => {
|
||||
*/
|
||||
function openFile(id) {
|
||||
let fileIndex = local.downloadItems.findIndex((item) => {
|
||||
return item._id === id
|
||||
return item._id === id;
|
||||
});
|
||||
if (fileIndex !== -1) {
|
||||
let openResponse = remote.shell.openExternal(`file:///${local.downloadItems[fileIndex].savedPath}`);
|
||||
@ -37,7 +37,7 @@ function openFile(id) {
|
||||
*/
|
||||
function showInFinder(id) {
|
||||
let showFileIndex = local.downloadItems.findIndex((item) => {
|
||||
return item._id === id
|
||||
return item._id === id;
|
||||
});
|
||||
if (showFileIndex !== -1) {
|
||||
let showResponse = remote.shell.showItemInFolder(local.downloadItems[showFileIndex].savedPath);
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var keyMirror = require('keymirror');
|
||||
let keyMirror = require('keymirror');
|
||||
|
||||
const cmds = keyMirror({
|
||||
isOnline: null,
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
var keyMirror = require('keymirror');
|
||||
let keyMirror = require('keymirror');
|
||||
|
||||
module.exports = keyMirror({
|
||||
ERROR: null,
|
||||
|
12
js/log.js
12
js/log.js
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const getCmdLineArg = require('./utils/getCmdLineArg.js')
|
||||
const getCmdLineArg = require('./utils/getCmdLineArg.js');
|
||||
|
||||
const MAX_LOG_QUEUE_LENGTH = 100;
|
||||
|
||||
@ -49,14 +49,14 @@ class Logger {
|
||||
this.logWindow = win;
|
||||
|
||||
if (this.logWindow) {
|
||||
var logMsg = {};
|
||||
let logMsg = {};
|
||||
|
||||
if (Array.isArray(this.logQueue)) {
|
||||
logMsg.msgs = this.logQueue;
|
||||
}
|
||||
|
||||
// configure desired log level and send pending log msgs
|
||||
let logLevel = getCmdLineArg(process.argv, '--logLevel=');
|
||||
let logLevel = getCmdLineArg(process.argv, '--logLevel=', false);
|
||||
if (logLevel) {
|
||||
let level = logLevel.split('=')[1];
|
||||
if (level) {
|
||||
@ -64,7 +64,7 @@ class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
if (getCmdLineArg(process.argv, '--enableConsoleLogging')) {
|
||||
if (getCmdLineArg(process.argv, '--enableConsoleLogging', false)) {
|
||||
logMsg.showInConsole = true;
|
||||
}
|
||||
|
||||
@ -77,11 +77,11 @@ class Logger {
|
||||
}
|
||||
}
|
||||
|
||||
var loggerInstance = new Logger();
|
||||
let loggerInstance = new Logger();
|
||||
|
||||
// Logger class is only exposed for testing purposes.
|
||||
module.exports = {
|
||||
Logger: Logger,
|
||||
send: loggerInstance.send.bind(loggerInstance),
|
||||
setLogWindow: loggerInstance.setLogWindow.bind(loggerInstance)
|
||||
}
|
||||
};
|
||||
|
@ -189,7 +189,7 @@ function updateUserConfigWin() {
|
||||
function getUrlAndCreateMainWindow() {
|
||||
// for dev env allow passing url argument
|
||||
if (isDevEnv) {
|
||||
let url = getCmdLineArg(process.argv, '--url=')
|
||||
let url = getCmdLineArg(process.argv, '--url=', false);
|
||||
if (url) {
|
||||
windowMgr.createMainWindow(url.substr(6));
|
||||
return;
|
||||
@ -210,7 +210,7 @@ function createWin(urlFromConfig) {
|
||||
if (!parsedUrl.protocol) {
|
||||
protocol = 'https';
|
||||
}
|
||||
var url = nodeURL.format({
|
||||
let url = nodeURL.format({
|
||||
protocol: protocol,
|
||||
slahes: true,
|
||||
pathname: parsedUrl.href
|
||||
@ -232,7 +232,7 @@ function processProtocolAction(argv) {
|
||||
return;
|
||||
}
|
||||
|
||||
let protocolUri = getCmdLineArg(argv, 'symphony://');
|
||||
let protocolUri = getCmdLineArg(argv, 'symphony://', false);
|
||||
|
||||
if (protocolUri) {
|
||||
|
||||
|
@ -30,7 +30,7 @@ function isValidWindow(event) {
|
||||
if (!checkValidWindow) {
|
||||
return true;
|
||||
}
|
||||
var result = false;
|
||||
let result = false;
|
||||
if (event && event.sender) {
|
||||
// validate that event sender is from window we created
|
||||
const browserWin = electron.BrowserWindow.fromWebContents(event.sender);
|
||||
|
@ -1,14 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
const log = require('./log.js');
|
||||
const logLevels = require('./enums/logLevels.js')
|
||||
const logLevels = require('./enums/logLevels.js');
|
||||
|
||||
// once a minute
|
||||
setInterval(gatherMemory, 1000 * 60);
|
||||
|
||||
function gatherMemory() {
|
||||
var memory = process.getProcessMemoryInfo();
|
||||
var details =
|
||||
let memory = process.getProcessMemoryInfo();
|
||||
let details =
|
||||
'workingSetSize: ' + memory.workingSetSize +
|
||||
' peakWorkingSetSize: ' + memory.peakWorkingSetSize +
|
||||
' privatesBytes: ' + memory.privatesBytes +
|
||||
|
@ -8,9 +8,9 @@ const log = require('../log.js');
|
||||
const logLevels = require('../enums/logLevels.js');
|
||||
const eventEmitter = require('../eventEmitter');
|
||||
|
||||
var minimizeOnClose = false;
|
||||
var launchOnStartup = false;
|
||||
var isAlwaysOnTop = false;
|
||||
let minimizeOnClose = false;
|
||||
let launchOnStartup = false;
|
||||
let isAlwaysOnTop = false;
|
||||
|
||||
setCheckboxValues();
|
||||
|
||||
@ -31,10 +31,9 @@ if (isMac) {
|
||||
});
|
||||
}
|
||||
|
||||
const template = [
|
||||
{
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
const template = [{
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
{ role: 'undo' },
|
||||
{ role: 'redo' },
|
||||
{ type: 'separator' },
|
||||
@ -44,228 +43,210 @@ const template = [
|
||||
{ role: 'pasteandmatchstyle' },
|
||||
{ role: 'delete' },
|
||||
{ role: 'selectall' }
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'View',
|
||||
submenu: [{
|
||||
label: 'Reload',
|
||||
accelerator: 'CmdOrCtrl+R',
|
||||
click(item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
focusedWindow.reload();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Reload',
|
||||
accelerator: 'CmdOrCtrl+R',
|
||||
click (item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
focusedWindow.reload();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Toggle Developer Tools',
|
||||
accelerator: isMac ? 'Alt+Command+I' : 'Ctrl+Shift+I',
|
||||
click (item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
focusedWindow.webContents.toggleDevTools();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'resetzoom'
|
||||
},
|
||||
{
|
||||
role: 'zoomin'
|
||||
},
|
||||
{
|
||||
role: 'zoomout'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'togglefullscreen'
|
||||
label: 'Toggle Developer Tools',
|
||||
accelerator: isMac ? 'Alt+Command+I' : 'Ctrl+Shift+I',
|
||||
click(item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
focusedWindow.webContents.toggleDevTools();
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
role: 'window',
|
||||
submenu: [
|
||||
{
|
||||
role: 'minimize'
|
||||
},
|
||||
{
|
||||
role: 'close'
|
||||
}
|
||||
]
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'help',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Learn More',
|
||||
click () { electron.shell.openExternal('https://www.symphony.com') }
|
||||
}
|
||||
]
|
||||
role: 'resetzoom'
|
||||
},
|
||||
{
|
||||
role: 'zoomin'
|
||||
},
|
||||
{
|
||||
role: 'zoomout'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'togglefullscreen'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
role: 'window',
|
||||
submenu: [{
|
||||
role: 'minimize'
|
||||
},
|
||||
{
|
||||
role: 'close'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
role: 'help',
|
||||
submenu: [{
|
||||
label: 'Learn More',
|
||||
click() { electron.shell.openExternal('https://www.symphony.com'); }
|
||||
}]
|
||||
}
|
||||
];
|
||||
|
||||
function getTemplate(app) {
|
||||
if (isMac && template[0].label !== app.getName()) {
|
||||
template.unshift({
|
||||
label: app.getName(),
|
||||
submenu: [
|
||||
{
|
||||
role: 'about'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'services',
|
||||
submenu: []
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'hide'
|
||||
},
|
||||
{
|
||||
role: 'hideothers'
|
||||
},
|
||||
{
|
||||
role: 'unhide'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'quit'
|
||||
}
|
||||
submenu: [{
|
||||
role: 'about'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'services',
|
||||
submenu: []
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'hide'
|
||||
},
|
||||
{
|
||||
role: 'hideothers'
|
||||
},
|
||||
{
|
||||
role: 'unhide'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
role: 'quit'
|
||||
}
|
||||
]
|
||||
});
|
||||
// Edit menu.
|
||||
template[1].submenu.push(
|
||||
{
|
||||
type: 'separator'
|
||||
// Edit menu.
|
||||
template[1].submenu.push({
|
||||
type: 'separator'
|
||||
}, {
|
||||
label: 'Speech',
|
||||
submenu: [{
|
||||
role: 'startspeaking'
|
||||
},
|
||||
{
|
||||
label: 'Speech',
|
||||
submenu: [
|
||||
{
|
||||
role: 'startspeaking'
|
||||
},
|
||||
{
|
||||
role: 'stopspeaking'
|
||||
}
|
||||
]
|
||||
role: 'stopspeaking'
|
||||
}
|
||||
)
|
||||
// Window menu.
|
||||
template[3].submenu = [
|
||||
{
|
||||
label: 'Close',
|
||||
accelerator: 'CmdOrCtrl+W',
|
||||
role: 'close'
|
||||
},
|
||||
{
|
||||
label: 'Minimize',
|
||||
accelerator: 'CmdOrCtrl+M',
|
||||
role: 'minimize'
|
||||
},
|
||||
{
|
||||
label: 'Zoom',
|
||||
role: 'zoom'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Bring All to Front',
|
||||
role: 'front'
|
||||
}
|
||||
]
|
||||
]
|
||||
});
|
||||
// Window menu.
|
||||
template[3].submenu = [{
|
||||
label: 'Close',
|
||||
accelerator: 'CmdOrCtrl+W',
|
||||
role: 'close'
|
||||
},
|
||||
{
|
||||
label: 'Minimize',
|
||||
accelerator: 'CmdOrCtrl+M',
|
||||
role: 'minimize'
|
||||
},
|
||||
{
|
||||
label: 'Zoom',
|
||||
role: 'zoom'
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Bring All to Front',
|
||||
role: 'front'
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
var index = 2;
|
||||
if (isMac && template[0].label !== app.getName()){
|
||||
let index = 2;
|
||||
if (isMac && template[0].label !== app.getName()) {
|
||||
index = 3;
|
||||
}
|
||||
|
||||
// Window menu -> launchOnStartup.
|
||||
template[index].submenu.push(
|
||||
{
|
||||
label: 'Auto Launch On Startup',
|
||||
type: 'checkbox',
|
||||
checked: launchOnStartup,
|
||||
click: function (item) {
|
||||
if (item.checked){
|
||||
symphonyAutoLauncher.enable()
|
||||
.catch(function (err) {
|
||||
let title = 'Error setting AutoLaunch configuration';
|
||||
log.send(logLevels.ERROR, 'MenuTemplate: ' + title + ': auto launch error ' + err);
|
||||
electron.dialog.showErrorBox(title, title + ': ' + err);
|
||||
});
|
||||
} else {
|
||||
symphonyAutoLauncher.disable()
|
||||
.catch(function (err) {
|
||||
let title = 'Error setting AutoLaunch configuration';
|
||||
log.send(logLevels.ERROR, 'MenuTemplate: ' + title + ': auto launch error ' + err);
|
||||
electron.dialog.showErrorBox(title, title + ': ' + err);
|
||||
});
|
||||
}
|
||||
launchOnStartup = item.checked;
|
||||
updateConfigField('launchOnStartup', launchOnStartup);
|
||||
template[index].submenu.push({
|
||||
label: 'Auto Launch On Startup',
|
||||
type: 'checkbox',
|
||||
checked: launchOnStartup,
|
||||
click: function(item) {
|
||||
if (item.checked) {
|
||||
symphonyAutoLauncher.enable()
|
||||
.catch(function(err) {
|
||||
let title = 'Error setting AutoLaunch configuration';
|
||||
log.send(logLevels.ERROR, 'MenuTemplate: ' + title + ': auto launch error ' + err);
|
||||
electron.dialog.showErrorBox(title, title + ': ' + err);
|
||||
});
|
||||
} else {
|
||||
symphonyAutoLauncher.disable()
|
||||
.catch(function(err) {
|
||||
let title = 'Error setting AutoLaunch configuration';
|
||||
log.send(logLevels.ERROR, 'MenuTemplate: ' + title + ': auto launch error ' + err);
|
||||
electron.dialog.showErrorBox(title, title + ': ' + err);
|
||||
});
|
||||
}
|
||||
launchOnStartup = item.checked;
|
||||
updateConfigField('launchOnStartup', launchOnStartup);
|
||||
}
|
||||
)
|
||||
});
|
||||
|
||||
// Window menu -> alwaysOnTop.
|
||||
template[index].submenu.push(
|
||||
{
|
||||
label: 'Always on top',
|
||||
type: 'checkbox',
|
||||
checked: isAlwaysOnTop,
|
||||
click: (item) => {
|
||||
isAlwaysOnTop = item.checked;
|
||||
eventEmitter.emit('isAlwaysOnTop', isAlwaysOnTop);
|
||||
updateConfigField('alwaysOnTop', isAlwaysOnTop);
|
||||
}
|
||||
template[index].submenu.push({
|
||||
label: 'Always on top',
|
||||
type: 'checkbox',
|
||||
checked: isAlwaysOnTop,
|
||||
click: (item) => {
|
||||
isAlwaysOnTop = item.checked;
|
||||
eventEmitter.emit('isAlwaysOnTop', isAlwaysOnTop);
|
||||
updateConfigField('alwaysOnTop', isAlwaysOnTop);
|
||||
}
|
||||
)
|
||||
});
|
||||
|
||||
// Window menu -> minimizeOnClose.
|
||||
// Window menu -> minimizeOnClose.
|
||||
// ToDo: Add behavior on Close.
|
||||
template[index].submenu.push(
|
||||
{
|
||||
label: 'Minimize on Close',
|
||||
type: 'checkbox',
|
||||
checked: minimizeOnClose,
|
||||
click: function (item) {
|
||||
minimizeOnClose = item.checked;
|
||||
updateConfigField('minimizeOnClose', minimizeOnClose);
|
||||
}
|
||||
template[index].submenu.push({
|
||||
label: 'Minimize on Close',
|
||||
type: 'checkbox',
|
||||
checked: minimizeOnClose,
|
||||
click: function(item) {
|
||||
minimizeOnClose = item.checked;
|
||||
updateConfigField('minimizeOnClose', minimizeOnClose);
|
||||
}
|
||||
)
|
||||
});
|
||||
|
||||
if (!isMac){
|
||||
template[index].submenu.push(
|
||||
{
|
||||
label: 'Quit Symphony',
|
||||
click: function () {
|
||||
app.quit();
|
||||
}
|
||||
if (!isMac) {
|
||||
template[index].submenu.push({
|
||||
label: 'Quit Symphony',
|
||||
click: function() {
|
||||
app.quit();
|
||||
}
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
return template;
|
||||
}
|
||||
|
||||
function setCheckboxValues(){
|
||||
function setCheckboxValues() {
|
||||
getConfigField('minimizeOnClose').then(function(mClose) {
|
||||
minimizeOnClose = mClose;
|
||||
}).catch(function (err){
|
||||
}).catch(function(err) {
|
||||
let title = 'Error loading configuration';
|
||||
log.send(logLevels.ERROR, 'MenuTemplate: error getting config field minimizeOnClose, error: ' + err);
|
||||
electron.dialog.showErrorBox(title, title + ': ' + err);
|
||||
@ -273,7 +254,7 @@ function setCheckboxValues(){
|
||||
|
||||
getConfigField('launchOnStartup').then(function(lStartup) {
|
||||
launchOnStartup = lStartup;
|
||||
}).catch(function (err){
|
||||
}).catch(function(err) {
|
||||
let title = 'Error loading configuration';
|
||||
log.send(logLevels.ERROR, 'MenuTemplate: error getting config field launchOnStartup, error: ' + err);
|
||||
electron.dialog.showErrorBox(title, title + ': ' + err);
|
||||
@ -282,7 +263,7 @@ function setCheckboxValues(){
|
||||
getConfigField('alwaysOnTop').then(function(mAlwaysOnTop) {
|
||||
isAlwaysOnTop = mAlwaysOnTop;
|
||||
eventEmitter.emit('isAlwaysOnTop', isAlwaysOnTop);
|
||||
}).catch(function (err){
|
||||
}).catch(function(err) {
|
||||
let title = 'Error loading configuration';
|
||||
log.send(logLevels.ERROR, 'MenuTemplate: error getting config field alwaysOnTop, error: ' + err);
|
||||
electron.dialog.showErrorBox(title, title + ': ' + err);
|
||||
@ -290,7 +271,7 @@ function setCheckboxValues(){
|
||||
|
||||
getConfigField('notificationSettings').then(function(notfObject) {
|
||||
eventEmitter.emit('notificationSettings', notfObject);
|
||||
}).catch(function (err){
|
||||
}).catch(function(err) {
|
||||
let title = 'Error loading configuration';
|
||||
log.send(logLevels.ERROR, 'MenuTemplate: error getting config field notificationSettings, error: ' + err);
|
||||
electron.dialog.showErrorBox(title, title + ': ' + err);
|
||||
@ -298,11 +279,11 @@ function setCheckboxValues(){
|
||||
|
||||
}
|
||||
|
||||
function getMinimizeOnClose(){
|
||||
function getMinimizeOnClose() {
|
||||
return minimizeOnClose;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getTemplate : getTemplate,
|
||||
getMinimizeOnClose : getMinimizeOnClose
|
||||
getTemplate: getTemplate,
|
||||
getMinimizeOnClose: getMinimizeOnClose
|
||||
};
|
@ -8,7 +8,7 @@ const AnimationQueue = function(options) {
|
||||
this.options = options;
|
||||
this.queue = [];
|
||||
this.running = false;
|
||||
}
|
||||
};
|
||||
|
||||
AnimationQueue.prototype.push = function(object) {
|
||||
if (this.running) {
|
||||
@ -17,7 +17,7 @@ AnimationQueue.prototype.push = function(object) {
|
||||
this.running = true;
|
||||
setTimeout(this.animate.bind(this, object), 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
AnimationQueue.prototype.animate = function(object) {
|
||||
object.func.apply(null, object.args)
|
||||
@ -37,10 +37,10 @@ AnimationQueue.prototype.animate = function(object) {
|
||||
' with stack trace:' + err.stack);
|
||||
/* eslint-enable no-console */
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
AnimationQueue.prototype.clear = function() {
|
||||
this.queue = [];
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AnimationQueue;
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict'
|
||||
'use strict';
|
||||
|
||||
//
|
||||
// BrowserWindow preload script use to create notifications window for
|
||||
@ -20,14 +20,14 @@ function setStyle(config) {
|
||||
let close = notiDoc.getElementById('close');
|
||||
|
||||
// Default style
|
||||
setStyleOnDomElement(config.defaultStyleContainer, container)
|
||||
setStyleOnDomElement(config.defaultStyleContainer, container);
|
||||
|
||||
let style = {
|
||||
height: config.height,
|
||||
width: config.width,
|
||||
borderRadius: config.borderRadius + 'px'
|
||||
}
|
||||
setStyleOnDomElement(style, container)
|
||||
};
|
||||
setStyleOnDomElement(style, container);
|
||||
|
||||
setStyleOnDomElement(config.defaultStyleHeader, header);
|
||||
|
||||
@ -49,7 +49,7 @@ function setContents(event, notificationObj) {
|
||||
// Won't check remote files e.g. http://
|
||||
if (notificationObj.sound.match(/^file:/) !== null
|
||||
|| notificationObj.sound.match(/^\//) !== null) {
|
||||
let audio = new window.Audio(notificationObj.sound)
|
||||
let audio = new window.Audio(notificationObj.sound);
|
||||
audio.play()
|
||||
}
|
||||
} catch (e) {
|
||||
@ -102,9 +102,9 @@ function setContents(event, notificationObj) {
|
||||
// note: use onclick because we only want one handler, for case
|
||||
// when content gets overwritten by notf with same tag
|
||||
closeButton.onclick = function(clickEvent) {
|
||||
clickEvent.stopPropagation()
|
||||
clickEvent.stopPropagation();
|
||||
ipc.send('electron-notify-close', winId, notificationObj)
|
||||
}
|
||||
};
|
||||
|
||||
container.onclick = function() {
|
||||
ipc.send('electron-notify-click', winId, notificationObj);
|
||||
@ -129,17 +129,17 @@ function loadConfig(event, conf) {
|
||||
}
|
||||
|
||||
function reset() {
|
||||
let notiDoc = window.document
|
||||
let container = notiDoc.getElementById('container')
|
||||
let closeButton = notiDoc.getElementById('close')
|
||||
let notiDoc = window.document;
|
||||
let container = notiDoc.getElementById('container');
|
||||
let closeButton = notiDoc.getElementById('close');
|
||||
|
||||
// Remove event listener
|
||||
let newContainer = container.cloneNode(true)
|
||||
container.parentNode.replaceChild(newContainer, container)
|
||||
let newCloseButton = closeButton.cloneNode(true)
|
||||
let newContainer = container.cloneNode(true);
|
||||
container.parentNode.replaceChild(newContainer, container);
|
||||
let newCloseButton = closeButton.cloneNode(true);
|
||||
closeButton.parentNode.replaceChild(newCloseButton, closeButton)
|
||||
}
|
||||
|
||||
ipc.on('electron-notify-set-contents', setContents)
|
||||
ipc.on('electron-notify-load-config', loadConfig)
|
||||
ipc.on('electron-notify-reset', reset)
|
||||
ipc.on('electron-notify-set-contents', setContents);
|
||||
ipc.on('electron-notify-load-config', loadConfig);
|
||||
ipc.on('electron-notify-reset', reset);
|
||||
|
@ -9,8 +9,8 @@
|
||||
<p id="message"></p>
|
||||
<div id="close">
|
||||
<svg fill="#000000" height="16" viewBox="0 0 24 24" width="16" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
||||
<path d="M0 0h24v24H0z" fill="none"/>
|
||||
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path>
|
||||
<path d="M0 0h24v24H0z" fill="none"></path>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict'
|
||||
'use strict';
|
||||
//
|
||||
// code here adapted from https://www.npmjs.com/package/electron-notify
|
||||
// made following changes:
|
||||
@ -138,7 +138,7 @@ let config = {
|
||||
nodeIntegration: isNodeEnv
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// function setConfig(customConfig) {
|
||||
// Object.assign(customConfig, config);
|
||||
@ -193,7 +193,7 @@ function calcDimensions() {
|
||||
|
||||
// Calc totalHeight & totalWidth
|
||||
config.totalHeight = config.height + vertSpaceBetweenNotf;
|
||||
config.totalWidth = config.width
|
||||
config.totalWidth = config.width;
|
||||
|
||||
let firstPosX, firstPosY;
|
||||
switch (config.startCorner) {
|
||||
@ -220,10 +220,10 @@ function calcDimensions() {
|
||||
config.firstPos = {
|
||||
x: firstPosX,
|
||||
y: firstPosY
|
||||
}
|
||||
};
|
||||
|
||||
// Set nextInsertPos
|
||||
nextInsertPos.x = config.firstPos.x
|
||||
nextInsertPos.x = config.firstPos.x;
|
||||
nextInsertPos.y = config.firstPos.y
|
||||
}
|
||||
|
||||
@ -283,7 +283,7 @@ function notify(notification) {
|
||||
animationQueue.push({
|
||||
func: showNotification,
|
||||
args: [ notf ]
|
||||
})
|
||||
});
|
||||
return notf.id
|
||||
}
|
||||
log.send(logLevels.ERROR, 'electron-notify: ERROR notify() only accepts a single object with notification parameters.');
|
||||
@ -349,7 +349,7 @@ function showNotification(notificationObj) {
|
||||
});
|
||||
delete notificationWindow.electronNotifyOnCloseFunc;
|
||||
}
|
||||
setNotificationContents(notificationWindow, notificationObj)
|
||||
setNotificationContents(notificationWindow, notificationObj);
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
@ -361,8 +361,8 @@ function showNotification(notificationObj) {
|
||||
// Get inactiveWindow or create new:
|
||||
getWindow().then(function(notificationWindow) {
|
||||
// Move window to position
|
||||
calcInsertPos()
|
||||
setWindowPosition(notificationWindow, nextInsertPos.x, nextInsertPos.y)
|
||||
calcInsertPos();
|
||||
setWindowPosition(notificationWindow, nextInsertPos.x, nextInsertPos.y);
|
||||
|
||||
let updatedNotfWindow = setNotificationContents(notificationWindow, notificationObj);
|
||||
|
||||
@ -387,7 +387,7 @@ function setNotificationContents(notfWindow, notfObj) {
|
||||
clearTimeout(notfWindow.displayTimer);
|
||||
}
|
||||
|
||||
var updatedNotificationWindow = notfWindow;
|
||||
const updatedNotificationWindow = notfWindow;
|
||||
|
||||
updatedNotificationWindow.notfyObj = notfObj;
|
||||
|
||||
@ -459,7 +459,7 @@ function buildCloseNotification(notificationWindow, notificationObj, getTimeoutI
|
||||
}
|
||||
|
||||
// reset content
|
||||
notificationWindow.webContents.send('electron-notify-reset')
|
||||
notificationWindow.webContents.send('electron-notify-reset');
|
||||
if (getTimeoutId && typeof getTimeoutId === 'function') {
|
||||
let timeoutId = getTimeoutId();
|
||||
clearTimeout(timeoutId);
|
||||
@ -533,16 +533,16 @@ function checkForQueuedNotifications() {
|
||||
function moveOneDown(startPos) {
|
||||
return new Promise(function(resolve) {
|
||||
if (startPos >= activeNotifications || startPos === -1) {
|
||||
resolve()
|
||||
resolve();
|
||||
return
|
||||
}
|
||||
// Build array with index of affected notifications
|
||||
let notificationPosArray = []
|
||||
let notificationPosArray = [];
|
||||
for (let i = startPos; i < activeNotifications.length; i++) {
|
||||
notificationPosArray.push(i)
|
||||
}
|
||||
// Start to animate all notifications at once or in parallel
|
||||
let asyncFunc = asyncMap // Best performance
|
||||
let asyncFunc = asyncMap; // Best performance
|
||||
if (config.animateInParallel === false) {
|
||||
asyncFunc = asyncMapSeries // Sluggish
|
||||
}
|
||||
@ -571,19 +571,19 @@ function moveNotificationAnimation(i, done) {
|
||||
}
|
||||
|
||||
// Get startPos, calc step size and start animationInterval
|
||||
let startY = notificationWindow.getPosition()[1]
|
||||
let step = (newY - startY) / config.animationSteps
|
||||
let curStep = 1
|
||||
let startY = notificationWindow.getPosition()[1];
|
||||
let step = (newY - startY) / config.animationSteps;
|
||||
let curStep = 1;
|
||||
let animationInterval = setInterval(function() {
|
||||
// Abort condition
|
||||
if (curStep === config.animationSteps) {
|
||||
setWindowPosition(notificationWindow, config.firstPos.x, newY);
|
||||
clearInterval(animationInterval)
|
||||
clearInterval(animationInterval);
|
||||
done(null, 'done');
|
||||
return;
|
||||
}
|
||||
// Move one step down
|
||||
setWindowPosition(notificationWindow, config.firstPos.x, startY + curStep * step)
|
||||
setWindowPosition(notificationWindow, config.firstPos.x, startY + curStep * step);
|
||||
curStep++
|
||||
}, config.animationStepMs)
|
||||
}
|
||||
@ -621,22 +621,22 @@ function calcInsertPos() {
|
||||
*/
|
||||
function getWindow() {
|
||||
return new Promise(function(resolve) {
|
||||
let notificationWindow
|
||||
let notificationWindow;
|
||||
// Are there still inactiveWindows?
|
||||
if (inactiveWindows.length > 0) {
|
||||
notificationWindow = inactiveWindows.pop()
|
||||
notificationWindow = inactiveWindows.pop();
|
||||
resolve(notificationWindow)
|
||||
} else {
|
||||
// Or create a new window
|
||||
let windowProperties = config.defaultWindow
|
||||
windowProperties.width = config.width
|
||||
windowProperties.height = config.height
|
||||
notificationWindow = new BrowserWindow(windowProperties)
|
||||
notificationWindow.setVisibleOnAllWorkspaces(true)
|
||||
notificationWindow.loadURL(getTemplatePath())
|
||||
let windowProperties = config.defaultWindow;
|
||||
windowProperties.width = config.width;
|
||||
windowProperties.height = config.height;
|
||||
notificationWindow = new BrowserWindow(windowProperties);
|
||||
notificationWindow.setVisibleOnAllWorkspaces(true);
|
||||
notificationWindow.loadURL(getTemplatePath());
|
||||
notificationWindow.webContents.on('did-finish-load', function() {
|
||||
// Done
|
||||
notificationWindow.webContents.send('electron-notify-load-config', config)
|
||||
notificationWindow.webContents.send('electron-notify-load-config', config);
|
||||
resolve(notificationWindow)
|
||||
})
|
||||
}
|
||||
@ -679,6 +679,6 @@ function cleanUpInactiveWindow() {
|
||||
inactiveWindows = [];
|
||||
}
|
||||
|
||||
module.exports.notify = notify
|
||||
module.exports.updateConfig = updateConfig
|
||||
module.exports.reset = setupConfig
|
||||
module.exports.notify = notify;
|
||||
module.exports.updateConfig = updateConfig;
|
||||
module.exports.reset = setupConfig;
|
||||
|
@ -168,10 +168,10 @@ class Notify {
|
||||
*/
|
||||
function Queue(emitter) {
|
||||
/**
|
||||
* Cache emitter on.
|
||||
* @api private
|
||||
*/
|
||||
var cache = emitter.on;
|
||||
* Cache emitter on.
|
||||
* @api private
|
||||
*/
|
||||
const cache = emitter.on;
|
||||
let modifiedEmitter = emitter;
|
||||
/**
|
||||
* Emit event and store it if no
|
||||
@ -180,7 +180,7 @@ function Queue(emitter) {
|
||||
*
|
||||
* .queue('message', 'hi');
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {String} topic
|
||||
*/
|
||||
modifiedEmitter.queue = function(topic) {
|
||||
this._queue = this._queue || {};
|
||||
@ -191,18 +191,18 @@ function Queue(emitter) {
|
||||
(this._queue[topic] = this._queue[topic] || [])
|
||||
.push([].slice.call(arguments, 1));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Listen on the given `event` with `fn`.
|
||||
*
|
||||
* @param {String} event
|
||||
* @param {Function} fn
|
||||
* @return {Emitter}
|
||||
* @return {Event}
|
||||
*/
|
||||
modifiedEmitter.on = modifiedEmitter.addEventListener = function(topic, fn) {
|
||||
this._queue = this._queue || {};
|
||||
var topics = this._queue[topic];
|
||||
const topics = this._queue[topic];
|
||||
cache.apply(this, arguments);
|
||||
|
||||
if (!this._callbacks) {
|
||||
@ -211,7 +211,9 @@ function Queue(emitter) {
|
||||
this._callbacks[topic] = true;
|
||||
|
||||
if (topics) {
|
||||
for(var i = 0, l = topics.length; i < l; i++) {
|
||||
let i = 0;
|
||||
const l = topics.length;
|
||||
for(; i < l; i++) {
|
||||
fn.apply(this, topics[i]);
|
||||
}
|
||||
delete this._queue[topic];
|
||||
|
@ -15,7 +15,7 @@
|
||||
<label class="label">Monitor</label>
|
||||
<div id="screens" class="main">
|
||||
<label>Notification shown on Monitor: </label>
|
||||
<select class="selector" id="screen-selector">
|
||||
<select class="selector" id="screen-selector" title="position">
|
||||
</select>
|
||||
</div>
|
||||
<label class="label">Position</label>
|
||||
|
@ -72,11 +72,11 @@ function createAPI() {
|
||||
// A tags are allowed if they include href='_blank', this cause 'new-window'
|
||||
// event to be received which is handled properly in windowMgr.js
|
||||
window.addEventListener('beforeunload', function(event) {
|
||||
var newUrl = document.activeElement && document.activeElement.href;
|
||||
let newUrl = document.activeElement && document.activeElement.href;
|
||||
if (newUrl) {
|
||||
var currHostName = window.location.hostname;
|
||||
var parsedNewUrl = nodeURL.parse(newUrl);
|
||||
var parsedNewUrlHostName = parsedNewUrl && parsedNewUrl.hostname;
|
||||
let currHostName = window.location.hostname;
|
||||
let parsedNewUrl = nodeURL.parse(newUrl);
|
||||
let parsedNewUrlHostName = parsedNewUrl && parsedNewUrl.hostname;
|
||||
if (currHostName !== parsedNewUrlHostName) {
|
||||
/* eslint-disable no-param-reassign */
|
||||
event.returnValue = 'false';
|
||||
@ -95,8 +95,8 @@ function createAPI() {
|
||||
window.ssf = {
|
||||
getVersionInfo: function() {
|
||||
return new Promise(function(resolve) {
|
||||
var appName = remote.app.getName();
|
||||
var appVer = remote.app.getVersion();
|
||||
let appName = remote.app.getName();
|
||||
let appVer = remote.app.getVersion();
|
||||
|
||||
const verInfo = {
|
||||
containerIdentifier: appName,
|
||||
|
@ -136,13 +136,13 @@ function readResult(outputFileName, resolve, reject, childProcessErr) {
|
||||
|
||||
/* eslint-disable class-methods-use-this */
|
||||
function createError(msg) {
|
||||
var err = new Error(msg);
|
||||
let err = new Error(msg);
|
||||
err.type = 'ERROR';
|
||||
return err;
|
||||
}
|
||||
|
||||
function createWarn(msg) {
|
||||
var err = new Error(msg);
|
||||
let err = new Error(msg);
|
||||
err.type = 'WARN';
|
||||
return err;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ const logLevels = require('../enums/logLevels.js');
|
||||
* Search given argv for argName using exact match or starts with.
|
||||
* @param {Array} argv Array of strings
|
||||
* @param {String} argName Arg name to search for.
|
||||
* @param {bool} exactMatch If true then look for exact match otherwise
|
||||
* @param {Boolean} exactMatch If true then look for exact match otherwise
|
||||
* try finding arg that starts with argName.
|
||||
* @return {String} If found, returns the arg, otherwise null.
|
||||
*/
|
||||
@ -26,4 +26,5 @@ function getCmdLineArg(argv, argName, exactMatch) {
|
||||
|
||||
return null;
|
||||
}
|
||||
module.exports = getCmdLineArg
|
||||
|
||||
module.exports = getCmdLineArg;
|
||||
|
@ -7,12 +7,11 @@
|
||||
* @return {String} guid value in string
|
||||
*/
|
||||
function getGuid() {
|
||||
const guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,
|
||||
function(c) {
|
||||
var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,
|
||||
function (c) {
|
||||
let r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
return guid;
|
||||
}
|
||||
|
||||
module.exports = getGuid;
|
||||
|
@ -5,17 +5,17 @@ const { isMac } = require('./misc.js');
|
||||
const log = require('../log.js');
|
||||
const logLevels = require('../enums/logLevels.js');
|
||||
|
||||
var Registry = require('winreg');
|
||||
var symphonyRegistryHKCU = new Registry({
|
||||
let Registry = require('winreg');
|
||||
let symphonyRegistryHKCU = new Registry({
|
||||
hive: Registry.HKCU,
|
||||
key: symphonyRegistry
|
||||
});
|
||||
|
||||
var symphonyRegistryHKLM = new Registry({
|
||||
let symphonyRegistryHKLM = new Registry({
|
||||
key: symphonyRegistry
|
||||
});
|
||||
|
||||
var symphonyRegistryHKLM6432 = new Registry({
|
||||
let symphonyRegistryHKLM6432 = new Registry({
|
||||
key: symphonyRegistry.replace('\\Software','\\Software\\WOW6432Node')
|
||||
});
|
||||
|
||||
@ -24,24 +24,24 @@ var symphonyRegistryHKLM6432 = new Registry({
|
||||
* that are intended to be used as global (or default) value for all users
|
||||
* running this app.
|
||||
*/
|
||||
var getRegistry = function (name) {
|
||||
var promise = new Promise(function(resolve, reject) {
|
||||
let getRegistry = function (name) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (isMac) {
|
||||
reject('registry is not supported for mac osx.');
|
||||
return;
|
||||
}
|
||||
|
||||
//Try to get registry on HKEY_CURRENT_USER
|
||||
symphonyRegistryHKCU.get( name, function( err1, reg1 ) {
|
||||
if (!err1 && reg1 !==null && reg1.value) {
|
||||
symphonyRegistryHKCU.get(name, function (err1, reg1) {
|
||||
if (!err1 && reg1 !== null && reg1.value) {
|
||||
log.send(logLevels.WARN, 'getRegistry: Cannot find ' + name + ' Registry. Using HKCU');
|
||||
resolve(reg1.value);
|
||||
return;
|
||||
}
|
||||
|
||||
//Try to get registry on HKEY_LOCAL_MACHINE
|
||||
symphonyRegistryHKLM.get( name, function( err2, reg2 ) {
|
||||
if ( !err2 && reg2!==null && reg2.value) {
|
||||
symphonyRegistryHKLM.get(name, function (err2, reg2) {
|
||||
if (!err2 && reg2 !== null && reg2.value) {
|
||||
log.send(logLevels.WARN, 'getRegistry: Cannot find ' + name + ' Registry. Using HKLM');
|
||||
resolve(reg2.value);
|
||||
return;
|
||||
@ -49,18 +49,16 @@ var getRegistry = function (name) {
|
||||
|
||||
// Try to get registry on HKEY_LOCAL_MACHINE in case 32bit app installed on 64bit system.
|
||||
// winreg does not merge keys as normally windows does.
|
||||
symphonyRegistryHKLM6432.get( name, function( err3, reg3 ) {
|
||||
if ( !err3 && reg3!==null && reg3.value) {
|
||||
symphonyRegistryHKLM6432.get(name, function (err3, reg3) {
|
||||
if (!err3 && reg3 !== null && reg3.value) {
|
||||
resolve(reg3.value);
|
||||
} else{
|
||||
} else {
|
||||
reject('Cannot find PodUrl Registry. Using default url.');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
module.exports = getRegistry
|
||||
module.exports = getRegistry;
|
||||
|
@ -1,4 +1,4 @@
|
||||
'use strict'
|
||||
'use strict';
|
||||
|
||||
const electron = require('electron');
|
||||
|
||||
@ -6,8 +6,8 @@ const electron = require('electron');
|
||||
/**
|
||||
* Returns true if given rectangle is contained within the workArea of at
|
||||
* least one of the screens.
|
||||
* @param {x: Number, y: Number, width: Number, height: Number} rect
|
||||
* @return {Boolean} true if condition in desc is met.
|
||||
* @param {Object} rect - ex:- {x: Number, y: Number, width: Number, height: Number}
|
||||
* @return {Boolean} true if condition in desc is met.
|
||||
*/
|
||||
function isInDisplayBounds(rect) {
|
||||
if (!rect) {
|
||||
|
@ -179,7 +179,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
||||
|
||||
function destroyAllWindows() {
|
||||
let keys = Object.keys(windows);
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
for (let i = 0, len = keys.length; i < len; i++) {
|
||||
let winKey = keys[i];
|
||||
removeWindowKey(winKey);
|
||||
}
|
||||
@ -247,7 +247,7 @@ function doCreateMainWindow(initialUrl, initialBounds) {
|
||||
let height = newWinOptions.height || MIN_HEIGHT;
|
||||
|
||||
// try getting x and y position from query parameters
|
||||
var query = newWinParsedUrl && querystring.parse(newWinParsedUrl.query);
|
||||
let query = newWinParsedUrl && querystring.parse(newWinParsedUrl.query);
|
||||
if (query && query.x && query.y) {
|
||||
let newX = Number.parseInt(query.x, 10);
|
||||
let newY = Number.parseInt(query.y, 10);
|
||||
@ -514,11 +514,8 @@ function checkExternalDisplay(appBounds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rightMost > bounds.x + bounds.width || bottomMost > bounds.y + bounds.height) {
|
||||
return false;
|
||||
}
|
||||
return !(rightMost > bounds.x + bounds.width || bottomMost > bounds.y + bounds.height);
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
7171
package-lock.json
generated
7171
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -64,7 +64,7 @@ describe('Tests for ScreenSnippet', function() {
|
||||
expect(rsp.type).toEqual('image/jpg;base64');
|
||||
expect(rsp.data).toEqual(snippetBase64);
|
||||
done();
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ describe('Tests for ScreenSnippet', function() {
|
||||
// skip test for windows - until feature is supported
|
||||
if (isMac) {
|
||||
it('should fail if read file fails', function(done) {
|
||||
var origFsReadFile = fs.readFile;
|
||||
const origFsReadFile = fs.readFile;
|
||||
|
||||
fs.readFile = jest.fn(mockedReadFile);
|
||||
|
||||
|
@ -29,7 +29,7 @@ const ipcMain = {
|
||||
ipcEmitter.on(event, cb);
|
||||
},
|
||||
send: function (event, args) {
|
||||
var senderEvent = {
|
||||
const senderEvent = {
|
||||
sender: {
|
||||
send: function (event, arg) {
|
||||
ipcEmitter.emit(event, arg);
|
||||
@ -45,16 +45,16 @@ const ipcRenderer = {
|
||||
let listeners = ipcEmitter.listeners(event);
|
||||
if (listeners.length > 0) {
|
||||
let listener = listeners[0];
|
||||
var eventArg = {};
|
||||
const eventArg = {};
|
||||
listener(eventArg, args);
|
||||
return eventArg.returnValue;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
send: function(event, args) {
|
||||
var senderEvent = {
|
||||
const senderEvent = {
|
||||
sender: {
|
||||
send: function(event, arg) {
|
||||
send: function (event, arg) {
|
||||
ipcEmitter.emit(event, arg);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ let activityDetection;
|
||||
|
||||
describe('Tests for Activity Detection', function() {
|
||||
|
||||
var originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
const originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
|
||||
|
||||
beforeAll(function(done) {
|
||||
|
@ -62,13 +62,13 @@ describe('read/write config tests', function() {
|
||||
}
|
||||
|
||||
function createTempUserConfig(config) {
|
||||
var tmpDir = os.tmpdir();
|
||||
const tmpDir = os.tmpdir();
|
||||
userConfigDir = fs.mkdtempSync(path.join(tmpDir, 'config-'));
|
||||
return createTempConfigFile(path.join(userConfigDir, configFileName), config);
|
||||
}
|
||||
|
||||
function createTempGlobalConfig(config) {
|
||||
var tmpDir = os.tmpdir();
|
||||
const tmpDir = os.tmpdir();
|
||||
globalConfigDir = path.join(fs.mkdtempSync(path.join(tmpDir, 'config-')), 'config');
|
||||
fs.mkdirSync(globalConfigDir);
|
||||
return createTempConfigFile(path.join(globalConfigDir, configFileName), config);
|
||||
@ -80,15 +80,15 @@ describe('read/write config tests', function() {
|
||||
|
||||
describe('getConfigField tests', function() {
|
||||
it('should fail when field not present in either user or global config', function() {
|
||||
var userConfig = {
|
||||
const userConfig = {
|
||||
url: 'something'
|
||||
}
|
||||
};
|
||||
|
||||
createTempUserConfig(userConfig);
|
||||
|
||||
var globalConfig = {
|
||||
const globalConfig = {
|
||||
url: 'something-else'
|
||||
}
|
||||
};
|
||||
|
||||
createTempGlobalConfig(globalConfig);
|
||||
|
||||
@ -98,9 +98,9 @@ describe('read/write config tests', function() {
|
||||
});
|
||||
|
||||
it('should succeed when field only present in user config', function() {
|
||||
var userConfig = {
|
||||
const userConfig = {
|
||||
url: 'something'
|
||||
}
|
||||
};
|
||||
|
||||
createTempUserConfig(userConfig);
|
||||
|
||||
@ -110,9 +110,9 @@ describe('read/write config tests', function() {
|
||||
});
|
||||
|
||||
it('should succeed when field only present in global config', function() {
|
||||
var globalConfig = {
|
||||
const globalConfig = {
|
||||
url: 'something-else'
|
||||
}
|
||||
};
|
||||
|
||||
createTempGlobalConfig(globalConfig);
|
||||
|
||||
@ -122,15 +122,15 @@ describe('read/write config tests', function() {
|
||||
});
|
||||
|
||||
it('should succeed and return user config field when value is in both', function() {
|
||||
var userConfig = {
|
||||
const userConfig = {
|
||||
url: 'something'
|
||||
}
|
||||
};
|
||||
|
||||
createTempUserConfig(userConfig);
|
||||
|
||||
var globalConfig = {
|
||||
const globalConfig = {
|
||||
url: 'something-else'
|
||||
}
|
||||
};
|
||||
|
||||
createTempGlobalConfig(globalConfig);
|
||||
|
||||
@ -140,7 +140,7 @@ describe('read/write config tests', function() {
|
||||
});
|
||||
|
||||
it('should fail when global config path is invalid', function() {
|
||||
var globalConfig = {
|
||||
const globalConfig = {
|
||||
url: 'something-else'
|
||||
};
|
||||
createTempGlobalConfig(globalConfig);
|
||||
@ -155,7 +155,7 @@ describe('read/write config tests', function() {
|
||||
});
|
||||
|
||||
it('should fail when user config path is invalid', function() {
|
||||
var userConfig = {
|
||||
const userConfig = {
|
||||
url: 'something'
|
||||
};
|
||||
createTempUserConfig(userConfig);
|
||||
@ -170,12 +170,12 @@ describe('read/write config tests', function() {
|
||||
});
|
||||
|
||||
it('should read cached user config value rather than reading file from disk again', function(done) {
|
||||
var userConfig = {
|
||||
const userConfig = {
|
||||
url: 'qa4.symphony.com'
|
||||
};
|
||||
createTempUserConfig(userConfig);
|
||||
|
||||
var userConfig2 = {
|
||||
const userConfig2 = {
|
||||
url: 'qa5.symphony.com'
|
||||
};
|
||||
|
||||
@ -193,12 +193,12 @@ describe('read/write config tests', function() {
|
||||
});
|
||||
|
||||
it('should read cache global config value rather than reading file from disk again', function(done) {
|
||||
var globalConfig = {
|
||||
const globalConfig = {
|
||||
url: 'qa8.symphony.com'
|
||||
};
|
||||
createTempGlobalConfig(globalConfig);
|
||||
|
||||
var globalConfig2 = {
|
||||
const globalConfig2 = {
|
||||
url: 'qa9.symphony.com'
|
||||
};
|
||||
|
||||
@ -220,7 +220,7 @@ describe('read/write config tests', function() {
|
||||
describe('updateConfigField tests', function() {
|
||||
|
||||
it('should succeed and overwrite existing field', function() {
|
||||
var userConfig = {
|
||||
const userConfig = {
|
||||
url: 'something'
|
||||
};
|
||||
|
||||
@ -235,7 +235,7 @@ describe('read/write config tests', function() {
|
||||
});
|
||||
|
||||
it('should succeed and add new field', function() {
|
||||
var userConfig = {
|
||||
const userConfig = {
|
||||
url: 'something'
|
||||
};
|
||||
|
||||
@ -252,7 +252,7 @@ describe('read/write config tests', function() {
|
||||
|
||||
it('should fail to update if invalid field name', function() {
|
||||
|
||||
var userConfig = {
|
||||
const userConfig = {
|
||||
url: 'something'
|
||||
};
|
||||
|
||||
@ -277,7 +277,7 @@ describe('read/write config tests', function() {
|
||||
|
||||
it('should throw error if fieldName is not defined', function() {
|
||||
|
||||
var userConfig = {
|
||||
const userConfig = {
|
||||
url: 'something'
|
||||
};
|
||||
|
||||
@ -291,7 +291,7 @@ describe('read/write config tests', function() {
|
||||
|
||||
it('should throw error if config is not defined', function() {
|
||||
|
||||
var userConfig = {
|
||||
const userConfig = {
|
||||
url: 'something'
|
||||
};
|
||||
|
||||
|
4
tests/fixtures/snippet/snippet-base64.js
vendored
4
tests/fixtures/snippet/snippet-base64.js
vendored
@ -1,5 +1,5 @@
|
||||
// base64 conversion of file ScreenSnippet.jpeg
|
||||
const base64ScreenSnippet =
|
||||
"/9j/4AAQSkZJRgABAQEASABIAAD/4QB0RXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAIdpAAQAAAABAAAATgAAAAAAAABIAAAAAQAAAEgAAAABAAKgAgAEAAAAAQAAAEOgAwAEAAAAAQAAADsAAAAA/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAA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znr824soqOLuuqT/Nfof1h4LY6dbJeSf2JyivSyl+cmFFFFfMn62f/9H8xdO1BtJ1Sz1RBn7NKrkDuoPI/EcV9gwTxXMEdzAweKVQ6s" + "OhVhkH8RXxk67lIr1P4c+OodNVfDutybIM/uJmPCZ/gY9hnoe3TpX3HDuYxpTdKbsn+f8AwT8F8WuE6uNoQxmGjedO6aW7j5ej6dmz3+vTfhp45sfA/wDwlf263kuP7f0C+0iLy8fJLd7Nrtkj5Rt5xzXmIIYBlOQehpa+4qU1OPLLY/mrCYqdCoqtPdf8MFFFcX448eaD4C0h9T1mUGQg+TbqR5sz9go9PVug/IUVasYRc5uyQ8FgquIqxoUIuUpaJI8N/ae8TRW2iad4ThcefeS/aZQOoiiyFz/vMeP9018U10fizxPqXjHX7vxDqrZmumyFGdsaDhUXPZRx+p5rnK/Is4x/1nESqLbp6H9wcD8N/wBlZbTwktZby/xPf7tvkFFFFeYfXH//0vy7qvNCHFWKK9Q8RM2ND8a+J/DaLb2dwJrZekMw3oB6DoR9AQK7mL41Xipi40dHb1WYqPyKN/OvK2AqEquelehQzXEUl" + "ywm7ff+Z8tmXA2U4ybqYjDpye7V4t+vK1f5mv4++Pni2wggh0O2t7A3G/MjAzOu3GNu7C9+6mvljV9Z1XX759T1q7kvbqT70krFmwOgGegHYDgV9If8I3ouvD/ibW3n+R9z53XG7r90r6DrTv8AhXHgz/oH/wDkaX/4uvPx2Mr13+8ndf10PcyHh3Lsvj/slFRb3a1f3vX8T5aor6l/4Vx4M/6B/wD5Gl/+Lo/4Vx4M/wCgf/5Gl/8Ai64PZM+i9sj5aor6l/4Vx4M/6B//AJGl/wDi6P8AhXHgz/oH/wDkaX/4uj2TD2yP/9k=";
|
||||
|
||||
module.exports = base64ScreenSnippet
|
||||
module.exports = base64ScreenSnippet;
|
||||
|
@ -111,7 +111,7 @@ describe('Tests for Zoom in and Zoom out', () => {
|
||||
robot.keyToggle('0', 'up');
|
||||
robot.keyToggle('command', 'up');
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
for (let i = 0; i < 4; i++) {
|
||||
robot.keyToggle('+', 'down', ['command']);
|
||||
}
|
||||
robot.keyToggle('+', 'up');
|
||||
@ -134,7 +134,7 @@ describe('Tests for Zoom in and Zoom out', () => {
|
||||
robot.keyToggle('0', 'up');
|
||||
robot.keyToggle('control', 'up');
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
for (let i = 0; i < 4; i++) {
|
||||
robot.keyToggle('+', 'down', ['control', 'shift']);
|
||||
}
|
||||
robot.keyToggle('+', 'up');
|
||||
@ -159,7 +159,7 @@ describe('Tests for Zoom in and Zoom out', () => {
|
||||
robot.keyToggle('0', 'up');
|
||||
robot.keyToggle('command', 'up');
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
for (let i = 0; i < 4; i++) {
|
||||
robot.keyToggle('-', 'down', ['command']);
|
||||
}
|
||||
robot.keyToggle('-', 'up');
|
||||
@ -183,7 +183,7 @@ describe('Tests for Zoom in and Zoom out', () => {
|
||||
robot.keyToggle('0', 'up');
|
||||
robot.keyToggle('control', 'up');
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
for (let i = 0; i < 4; i++) {
|
||||
robot.keyToggle('-', 'down', ['control']);
|
||||
}
|
||||
robot.keyToggle('-', 'up');
|
||||
|
@ -2,27 +2,27 @@ const getCmdLineArg = require('../../js/utils/getCmdLineArg.js');
|
||||
|
||||
describe('getCmdLineArg tests', function() {
|
||||
it('should return no exact match', function() {
|
||||
var result = getCmdLineArg([ 'hello.exe', '--arg1', '--arg2'], '--arg', true);
|
||||
const result = getCmdLineArg(['hello.exe', '--arg1', '--arg2'], '--arg', true);
|
||||
expect(result).toBe(null);
|
||||
});
|
||||
|
||||
it('should return exact match only', function() {
|
||||
var result = getCmdLineArg([ 'hello.exe', '--arg1', '--arg2'], '--arg2', true);
|
||||
const result = getCmdLineArg(['hello.exe', '--arg1', '--arg2'], '--arg2', true);
|
||||
expect(result).toBe('--arg2');
|
||||
});
|
||||
|
||||
it('should return starts with match', function() {
|
||||
var result = getCmdLineArg([ 'hello.exe', '--hello=test', '--arg2'], '--hello=');
|
||||
const result = getCmdLineArg(['hello.exe', '--hello=test', '--arg2'], '--hello=', false);
|
||||
expect(result).toBe('--hello=test');
|
||||
});
|
||||
|
||||
it('should return no match for starts with', function() {
|
||||
var result = getCmdLineArg([ 'hello.exe', '--hello=test', '--arg2'], '--help=');
|
||||
const result = getCmdLineArg(['hello.exe', '--hello=test', '--arg2'], '--help=', false);
|
||||
expect(result).toBe(null);
|
||||
});
|
||||
|
||||
it('should return no match invalid argv given', function() {
|
||||
var result = getCmdLineArg('invalid argv', '--help=');
|
||||
const result = getCmdLineArg('invalid argv', '--help=', false);
|
||||
expect(result).toBe(null);
|
||||
});
|
||||
});
|
||||
|
@ -2,9 +2,9 @@ const getGuid = require('../../js/utils/getGuid.js');
|
||||
|
||||
describe('guid tests', function() {
|
||||
it('should have valid length', function() {
|
||||
var guid = getGuid();
|
||||
const guid = getGuid();
|
||||
expect(guid.length).toBe(36);
|
||||
var parts = guid.split('-');
|
||||
const parts = guid.split('-');
|
||||
expect(parts.length).toBe(5);
|
||||
expect(parts[0].length).toBe(8);
|
||||
expect(parts[1].length).toBe(4);
|
||||
@ -14,9 +14,9 @@ describe('guid tests', function() {
|
||||
});
|
||||
|
||||
it('should only contains hex chars', function() {
|
||||
for(var i = 0; i < 100; i++) {
|
||||
var guid = getGuid();
|
||||
var parts = guid.split('-');
|
||||
for(let i = 0; i < 100; i++) {
|
||||
const guid = getGuid();
|
||||
const parts = guid.split('-');
|
||||
parts.forEach(function(part) {
|
||||
expect(/^([A-Fa-f0-9]{2})+$/.test(part)).toBe(true);
|
||||
});
|
||||
|
@ -33,12 +33,12 @@ describe('isInDisplayBounds should', function() {
|
||||
}
|
||||
}]);
|
||||
|
||||
var rect = {
|
||||
const rect = {
|
||||
x: 1,
|
||||
y: 1,
|
||||
width: 90,
|
||||
height: 90
|
||||
}
|
||||
};
|
||||
|
||||
expect(isInDisplayBounds(rect)).toBe(true);
|
||||
});
|
||||
@ -53,12 +53,12 @@ describe('isInDisplayBounds should', function() {
|
||||
}
|
||||
}]);
|
||||
|
||||
var rect = {
|
||||
const rect = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 100,
|
||||
height: 100
|
||||
}
|
||||
};
|
||||
|
||||
expect(isInDisplayBounds(rect)).toBe(true);
|
||||
});
|
||||
@ -73,12 +73,12 @@ describe('isInDisplayBounds should', function() {
|
||||
}
|
||||
}]);
|
||||
|
||||
var rect = {
|
||||
const rect = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 100,
|
||||
height: 100
|
||||
}
|
||||
};
|
||||
|
||||
expect(isInDisplayBounds(rect)).toBe(true);
|
||||
});
|
||||
@ -100,15 +100,15 @@ describe('isInDisplayBounds should', function() {
|
||||
x: 100,
|
||||
y: 0
|
||||
}
|
||||
}
|
||||
};
|
||||
createMockDisplay([ display1, display2 ]);
|
||||
|
||||
var rect = {
|
||||
const rect = {
|
||||
x: 110,
|
||||
y: 0,
|
||||
width: 50,
|
||||
height: 50
|
||||
}
|
||||
};
|
||||
|
||||
expect(isInDisplayBounds(rect)).toBe(true);
|
||||
});
|
||||
@ -123,12 +123,12 @@ describe('isInDisplayBounds should', function() {
|
||||
}
|
||||
}]);
|
||||
|
||||
var rect = {
|
||||
const rect = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 100,
|
||||
height: 101
|
||||
}
|
||||
};
|
||||
|
||||
expect(isInDisplayBounds(rect)).toBe(false);
|
||||
});
|
||||
@ -149,15 +149,15 @@ describe('isInDisplayBounds should', function() {
|
||||
x: 100,
|
||||
y: 0
|
||||
}
|
||||
}
|
||||
};
|
||||
createMockDisplay([ display1, display2 ]);
|
||||
|
||||
var rect = {
|
||||
const rect = {
|
||||
x: 50,
|
||||
y: 50,
|
||||
width: 75,
|
||||
height: 25
|
||||
}
|
||||
};
|
||||
|
||||
expect(isInDisplayBounds(rect)).toBe(false);
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
const throttle = require('../../js/utils/throttle.js');
|
||||
|
||||
describe('throttle tests', function() {
|
||||
var now, origNow;
|
||||
let now, origNow;
|
||||
beforeEach(function() {
|
||||
origNow = Date.now;
|
||||
// mock date func
|
||||
|
Loading…
Reference in New Issue
Block a user