Skip to content

Commit

Permalink
Fix the method for detecting unread messages for Google Chat (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shampra authored May 24, 2024
1 parent aee0211 commit 0ac1286
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion recipes/hangoutschat/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "hangoutschat",
"name": "Hangouts Chat",
"version": "1.8.1",
"version": "1.8.2",
"license": "MIT",
"aliases": [
"google-chat",
Expand Down
9 changes: 2 additions & 7 deletions recipes/hangoutschat/webview.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ module.exports = Ferdium => {
'https://accounts.google.com/AccountChooser?continue=https://chat.google.com/?referrer=2';
}

// class corresponding to the red badge that is visible for direct messages
const directMessageSelector = 'div.V6.CL.su.ahD.X9.Y2 span.akt span.XU';

// class corresponding to the bold text that is visible for room messages
const indirectMessageSelector = 'div.V6.CL.V2.X9.Y2 span.akt span.XU';

Expand All @@ -25,10 +22,8 @@ module.exports = Ferdium => {
let directCount;
let indirectCount;

const directCountSelector = document.querySelector(directMessageSelector);
if (directCountSelector) {
directCount = Number(directCountSelector.textContent);
}
// get unread messages count
directCount = document.querySelectorAll('link[href^="https://ssl.gstatic.com/ui/v1/icons/mail/images/favicon_chat_new_notif_"][href$=".ico"]').length;

// get unread indirect messages
const indirectCountSelector = document.querySelector(
Expand Down

0 comments on commit 0ac1286

Please sign in to comment.