electron-97: completed point 1 in refactoring

This commit is contained in:
Vishwas Shashidhar 2017-08-23 22:08:33 +05:30
parent 5d6a3670a2
commit 7ab0f75e2e
13 changed files with 7261 additions and 87 deletions

View File

@ -1,20 +1,23 @@
'use strict';
// Third Party Dependencies
const electron = require('electron');
const app = electron.app;
const nodeURL = require('url');
const squirrelStartup = require('electron-squirrel-startup');
const AutoLaunch = require('auto-launch');
const urlParser = require('url');
const { getConfigField } = require('./config.js');
const { isMac, isDevEnv } = require('./utils/misc.js');
const protocolHandler = require('./protocolHandler');
const getCmdLineArg = require('./utils/getCmdLineArg.js');
const childProcess = require('child_process');
const path = require('path');
const AppDirectory = require('appdirectory');
const dirs = new AppDirectory('Symphony');
// Local Dependencies
const { getConfigField } = require('./config.js');
const { isMac, isDevEnv } = require('./utils/misc.js');
const protocolHandler = require('./protocolHandler');
const getCmdLineArg = require('./utils/getCmdLineArg.js');
require('electron-dl')();
// used to check if a url was opened when the app was already open

View File

@ -9,7 +9,7 @@ const electron = require('electron');
const windowMgr = require('./windowMgr.js');
const log = require('./log.js');
const logLevels = require('./enums/logLevels');
const activityDetection = require('./activityDetection/activityDetection');
const activityDetection = require('./activityDetection');
const badgeCount = require('./badgeCount.js');
const protocolHandler = require('./protocolHandler');
const configureNotification = require('./notify/settings/configure-notification-position');

View File

@ -19,7 +19,7 @@ const apiCmds = apiEnums.cmds;
const apiName = apiEnums.apiName;
const getMediaSources = require('../desktopCapturer/getSources');
require('../downloadManager/downloadManager');
require('../downloadManager');
// bug in electron preventing us from using spellchecker in pop outs
// https://github.com/electron/electron/issues/4025
@ -28,7 +28,7 @@ require('../downloadManager/downloadManager');
document.addEventListener('DOMContentLoaded', () => {
try {
/* eslint-disable global-require */
const SpellCheckerHelper = require('../spellChecker/spellChecker').SpellCheckHelper;
const SpellCheckerHelper = require('../spellChecker').SpellCheckHelper;
/* eslint-enable global-require */
// Method to initialize spell checker
const spellChecker = new SpellCheckerHelper();
@ -102,7 +102,7 @@ function createAPI() {
containerIdentifier: appName,
containerVer: appVer,
apiVer: '1.0.0'
}
};
resolve(verInfo);
});
},
@ -126,9 +126,9 @@ function createAPI() {
/**
* provides api to allow user to capture portion of screen, see api
* details in screenSnipper/ScreenSnippet.js
* details in screenSnipper/index.js
*/
ScreenSnippet: remote.require('./screenSnippet/ScreenSnippet.js').ScreenSnippet,
ScreenSnippet: remote.require('./screenSnippet/index.js').ScreenSnippet,
/**
* Brings window forward and gives focus.

View File

@ -120,8 +120,7 @@ function readResult(outputFileName, resolve, reject, childProcessErr) {
});
} catch (error) {
reject(createError(error));
}
finally {
} finally {
// remove tmp file (async)
fs.unlink(outputFileName, function(removeErr) {
// note: node complains if calling async
@ -153,4 +152,4 @@ module.exports = {
ScreenSnippet: ScreenSnippet,
// note: readResult only exposed for testing purposes
readResult: readResult
}
};

7171
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,9 @@
"transformIgnorePatterns": []
},
"build": {
"asarUnpack": ["node_modules/@paulcbetts/cld/build/Release/cld.node"],
"asarUnpack": [
"node_modules/@paulcbetts/cld/build/Release/cld.node"
],
"files": [
"!coverage/*",
"!installer/*",

View File

@ -1,4 +1,4 @@
const downloadManager = require('../js/downloadManager/downloadManager');
const downloadManager = require('../js/downloadManager');
const electron = require('./__mocks__/electron');
describe('download manager', function() {

View File

@ -1,10 +1,9 @@
const { ScreenSnippet, readResult } = require('../js/screenSnippet/ScreenSnippet.js');
const { ScreenSnippet, readResult } = require('../js/screenSnippet');
const path = require('path');
const fs = require('fs');
const os = require('os');
const { isMac } = require('../js/utils/misc.js')
const { isMac } = require('../js/utils/misc.js');
const snippetBase64 = require('./fixtures/snippet/snippet-base64.js');

View File

@ -10,7 +10,7 @@ describe('Tests for Activity Detection', function () {
beforeAll(function(done) {
childProcess.exec(`npm rebuild --target=${process.version} --build-from-source`, function(err) {
activityDetection = require('../js/activityDetection/activityDetection.js');
activityDetection = require('../js/activityDetection');
activityDetection.setActivityWindow(900000, electron.ipcRenderer);
done();
});