Skip to content

Commit

Permalink
Merge pull request #1036 from RocketChat/break/update-dependencies
Browse files Browse the repository at this point in the history
[BREAK] Update dependencies
  • Loading branch information
tassoevan authored Dec 9, 2018
2 parents 1d67b85 + cb880ff commit 145eda6
Show file tree
Hide file tree
Showing 4 changed files with 497 additions and 315 deletions.
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,18 @@
},
"dependencies": {
"@paulcbetts/system-idle-time": "^1.0.4",
"electron-updater": "3.0.4",
"freedesktop-notifications": "^1.2.3",
"electron-updater": "^4.0.5",
"freedesktop-notifications": "^1.4.0",
"fs-jetpack": "^2.2.0",
"lodash": "^4.17.11",
"spellchecker": "^3.5.0",
"tmp": "^0.0.33"
},
"optionalDependencies": {},
"devDependencies": {
"@rocket.chat/eslint-config": "^0.1.2",
"chai": "^4.2.0",
"conventional-changelog-cli": "^2.0.11",
"electron": "^2.0.14",
"electron-builder": "^20.28.4",
"electron": "^3.0.10",
"electron-builder": "^20.38.2",
"electron-mocha": "^6.0.4",
"eslint": "^5.9.0",
"gulp": "^3.9.1",
Expand All @@ -66,7 +64,7 @@
"spectron": "^5.0.0"
},
"devEngines": {
"node": ">=7.x",
"node": ">=8.12.x",
"npm": ">=4.x",
"yarn": ">=0.21.3"
}
Expand Down
43 changes: 23 additions & 20 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ const parseProtocolUrls = (args) =>
const addServers = (protocolUrls) => parseProtocolUrls(protocolUrls)
.forEach((serverUrl) => addServer(serverUrl));

const isSecondInstance = app.makeSingleInstance(async(argv) => {
(await getMainWindow()).show();
addServers(argv.slice(2));
});

if (isSecondInstance && !process.mas) {
app.quit();
}

// macOS only
app.on('open-url', (event, url) => {
event.preventDefault();
Expand All @@ -81,19 +72,31 @@ if (process.platform === 'linux') {
app.disableHardwareAcceleration();
}

app.on('ready', async() => {
unsetDefaultApplicationMenu();

appData.initialize();

const mainWindow = await getMainWindow();
certificate.initWindow(mainWindow);

autoUpdate();
});

ipcMain.on('getSystemIdleTime', (event) => {
event.returnValue = idle.getIdleTime();
});

process.on('unhandledRejection', console.error.bind(console));


const gotTheLock = app.requestSingleInstanceLock();

if (gotTheLock) {
app.on('second-instance', async(event, argv) => {
(await getMainWindow()).show();
addServers(argv.slice(2));
});

app.on('ready', async() => {
unsetDefaultApplicationMenu();

appData.initialize();

const mainWindow = await getMainWindow();
certificate.initWindow(mainWindow);

autoUpdate();
});
} else {
app.quit();
}
21 changes: 20 additions & 1 deletion src/background/windowState.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
import { app, screen } from 'electron';
import jetpack from 'fs-jetpack';
import { debounce } from 'lodash';


const debounce = (f, delay) => {
let call;
let timeout;


const ret = function(...args) {
call = () => f.apply(this, args);
clearTimeout(timeout);
timeout = setTimeout(call, delay);
};

ret.flush = () => {
clearTimeout(timeout);
call();
};

return ret;
};

export default (name, defaults) => {

Expand Down
Loading

0 comments on commit 145eda6

Please sign in to comment.