Merge remote-tracking branch 'origin/develop' into release-v0.9.1

This commit is contained in:
David Baker 2016-12-06 16:02:26 +00:00
commit d31a675ca8
3 changed files with 14 additions and 2 deletions

View File

@ -159,10 +159,14 @@ electron.app.on('ready', () => {
mainWindow = new electron.BrowserWindow({ mainWindow = new electron.BrowserWindow({
icon: `${__dirname}/../img/riot.ico`, icon: `${__dirname}/../img/riot.ico`,
width: 1024, height: 768, width: 1024, height: 768,
show: false,
}); });
mainWindow.loadURL(`file://${__dirname}/../../webapp/index.html`); mainWindow.loadURL(`file://${__dirname}/../../webapp/index.html`);
electron.Menu.setApplicationMenu(VectorMenu); electron.Menu.setApplicationMenu(VectorMenu);
mainWindow.once('ready-to-show', () => {
mainWindow.show();
});
mainWindow.on('closed', () => { mainWindow.on('closed', () => {
mainWindow = null; mainWindow = null;
}); });
@ -198,3 +202,9 @@ electron.app.on('activate', () => {
electron.app.on('before-quit', () => { electron.app.on('before-quit', () => {
appQuitting = true; appQuitting = true;
}); });
// Set the App User Model ID to match what the squirrel
// installer uses for the shortcut icon.
// This makes notifications work on windows 8.1 (and is
// a noop on other platforms).
electron.app.setAppUserModelId('com.squirrel.riot-web.Riot');

View File

@ -79,7 +79,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
return true; return true;
} }
displayNotification(title: string, msg: string, avatarUrl: string): Notification { displayNotification(title: string, msg: string, avatarUrl: string, room: Object): Notification {
// Notifications in Electron use the HTML5 notification API // Notifications in Electron use the HTML5 notification API
const notification = new global.Notification( const notification = new global.Notification(
title, title,
@ -97,6 +97,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
room_id: room.roomId room_id: room.roomId
}); });
global.focus(); global.focus();
electron.remote.getCurrentWindow().restore();
}; };
return notification; return notification;

View File

@ -103,7 +103,7 @@ export default class WebPlatform extends VectorBasePlatform {
return defer.promise; return defer.promise;
} }
displayNotification(title: string, msg: string, avatarUrl: string) { displayNotification(title: string, msg: string, avatarUrl: string, room: Object) {
const notification = new global.Notification( const notification = new global.Notification(
title, title,
{ {
@ -120,6 +120,7 @@ export default class WebPlatform extends VectorBasePlatform {
room_id: room.roomId room_id: room.roomId
}); });
global.focus(); global.focus();
notification.close();
}; };
// Chrome only dismisses notifications after 20s, which // Chrome only dismisses notifications after 20s, which