Skip to content

Commit

Permalink
Fix Web Skype bug
Browse files Browse the repository at this point in the history
  • Loading branch information
stanfieldr committed Aug 5, 2016
1 parent d1586ed commit 9c0d527
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
11 changes: 11 additions & 0 deletions views/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@
setActivityHandle(settings.RefreshInterval);
});

setInterval(function() {
let hasNotifications = document.querySelector('.unseenNotifications');
let count = 0;

if (hasNotifications) {
count = 1;
}

ipc.sendToHost('notification-count', count);
}, 1000);

window.addEventListener("DOMContentLoaded", function(event) {
$ = require('../assets/jquery-2.2.3.min');

Expand Down
20 changes: 4 additions & 16 deletions views/skype.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,6 @@ function checkMicrosoftAccount(event, currentURL) {
}
}

/**
* Decides if the user has any unread notifications and
* provides the appropriate feedback to the tray icon
*/
function checkTrayIcon(event) {
let result = /^\((\d+)\)/.exec(event.title);
let count = 0;

if (result !== null && result.length === 2) {
count = Number(result[1]);
}

TrayIcon.setNotificationCount(count);
}

function boot() {
skypeView.removeEventListener('dom-ready', boot);

Expand Down Expand Up @@ -123,7 +108,6 @@ skypeView.addEventListener('page-title-updated', function(event) {
title.innerHTML = event.title;

checkMicrosoftAccount(event, currentURL);
checkTrayIcon(event);
});

skypeView.addEventListener('new-window', function(event) {
Expand Down Expand Up @@ -152,5 +136,9 @@ let ipcHandler = {
// Open links in external browser
electron.shell.openExternal(href);
}
},

'notification-count': function(count) {
TrayIcon.setNotificationCount(count);
}
}

0 comments on commit 9c0d527

Please sign in to comment.