Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clicking on notifications #2700

Merged
merged 1 commit into from
Dec 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions electron/src/electron-main.js
Original file line number Diff line number Diff line change
@@ -202,3 +202,9 @@ electron.app.on('activate', () => {
electron.app.on('before-quit', () => {
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');
3 changes: 2 additions & 1 deletion src/vector/platform/ElectronPlatform.js
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
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
const notification = new global.Notification(
title,
@@ -97,6 +97,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
room_id: room.roomId
});
global.focus();
electron.remote.getCurrentWindow().restore();
};

return notification;
3 changes: 2 additions & 1 deletion src/vector/platform/WebPlatform.js
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ export default class WebPlatform extends VectorBasePlatform {
return defer.promise;
}

displayNotification(title: string, msg: string, avatarUrl: string) {
displayNotification(title: string, msg: string, avatarUrl: string, room: Object) {
const notification = new global.Notification(
title,
{
@@ -120,6 +120,7 @@ export default class WebPlatform extends VectorBasePlatform {
room_id: room.roomId
});
global.focus();
notification.close();
};

// Chrome only dismisses notifications after 20s, which