fix #2409 - Integrate App Badging API for unread messages

This commit is contained in:
Dele Olajide 2021-02-17 15:18:25 +00:00 committed by JC Brand
parent 8d74e063af
commit 61dacfd2a5
2 changed files with 5 additions and 0 deletions

View File

@ -5,6 +5,7 @@
- #1083: Add support for XEP-0393 Message Styling
- #2275: Allow punctuation to immediately precede a mention
- #2400: Fixes infinite loop bug when appending .png to allowed image urls
- #2409: Integrate App Badging API for unread messages
- Add support for XEP-0437 Room Activity Indicators see [muc-subscribe-to-rai](https://conversejs.org/docs/html/configuration.html#muc-subscribe-to-rai)
- Bugfix: Use real JID in XEP-0372 references only when the MUC is non-anonymous
- Bugfix: Connection protocol not updated based on XEP-0156 connection methods

View File

@ -25,6 +25,8 @@ export function areDesktopNotificationsEnabled () {
export function clearFavicon () {
favicon = null;
navigator.clearAppBadge?.()
.catch(e => log.error("Could not clear unread count in app badge " + e));
}
export function updateUnreadFavicon () {
@ -33,6 +35,8 @@ export function updateUnreadFavicon () {
const chats = _converse.chatboxes.models;
const num_unread = chats.reduce((acc, chat) => acc + (chat.get('num_unread') || 0), 0);
favicon.badge(num_unread);
navigator.setAppBadge?.(num_unread)
.catch(e => log.error("Could set unread count in app badge - " + e));
}
}