Open thread on native notification click (#20176)
This commit is contained in:
parent
705366ab8c
commit
23b21c940c
2 changed files with 10 additions and 35 deletions
|
@ -368,7 +368,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||
return true;
|
||||
}
|
||||
|
||||
displayNotification(title: string, msg: string, avatarUrl: string, room: Room): Notification {
|
||||
displayNotification(title: string, msg: string, avatarUrl: string, room: Room, ev?: MatrixEvent): Notification {
|
||||
// GNOME notification spec parses HTML tags for styling...
|
||||
// Electron Docs state all supported linux notification systems follow this markup spec
|
||||
// https://github.com/electron/electron/blob/master/docs/tutorial/desktop-environment-integration.md#linux
|
||||
|
@ -379,20 +379,17 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||
msg = msg.replace(/</g, '<').replace(/>/g, '>');
|
||||
}
|
||||
|
||||
// Notifications in Electron use the HTML5 notification API
|
||||
const notifBody = {
|
||||
body: msg,
|
||||
silent: true, // we play our own sounds
|
||||
};
|
||||
if (avatarUrl) notifBody['icon'] = avatarUrl;
|
||||
const notification = new window.Notification(title, notifBody);
|
||||
const notification = super.displayNotification(
|
||||
title,
|
||||
msg,
|
||||
avatarUrl,
|
||||
room,
|
||||
ev,
|
||||
);
|
||||
|
||||
const handler = notification.onclick as Function;
|
||||
notification.onclick = () => {
|
||||
dis.dispatch({
|
||||
action: 'view_room',
|
||||
room_id: room.roomId,
|
||||
});
|
||||
window.focus();
|
||||
handler?.();
|
||||
this.ipcCall('focusWindow');
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue