From 8698ff27fa039a5b8fc7d9eb1985ebf3135b07e8 Mon Sep 17 00:00:00 2001 From: Sampath Kumar Krishnan Date: Sat, 18 Apr 2020 11:16:04 +0530 Subject: fix: Update notification handling in hangouts chat - Fix the logic of handling direct and indirect messages - Update the modified class names - Refactor webview.js - Update png and svg icons (they were not 1024x1024) - Fixes #102 Co-Authored-By: Mahadevan Sreenivasan --- all.json | 2 +- archives/hangoutschat.tar.gz | Bin 10244 -> 113815 bytes uncompressed/hangoutschat/icon.png | Bin 5414 -> 112748 bytes uncompressed/hangoutschat/icon.svg | 37 +++++++-------------------------- uncompressed/hangoutschat/package.json | 2 +- uncompressed/hangoutschat/webview.js | 23 +++++++++++++------- 6 files changed, 25 insertions(+), 39 deletions(-) diff --git a/all.json b/all.json index a7f19dd..8b53691 100644 --- a/all.json +++ b/all.json @@ -345,7 +345,7 @@ "featured": false, "id": "hangoutschat", "name": "Hangouts Chat", - "version": "1.2.1", + "version": "1.2.2", "icons": { "png": "https://cdn.jsdelivr.net/gh/getferdi/recipes/uncompressed/hangoutschat/icon.png", "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/uncompressed/hangoutschat/icon.svg" diff --git a/archives/hangoutschat.tar.gz b/archives/hangoutschat.tar.gz index 609643e..4aaa597 100644 Binary files a/archives/hangoutschat.tar.gz and b/archives/hangoutschat.tar.gz differ diff --git a/uncompressed/hangoutschat/icon.png b/uncompressed/hangoutschat/icon.png index 288e3ba..2f7120e 100644 Binary files a/uncompressed/hangoutschat/icon.png and b/uncompressed/hangoutschat/icon.png differ diff --git a/uncompressed/hangoutschat/icon.svg b/uncompressed/hangoutschat/icon.svg index eae3ddd..9238971 100644 --- a/uncompressed/hangoutschat/icon.svg +++ b/uncompressed/hangoutschat/icon.svg @@ -1,30 +1,9 @@ - - - hangoutschat - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + diff --git a/uncompressed/hangoutschat/package.json b/uncompressed/hangoutschat/package.json index 4b69fd3..3dce42f 100644 --- a/uncompressed/hangoutschat/package.json +++ b/uncompressed/hangoutschat/package.json @@ -1,7 +1,7 @@ { "id": "hangoutschat", "name": "Hangouts Chat", - "version": "1.2.1", + "version": "1.2.2", "description": "Hangouts Chat", "main": "index.js", "author": "Stefan Malzner and Iván López (ilopmar)", diff --git a/uncompressed/hangoutschat/webview.js b/uncompressed/hangoutschat/webview.js index ea8a1b2..9597f58 100644 --- a/uncompressed/hangoutschat/webview.js +++ b/uncompressed/hangoutschat/webview.js @@ -1,29 +1,36 @@ module.exports = (Franz) => { + // class corresponding to the mute icon const muteSelector = '.DQy0Rb'; - const directMessageSelector = '.eM5l9e.FVKzAb'; - const indirectMessageSelector = '.PL5Wwe.H7du2 .t5F5nf'; + + // class corresponding to the red badge that is visible for direct messages + const directMessageSelector = '.SaMfhe.m9MHid'; + + // class corresponding to the bold text that is visible for all messages + const allMessageSelector = '.IL9EXe.PL5Wwe.dHI9xe.H7du2'; const isMuted = node => !!node.closest('[role="listitem"]').querySelector(muteSelector); const getMessages = function getMessages() { - - // get unread messages + let allMessageCount = 0; let directCount = 0; + + // get unread direct messages document.querySelectorAll(directMessageSelector).forEach((node) => { // Hangouts Chat overrides the muted indicator when there is a direct mention - if (!isMuted(node)) { + // Check for the width of the badge element + if (!isMuted(node) && node.clientWidth != 0 ) { directCount += 1; } }); let indirectCount = 0; - document.querySelectorAll(indirectMessageSelector).forEach((node) => { + document.querySelectorAll(allMessageSelector).forEach((node) => { if (!isMuted(node)) { - indirectCount += 1; + allMessageCount += 1; } }); - indirectCount -= directCount; + indirectCount = allMessageCount - directCount; // set Franz badge Franz.setBadge(directCount, indirectCount); -- cgit v1.2.3-70-g09d2