diff --git a/background.js b/background.js index 0ab7c473f6..f94a30a6a5 100644 --- a/background.js +++ b/background.js @@ -5,6 +5,9 @@ if (localStorage.getItem('first_install_ran')) { if (isRegistrationDone()) { subscribeToPush(function(message) { console.log("Got message from " + message.source + ": \"" + getString(message.message)); + var newUnreadCount = storage.getUnencrypted("unreadCount") + 1; + storage.putUnencrypted("unreadCount", newUnreadCount); + chrome.browserAction.setBadgeText({text: newUnreadCount + ""}); storeMessage(message); }); } diff --git a/helpers.js b/helpers.js index 7851f7b3a7..56b83963cf 100644 --- a/helpers.js +++ b/helpers.js @@ -82,6 +82,12 @@ function getDeviceId(encodedNumber) { return 1; } +function timestampToHumanReadable(timestamp) { + var date = new Date(); + date.setTime(timestamp*1000); + return date.toUTCString(); +} + /************************************************ *** Utilities to store data in local storage *** ************************************************/ diff --git a/popup.js b/popup.js index 00582ac1fd..38894c9157 100644 --- a/popup.js +++ b/popup.js @@ -30,16 +30,21 @@ if (storage.getUnencrypted("number_id") === undefined) { for (var i = 0; i < MAX_CONVERSATIONS && i < conversations.length; i++) { var conversation = conversations[i]; ul.append('