Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the method for detecting unread messages for Google Chat #554

Merged
merged 2 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading