ELECTRON-1327 - Bump Electron version to 5.x (#754)

This commit is contained in:
Kiran Niranjan 2019-07-31 16:53:50 +05:30 committed by Vishwas Shashidhar
parent e86c82d307
commit b0bf48e9ed
4 changed files with 20 additions and 18 deletions

View File

@ -85,16 +85,16 @@
}, },
"devDependencies": { "devDependencies": {
"@types/enzyme": "3.9.0", "@types/enzyme": "3.9.0",
"@types/ffi": "0.2.2", "@types/ffi-napi": "2.4.1",
"@types/ref-napi": "1.4.0",
"@types/jest": "23.3.12", "@types/jest": "23.3.12",
"@types/node": "10.11.4", "@types/node": "10.11.4",
"@types/react": "16.8.3", "@types/react": "16.8.3",
"@types/react-dom": "16.0.9", "@types/react-dom": "16.0.9",
"@types/ref": "0.0.28",
"browserify": "16.2.3", "browserify": "16.2.3",
"cross-env": "5.2.0", "cross-env": "5.2.0",
"del": "3.0.0", "del": "3.0.0",
"electron": "3.1.12", "electron": "5.0.8",
"electron-builder": "20.38.4", "electron-builder": "20.38.4",
"electron-builder-squirrel-windows": "20.38.3", "electron-builder-squirrel-windows": "20.38.3",
"electron-rebuild": "1.8.2", "electron-rebuild": "1.8.2",
@ -121,16 +121,16 @@
"electron-fetch": "1.3.0", "electron-fetch": "1.3.0",
"electron-log": "2.2.17", "electron-log": "2.2.17",
"electron-spellchecker": "git+https://github.com/symphonyoss/electron-spellchecker.git#v2.0.1", "electron-spellchecker": "git+https://github.com/symphonyoss/electron-spellchecker.git#v2.0.1",
"ffi": "git+https://github.com/symphonyoss/node-ffi.git#v1.2.8", "ffi-napi": "2.4.5",
"filesize": "3.6.1", "filesize": "3.6.1",
"lodash.isequal": "4.5.0", "lodash.isequal": "4.5.0",
"react": "16.6.3", "react": "16.6.3",
"react-dom": "16.6.0", "react-dom": "16.6.0",
"ref": "1.3.5", "ref-napi": "1.4.1",
"shell-path": "2.1.0" "shell-path": "2.1.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"screen-snippet": "git+https://github.com/symphonyoss/ScreenSnippet.git#v1.0.7", "screen-snippet": "git+https://github.com/symphonyoss/ScreenSnippet.git#v1.0.7",
"swift-search": "1.55.3-2" "swift-search": "1.55.2-beta.1"
} }
} }

View File

@ -1,7 +1,7 @@
import { app } from 'electron'; import { app } from 'electron';
import { Library } from 'ffi'; import { Library } from 'ffi-napi';
import * as path from 'path'; import * as path from 'path';
import { refType, types } from 'ref'; import { refType, types } from 'ref-napi';
const execPath = path.dirname(app.getPath('exe')); const execPath = path.dirname(app.getPath('exe'));
import { isDevEnv, isMac } from '../common/env'; import { isDevEnv, isMac } from '../common/env';

View File

@ -18,7 +18,7 @@ class MemoryMonitor {
this.isInMeeting = false; this.isInMeeting = false;
this.canReload = true; this.canReload = true;
this.maxIdleTime = 4 * 60 * 60 * 1000; // 4 hours this.maxIdleTime = 4 * 60 * 60 * 1000; // 4 hours
this.memoryThreshold = 800; // 800MB this.memoryThreshold = 800 * 1024; // 800MB
this.memoryRefreshThreshold = 60 * 60 * 1000; // 1 hour this.memoryRefreshThreshold = 60 * 60 * 1000; // 1 hour
} }
@ -57,16 +57,15 @@ class MemoryMonitor {
(electron.powerMonitor as any).querySystemIdleTime((time) => { (electron.powerMonitor as any).querySystemIdleTime((time) => {
const idleTime = time * 1000; const idleTime = time * 1000;
const workingSetSizeInMB = this.memoryInfo && (this.memoryInfo.workingSetSize / 1024) || 0;
if (!(!this.isInMeeting if (!(!this.isInMeeting
&& windowHandler.isOnline && windowHandler.isOnline
&& this.canReload && this.canReload
&& idleTime > this.maxIdleTime && idleTime > this.maxIdleTime
&& (workingSetSizeInMB > this.memoryThreshold)) && (this.memoryInfo && this.memoryInfo.private > this.memoryThreshold))
) { ) {
logger.info(`memory-monitor: Not Reloading the app as logger.info(`memory-monitor: Not Reloading the app as
application was refreshed less than a hour ago? ${this.canReload ? 'no' : 'yes'} application was refreshed less than a hour ago? ${this.canReload ? 'no' : 'yes'}
memory consumption is ${(workingSetSizeInMB) || 'unknown'}mb is less than? ${this.memoryThreshold}mb memory consumption is ${(this.memoryInfo && this.memoryInfo.private) || 'unknown'}kb is less than? ${this.memoryThreshold}kb
system idle tick was ${idleTime}ms is less than? ${this.maxIdleTime}ms system idle tick was ${idleTime}ms is less than? ${this.maxIdleTime}ms
user was in a meeting? ${this.isInMeeting} user was in a meeting? ${this.isInMeeting}
is network online? ${windowHandler.isOnline}`); is network online? ${windowHandler.isOnline}`);
@ -75,7 +74,7 @@ class MemoryMonitor {
const mainWindow = windowHandler.getMainWindow(); const mainWindow = windowHandler.getMainWindow();
if (mainWindow && windowExists(mainWindow)) { if (mainWindow && windowExists(mainWindow)) {
logger.info(`memory-monitor: Reloading the app to optimize memory usage as logger.info(`memory-monitor: Reloading the app to optimize memory usage as
memory consumption is ${workingSetSizeInMB}mb is greater than? ${this.memoryThreshold}mb threshold memory consumption is ${this.memoryInfo.private}kb is greater than? ${this.memoryThreshold}kb threshold
system idle tick was ${idleTime}ms is greater than ${this.maxIdleTime}ms system idle tick was ${idleTime}ms is greater than ${this.maxIdleTime}ms
user was in a meeting? ${this.isInMeeting} user was in a meeting? ${this.isInMeeting}
is network online? ${windowHandler.isOnline}`); is network online? ${windowHandler.isOnline}`);

View File

@ -55,12 +55,15 @@ ipcRenderer.on('page-load', (_event, { locale, resources, enableCustomTitleBar,
ReactDOM.render(element, div); ReactDOM.render(element, div);
} }
webFrame.setSpellCheckProvider('en-US', false,{ webFrame.setSpellCheckProvider('en-US', {
spellCheck(text) { spellCheck(words, callback) {
return !ipcRenderer.sendSync(apiName.symphonyApi, { const misspelled = words.filter((word) => {
return ipcRenderer.sendSync(apiName.symphonyApi, {
cmd: apiCmds.isMisspelled, cmd: apiCmds.isMisspelled,
word: text, word,
}); });
});
callback(misspelled);
}, },
}); });