hamsket icon indicating copy to clipboard operation
hamsket copied to clipboard

Whatsapp new message

Open LiBOSS-CZ opened this issue 3 years ago • 7 comments

Steps to reproduce

  1. Recieve new message on Whatsapp account

Expected behavior

See unread message count in badge and red icon in system tray.

Actual behavior

Nothing happened.

I have also tried latest Rambox CE 0.7.9 and same bad behaviour.

ENVIRONMENT

Hamsket: v0.6.3

OS: Windows 10 Pro

Arch: x64

BuildVersion: 4b36e9f

Does this happen upstream: unknown

LiBOSS-CZ avatar Dec 08 '21 15:12 LiBOSS-CZ

Same issue with me as well. Looks like the js_unread is somehow bad? Where can I find the code that goes into js_unread?

vraravam avatar Dec 24 '21 15:12 vraravam

Unread message count can be obtained using this snippet (doesn't handle muted conversations):

const unreadSpans = document.querySelectorAll('span[aria-label]');
if (unreadSpans) { hamsket.setUnreadCount([...unreadSpans].map(x => Number(x.textContent)).reduce((a, b) => a + b)); }

vraravam avatar Dec 24 '21 17:12 vraravam

Hello, any chance to make whatsapp notification badge working again soon? It is really pain in the *ss

LiBOSS-CZ avatar Jan 21 '22 11:01 LiBOSS-CZ

Unread message count can be obtained using this snippet (doesn't handle muted conversations):

const unreadSpans = document.querySelectorAll('span[aria-label]');
if (unreadSpans) { hamsket.setUnreadCount([...unreadSpans].map(x => Number(x.textContent)).reduce((a, b) => a + b)); }

I've dropped into 0.6.3 Whatsapp's "custom badge update js" but no results...

maurerr avatar Feb 09 '22 06:02 maurerr

I copied the query from ServicesList.js and replaced the query selector with "#pane-side div span div span[aria-label]". So the following custom JS worked for me with 0.6.3:

let checkUnread=()=>{const elements=document.querySelectorAll("#pane-side div span div span[aria-label]");let count=0;for(const i of elements){const gp=i.parentNode.parentNode;0===gp.querySelectorAll('#pane-side *[data-icon="muted"]').length&&count++}hamsket.updateBadge(count)};setInterval(checkUnread,1e3);let unregister_queue=[];navigator.serviceWorker.getRegistrations().then(registrations=>{for(const registration of registrations)unregister_queue.push(registration.unregister());return unregister_queue}).then(queue=>{}).catch(err=>{});

emareg avatar Feb 13 '22 14:02 emareg

I copied the query from ServicesList.js and replaced the query selector with "#pane-side div span div span[aria-label]". So the following custom JS worked for me with 0.6.3:

let checkUnread=()=>{const elements=document.querySelectorAll("#pane-side div span div span[aria-label]");let count=0;for(const i of elements){const gp=i.parentNode.parentNode;0===gp.querySelectorAll('#pane-side *[data-icon="muted"]').length&&count++}hamsket.updateBadge(count)};setInterval(checkUnread,1e3);let unregister_queue=[];navigator.serviceWorker.getRegistrations().then(registrations=>{for(const registration of registrations)unregister_queue.push(registration.unregister());return unregister_queue}).then(queue=>{}).catch(err=>{});

great workaround - I confirm it works

maurerr avatar Feb 14 '22 06:02 maurerr

I have a solution. An Old release of Rambox v 0.8.0 works and looks exactly the same as Hamsket, but whatsapp unread messages work: https://github.com/ramboxapp/community-edition/releases

JackGraymer avatar May 05 '22 17:05 JackGraymer