Community-edition: Custom Service Unread Badge doesn't work

Created on 5 Feb 2019  路  6Comments  路  Source: ramboxapp/community-edition

Steps to reproduce

  1. Add Feedly as a custom service; log in
  2. Use custom JS script:
const originalTitle = document.title;

function checkUnread() {
  const e = document.querySelectorAll('[data-category="global.all"].categoryUnreadCount')[0];
  const count = parseInt(e.innerHTML.trim());

  if(count >= 1) {
    document.title = `(${count}) ${originalTitle}`;
  } else {
    document.title = originalTitle;
  }
}

setInterval(checkUnread, 3000);
  1. Verify the document.title has in fact been changed by typing document.title in DevTools console.

Expected behavior

Unread badge should appear on Feedly tab

Actual behavior

It does not.
image

ENVIRONMENT

Version: 0.6.3
Platform: win32 (x64)
Electron: 2.0.14
Chromium: 61.0.3163.100
Node: 8.9.3

wontfix

All 6 comments

Thanks for opening your first issue here! Be sure to follow the issue template!

I checked this as it was happening to me.
Try updating the unread count, instead of changing the document title as specified in https://github.com/ramboxapp/community-edition/tree/master/app/model

That is, instead of

document.title = '(${count}) ${originalTitle}';

do

rambox.setUnreadCount(count);

(having parsed the count string to number).
In my case I'm also clearing the count, don't know if that is necessary:

rambox.clearUnreadCount();

You can try these at the developer tools first.
Tested on

Version: 0.6.3\
Platform: win32 (x64)
Electron: 2.0.14
Chromium: 61.0.3163.100
Node: 8.9.3

Works perfectly, thanks!

So now my code is:

function checkUnread() {
  const e = document.querySelectorAll('[data-category="global.all"].categoryUnreadCount')[0];
  const count = parseInt(e.innerHTML.trim());

  rambox.setUnreadCount(count || 0);
}

setInterval(checkUnread, 3000);

It would be nice to have that in the docs... @saenzramiro

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed since there has not been any recent activity. Please open a new issue for related bugs.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings