From a667f229eddea718981549ca159fae92a0aefa72 Mon Sep 17 00:00:00 2001 From: Mike Deeks Date: Thu, 25 May 2017 20:25:28 -0700 Subject: [PATCH] Badge icon should include count from notifications panel Adds support for incrementing the badge count based on the count of items in the notification panel. This tells you if you have tasks due or meetings coming up. --- office365/webview.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/office365/webview.js b/office365/webview.js index 0b28302..ed5f642 100644 --- a/office365/webview.js +++ b/office365/webview.js @@ -2,9 +2,18 @@ const path = require('path'); module.exports = (Franz, options) => { const getMessages = () => { - const unreadMail = jQuery("span[title*='Inbox'] + div > span").first().text(); + unreadMail = parseInt(jQuery("span[title*='Inbox'] + div > span").first().text()); + notifications = parseInt(jQuery("div[class*='o365cs-flexPane-unseenitems']").text().trim()); - Franz.setBadge(unreadMail); + badgeCount = 0 + if (Number.isInteger(notifications)) { + badgeCount += notifications + } + if (Number.isInteger(unreadMail)) { + badgeCount += unreadMail + } + + Franz.setBadge(badgeCount); } Franz.loop(getMessages);