Merge pull request #3845 from thelounge/xpaw/native-badging

Implement native app badges for highlights (Chrome 81+)
This commit is contained in:
Pavel Djundik 2020-07-08 12:33:52 +03:00 committed by GitHub
commit dbe1427e7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,6 +101,14 @@ store.watch(
(_, getters) => getters.highlightCount,
(highlightCount) => {
favicon.setAttribute("href", highlightCount > 0 ? faviconAlerted : faviconNormal);
if (navigator.setAppBadge) {
if (highlightCount > 0) {
navigator.setAppBadge(highlightCount);
} else {
navigator.clearAppBadge();
}
}
}
);