From 7b6f329b85912afab5d8576de26ed57f25230131 Mon Sep 17 00:00:00 2001 From: Rui Gonçalves Date: Mon, 20 Jul 2020 13:23:23 +0100 Subject: Add support for empty unread badges Empty unread badges show up when people manually "Mark as Unread" chat threads. Currently, this stops notifications from appearing as counts become NaN. With this PR they will stop being counted (since we don't have message counts in those cases and it's not really a notification I think this is probably the best behavior, but I'm ok with defaulting to 1). --- all.json | 2 +- archives/whatsapp.tar.gz | Bin 183549 -> 183548 bytes uncompressed/whatsapp/package.json | 2 +- uncompressed/whatsapp/webview.js | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/all.json b/all.json index 3ab1923..314f7a8 100644 --- a/all.json +++ b/all.json @@ -1126,7 +1126,7 @@ "featured": true, "id": "whatsapp", "name": "WhatsApp", - "version": "2.0.6", + "version": "2.0.7", "icons": { "png": "https://cdn.jsdelivr.net/gh/getferdi/recipes/uncompressed/whatsapp/icon.png", "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/uncompressed/whatsapp/icon.svg" diff --git a/archives/whatsapp.tar.gz b/archives/whatsapp.tar.gz index dd48a42..4bb91a0 100644 Binary files a/archives/whatsapp.tar.gz and b/archives/whatsapp.tar.gz differ diff --git a/uncompressed/whatsapp/package.json b/uncompressed/whatsapp/package.json index 4dc3f3b..c4c60ce 100644 --- a/uncompressed/whatsapp/package.json +++ b/uncompressed/whatsapp/package.json @@ -1,7 +1,7 @@ { "id": "whatsapp", "name": "WhatsApp", - "version": "2.0.6", + "version": "2.0.7", "description": "WhatsApp", "main": "index.js", "author": "Stefan Malzner ", diff --git a/uncompressed/whatsapp/webview.js b/uncompressed/whatsapp/webview.js index 23838ac..263c543 100644 --- a/uncompressed/whatsapp/webview.js +++ b/uncompressed/whatsapp/webview.js @@ -33,7 +33,7 @@ module.exports = Franz => { var indirectCount = 0; for (var i = 0; i < elements.length; i += 1) { - var countValue = parseInt(elements[i].textContent, 10); + var countValue = parseInt(elements[i].textContent || '0', 10); if (elements[i].parentNode.previousElementSibling === null || elements[i].parentNode.previousElementSibling.querySelectorAll("[data-icon=muted]").length === 0) { count += countValue; @@ -48,4 +48,4 @@ module.exports = Franz => { Franz.injectCSS(path.join(__dirname, 'service.css')); Franz.loop(getMessages); -}; \ No newline at end of file +}; -- cgit v1.2.3-70-g09d2