aboutsummaryrefslogtreecommitdiffstats
path: root/uncompressed
diff options
context:
space:
mode:
authorLibravatar Feiko Joosten <feiko_joosten@hotmail.com>2020-04-21 20:12:58 +0200
committerLibravatar GitHub <noreply@github.com>2020-04-21 18:12:58 +0000
commit3c455ffd71c58e44b2a7f6c51bd9343d78c4edde (patch)
treef92e40451cb13c9127592d6b013d0f95a1ad12a8 /uncompressed
parentFixes notifications for Steamchat (#121) (diff)
downloadferdium-recipes-3c455ffd71c58e44b2a7f6c51bd9343d78c4edde.tar.gz
ferdium-recipes-3c455ffd71c58e44b2a7f6c51bd9343d78c4edde.tar.zst
ferdium-recipes-3c455ffd71c58e44b2a7f6c51bd9343d78c4edde.zip
Fixes notifications for WhatsApp (#120)
- Fixes an issue where whatsapp doesn't properly detect notifications. - Added support for indirect notifications (muted chats)
Diffstat (limited to 'uncompressed')
-rw-r--r--uncompressed/whatsapp/package.json4
-rw-r--r--uncompressed/whatsapp/webview.js20
2 files changed, 16 insertions, 8 deletions
diff --git a/uncompressed/whatsapp/package.json b/uncompressed/whatsapp/package.json
index 210e8d1..49afab1 100644
--- a/uncompressed/whatsapp/package.json
+++ b/uncompressed/whatsapp/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "whatsapp", 2 "id": "whatsapp",
3 "name": "WhatsApp", 3 "name": "WhatsApp",
4 "version": "2.0.0", 4 "version": "2.0.1",
5 "description": "WhatsApp", 5 "description": "WhatsApp",
6 "main": "index.js", 6 "main": "index.js",
7 "author": "Stefan Malzner <stefan@adlk.io>", 7 "author": "Stefan Malzner <stefan@adlk.io>",
@@ -9,6 +9,8 @@
9 "config": { 9 "config": {
10 "serviceURL": "https://web.whatsapp.com", 10 "serviceURL": "https://web.whatsapp.com",
11 "hasNotificationSound": true, 11 "hasNotificationSound": true,
12 "hasDirectMessages": true,
13 "hasIndirectMessages": true,
12 "disablewebsecurity": true 14 "disablewebsecurity": true
13 } 15 }
14} 16}
diff --git a/uncompressed/whatsapp/webview.js b/uncompressed/whatsapp/webview.js
index 989680a..6cc173a 100644
--- a/uncompressed/whatsapp/webview.js
+++ b/uncompressed/whatsapp/webview.js
@@ -28,16 +28,22 @@ window.addEventListener('beforeunload', async () => {
28 28
29module.exports = Franz => { 29module.exports = Franz => {
30 const getMessages = function getMessages() { 30 const getMessages = function getMessages() {
31 const elements = document.querySelectorAll('.CxUIE, .unread, ._0LqQ'); 31 const elements = document.querySelectorAll("[class=OUeyt]");
32 let count = 0; 32 var count = 0;
33 var indirectCount = 0;
33 34
34 for (let i = 0; i < elements.length; i += 1) { 35 for (var i = 0; i < elements.length; i += 1) {
35 if (elements[i].querySelectorAll('*[data-icon="muted"]').length === 0) { 36 var countValue = parseInt(elements[i].textContent, 10);
36 count += 1; 37
37 } 38 if (elements[i].parentNode.previousElementSibling === null || elements[i].parentNode.previousElementSibling.querySelectorAll("[data-icon=muted]").length === 0) {
39 count += countValue;
40 }
41 else {
42 indirectCount += countValue;
43 }
38 } 44 }
39 45
40 Franz.setBadge(count); 46 Franz.setBadge(count, indirectCount);
41 }; 47 };
42 48
43 Franz.injectCSS(path.join(__dirname, 'service.css')); 49 Franz.injectCSS(path.join(__dirname, 'service.css'));