From c4ccf7c8e3dceb2b99b99b67c79094e759b173e6 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 3 May 2017 22:29:06 -0700 Subject: [PATCH] Inline setUnreadCount // FREEBIE --- js/conversation_controller.js | 8 +++++++- js/panel_controller.js | 10 ---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/js/conversation_controller.js b/js/conversation_controller.js index e9591879f..d1164f74c 100644 --- a/js/conversation_controller.js +++ b/js/conversation_controller.js @@ -62,7 +62,13 @@ ); storage.put("unreadCount", newUnreadCount); - setUnreadCount(newUnreadCount); + if (newUnreadCount > 0) { + window.setBadgeCount(newUnreadCount); + window.document.title = "Signal (" + newUnreadCount + ")"; + } else { + window.setBadgeCount(0); + window.document.title = "Signal"; + } if (newUnreadCount === 0) { window.clearAttention(); } diff --git a/js/panel_controller.js b/js/panel_controller.js index 43525bed0..cfec29c23 100644 --- a/js/panel_controller.js +++ b/js/panel_controller.js @@ -25,14 +25,4 @@ }; var inboxWindowId = 'inbox'; - window.setUnreadCount = function(count) { - if (count > 0) { - window.setBadgeCount(count); - window.document.title = "Signal (" + count + ")"; - } else { - window.setBadgeCount(0); - window.document.title = "Signal"; - } - }; - })();