Skip to content

Commit

Permalink
Merge branch 'release/2.13.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Sep 18, 2018
2 parents 8ba1bd0 + 5d33936 commit 2a01e43
Show file tree
Hide file tree
Showing 16 changed files with 287 additions and 106 deletions.
3 changes: 2 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<!-- INSTRUCTION: Your Pull Request name should start with one of the following tags -->
<!-- [NEW] For new features -->
<!-- [FIX] For bug fixes -->
<!-- [IMPROVE] For non-breaking changes that enhance some existing feature -->
<!-- [BREAK] For pull requests including breaking changes -->

<!-- INSTRUCTION: Keep the line below to notify all core developers about this new PR -->
@RocketChat/desktopapp
@RocketChat/electron

<!-- INSTRUCTION: Inform the issue number that this PR closes, or remove the line below -->
Closes #ISSUE_NUMBER
Expand Down
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,12 @@ install:

script:
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then export CSC_IDENTITY_AUTO_DISCOVERY=false; fi
# e2e tests should be performed only on Linux
- |
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start
sleep 3
yarn e2e
fi
- yarn release
19 changes: 19 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
<a name="2.13.3"></a>
## 2.13.3 (2018-09-18)


### Improvements

- [#881](https://github.com/RocketChat/Rocket.Chat.Electron/pull/881) End-to-end tests
- [#882](https://github.com/RocketChat/Rocket.Chat.Electron/pull/882) Set new DMG background


### Bug Fixes

- [#884](https://github.com/RocketChat/Rocket.Chat.Electron/pull/884) Show tray icon status again
- [#875](https://github.com/RocketChat/Rocket.Chat.Electron/pull/875) Toggled tray icon notifications
- [#880](https://github.com/RocketChat/Rocket.Chat.Electron/pull/880) Tray icon toggle crashes in MacOS
- [#869](https://github.com/RocketChat/Rocket.Chat.Electron/pull/869) Window state errors on save when antivirus software is present



<a name="2.13.2"></a>
## 2.13.2 (2018-09-10)

Expand Down
Binary file modified build/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified build/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions build/installer.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@
!endif

!macro customInstall
; Remove dangling references of versions 2.13.0 and 2.13.1
SetRegView 64
DeleteRegKey HKLM "Software\9b73a9fb-f1d5-59ee-b41e-e1dd393a748a"
; Remove dangling reference of version 2.13.1
${If} $installMode == "all"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\66bed7da-e601-54e6-b2e8-7be611d82556"
${Else}
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\66bed7da-e601-54e6-b2e8-7be611d82556"
${EndIf}
Delete "$SMSTARTUP\Rocket.Chat+.lnk"
!macroend

!macro customUnInstall
${IfNot} ${Silent}
Delete "$SMSTARTUP\Rocket.Chat.lnk"
${endif}
${EndIf}
!macroend
14 changes: 14 additions & 0 deletions e2e/app.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { expect } from 'chai';
import { app, startApp, stopApp } from './utils';

import packageJson from '../package.json';

describe('application', function () {
before(startApp);
after(stopApp);

it('shows the main window', async function () {
expect(await app.browserWindow.isVisible()).to.be.true;
expect(await app.browserWindow.getTitle()).to.be.equal(packageJson.productName);
});
});
14 changes: 0 additions & 14 deletions e2e/hello_world.e2e.js

This file was deleted.

86 changes: 74 additions & 12 deletions e2e/utils.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,87 @@
import path from 'path';
import electron from 'electron';
import { Application } from 'spectron';

var beforeEach = function () {
export let app = null;
let logFetchInterval = null;

export async function startApp () {
this.timeout(10000);
this.app = new Application({

app = new Application({
path: electron,
args: ['.'],
startTimeout: 10000,
waitTimeout: 10000,
cwd: process.cwd(),
args: [path.join(__dirname, '..')],
quitTimeout: 5000,
startTimeout: 5000,
waitTimeout: 5000,
});
return this.app.start();

await app.start();
await app.client.waitUntilWindowLoaded();

logFetchInterval = setInterval(fetchLogs, 100);
};

var afterEach = function () {
export async function stopApp () {
this.timeout(10000);
if (this.app && this.app.isRunning()) {
return this.app.stop();

if (app && app.isRunning()) {
clearInterval(logFetchInterval);
fetchLogs();
await app.stop();
app = null;
}
};

export default {
beforeEach: beforeEach,
afterEach: afterEach,
const fetchLogs = async () => {
const logs = await app.client.getMainProcessLogs();
logs.forEach(log => console.log(log));
};

export const menuItem = (menuId, cb) => ({
get exists() {
return app.client.execute((menuId) => {
const { Menu } = require('electron').remote;
const appMenu = Menu.getApplicationMenu();
const menuItem = appMenu.getMenuItemById(menuId);
return !!menuItem;
}, menuId).then(({ value }) => value);
},

get enabled() {
return app.client.execute((menuId) => {
const { Menu } = require('electron').remote;
const appMenu = Menu.getApplicationMenu();
const menuItem = appMenu.getMenuItemById(menuId);
return menuItem.enabled;
}, menuId).then(({ value }) => value);
},

get visible() {
return app.client.execute((menuId) => {
const { Menu } = require('electron').remote;
const appMenu = Menu.getApplicationMenu();
const menuItem = appMenu.getMenuItemById(menuId);
return menuItem.visible;
}, menuId).then(({ value }) => value);
},

get label() {
return app.client.execute((menuId) => {
const { Menu } = require('electron').remote;
const appMenu = Menu.getApplicationMenu();
const menuItem = appMenu.getMenuItemById(menuId);
return menuItem.label;
}, menuId).then(({ value }) => value);
},

click() {
return app.client.execute((menuId) => {
const { Menu } = require('electron').remote;
const appMenu = Menu.getApplicationMenu();
const menuItem = appMenu.getMenuItemById(menuId);
menuItem.click();
}, menuId);
}
});
17 changes: 15 additions & 2 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,26 @@
"mas"
],
"icon": "build/icon.icns",
"bundleVersion": "36",
"bundleVersion": "37",
"helperBundleId": "chat.rocket.electron.helper",
"type": "distribution",
"artifactName": "rocketchat-${version}.${ext}"
},
"dmg": {
"background": "build/background.png"
"background": "build/background.png",
"contents": [
{
"type": "dir",
"x": 100,
"y": 211
},
{
"type": "link",
"path": "/Applications",
"x": 500,
"y": 211
}
]
},
"pkg": {
"isRelocatable": false,
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "rocketchat",
"productName": "Rocket.Chat",
"description": "Rocket.Chat Native Cross-Platform Desktop Application via Electron.",
"version": "2.13.2",
"version": "2.13.3",
"author": "Rocket.Chat Support <[email protected]>",
"copyright": "© 2018, Rocket.Chat",
"homepage": "https://rocket.chat",
Expand Down Expand Up @@ -35,12 +35,12 @@
"spellchecker": "^3.5.0"
},
"optionalDependencies": {
"node-mac-notifier": "^1.0.3"
"node-mac-notifier": "^1.1.0"
},
"devDependencies": {
"chai": "^4.1.2",
"conventional-changelog-cli": "^2.0.5",
"electron": "^2.0.8",
"electron": "^2.0.9",
"electron-builder": "^20.28.4",
"electron-mocha": "^6.0.4",
"eslint": "^5.5.0",
Expand All @@ -56,6 +56,7 @@
"mocha": "^5.2.0",
"rollup": "^0.65.2",
"rollup-plugin-istanbul": "^2.0.1",
"rollup-plugin-json": "^3.1.0",
"run-sequence": "^2.2.1",
"spectron": "^4.0.0"
},
Expand Down
17 changes: 8 additions & 9 deletions src/background/mainWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import { app, BrowserWindow, ipcMain, nativeImage } from 'electron';
import url from 'url';
import path from 'path';
import { debounce } from 'lodash';

import windowStateKeeper from './windowState';
import env from '../env';
Expand All @@ -29,24 +28,24 @@ const attachWindowStateHandling = (mainWindow) => {

// macOS only
app.on('activate', () => {
mainWindowState.saveState(mainWindow);
mainWindow.show();
});

app.on('before-quit', () => {
mainWindowState.saveState(mainWindow);
mainWindow.forceClose = true;
mainWindowState.saveState.flush();
mainWindow = null;
});

mainWindow.on('show', () => {
mainWindowState.saveState(mainWindow);
});

mainWindow.on('close', function (event) {
if (mainWindow.forceClose) {
mainWindowState.saveState(mainWindow);
if (!mainWindow) {
return;
}

event.preventDefault();
if (mainWindow.isFullScreen()) {
mainWindow.once('leave-full-screen', () => {
Expand All @@ -59,13 +58,13 @@ const attachWindowStateHandling = (mainWindow) => {
mainWindowState.saveState(mainWindow);
});

mainWindow.on('resize', debounce(() => {
mainWindow.on('resize', () => {
mainWindowState.saveState(mainWindow);
}), 1000);
});

mainWindow.on('move', debounce(() => {
mainWindow.on('move', () => {
mainWindowState.saveState(mainWindow);
}), 1000);
});
};

const attachIpcMessageHandling = (mainWindow) => {
Expand Down
3 changes: 2 additions & 1 deletion src/background/windowState.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import { app } from 'electron';
import jetpack from 'fs-jetpack';
import { debounce } from 'lodash';

export default function (name, defaults) {

Expand Down Expand Up @@ -61,7 +62,7 @@ export default function (name, defaults) {
get isMaximized () { return state.isMaximized; },
get isMinimized () { return state.isMinimized; },
get isHidden () { return state.isHidden; },
saveState,
saveState: debounce(saveState, 1000), // see https://github.com/RocketChat/Rocket.Chat.Electron/issues/181
loadState
};
}
13 changes: 10 additions & 3 deletions src/scripts/tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const statusBullet = {
online: '\u001B[32m•',
away: '\u001B[33m•',
busy: '\u001B[31m•',
offline: '\u001B[30m•'
offline: '\u001B[37m•'
};

const messageCountColor = {
Expand Down Expand Up @@ -130,7 +130,8 @@ function showTrayAlert (badge, status = 'online') {
if (mainWindow.tray === null || mainWindow.tray === undefined) {
return;
}
mainWindow.tray.setImage(getTrayImagePath(badge));

const trayDisplayed = localStorage.getItem('hideTray') !== 'true';
const hasMentions = badge.showAlert && badge.count > 0;

if (!mainWindow.isFocused()) {
Expand All @@ -155,13 +156,19 @@ function showTrayAlert (badge, status = 'online') {
if (hasMentions) {
trayTitle = `${statusBullet[status]} ${countColor}${badge.title}`;
}
mainWindow.tray.setTitle(trayTitle);
remote.app.dock.setBadge(badge.title);
if (trayDisplayed) {
mainWindow.tray.setTitle(trayTitle);
}
}

if (process.platform === 'linux') {
remote.app.setBadgeCount(badge.count);
}

if (trayDisplayed) {
mainWindow.tray.setImage(getTrayImagePath(badge));
}
}

function removeAppTray () {
Expand Down
6 changes: 5 additions & 1 deletion tasks/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const path = require('path');
const jetpack = require('fs-jetpack');
const rollup = require('rollup').rollup;
const rollupJson = require('rollup-plugin-json');

const nodeBuiltInModules = ['assert', 'buffer', 'child_process', 'cluster',
'console', 'constants', 'crypto', 'dgram', 'dns', 'domain', 'events',
Expand Down Expand Up @@ -31,7 +32,10 @@ module.exports = function (src, dest, opts) {
input: src,
external: generateExternalModulesList(),
cache: cached[src],
plugins: opts.rollupPlugins,
plugins: [].concat(
opts.rollupPlugins,
rollupJson()
),
})
.then(function (bundle) {
cached[src] = bundle;
Expand Down
Loading

0 comments on commit 2a01e43

Please sign in to comment.