Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
click notification show the main window
Browse files Browse the repository at this point in the history
  • Loading branch information
trazyn committed Sep 18, 2017
1 parent e366943 commit 71c12d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,13 @@ const createMainWindow = () => {
}
});

ipcMain.on('show-window', event => {
if (!mainWindow.isVisible()) {
mainWindow.show();
mainWindow.focus();
}
});

ipcMain.on('menu-update', (event, args) => {
var { contacts, conversations } = args;

Expand Down
8 changes: 5 additions & 3 deletions src/js/stores/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,15 @@ class Chat {
if (!helper.isMuted(user)
&& !sync
&& settings.showNotification) {
/* eslint-disable */
new Notification(title, {
let notification = new window.Notification(title, {
icon: user.HeadImgUrl,
body: helper.getMessageContent(message),
vibrate: [200, 100, 200],
});
/* eslint-enable */

notification.onclick = () => {
ipcRenderer.send('show-window');
};
}
list.data.push(message);
}
Expand Down

0 comments on commit 71c12d9

Please sign in to comment.