Skip to content

Commit

Permalink
Fix Zoho Mail badge (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
eandersons authored Nov 25, 2023
1 parent f8e5512 commit 44d1197
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion recipes/zoho/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "zoho",
"name": "Zoho Mail",
"version": "1.4.0",
"version": "1.4.1",
"license": "MIT",
"config": {
"serviceURL": "https://www.zoho.com/mail/login.html",
Expand Down
23 changes: 12 additions & 11 deletions recipes/zoho/webview-unsafe.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// wait for Ferdium and Zoho Mail to initialize
if (
Object.prototype.hasOwnProperty.call(window, 'ferdium') &&
Object.prototype.hasOwnProperty.call(window.ferdium, 'setBadge') &&
Object.prototype.hasOwnProperty.call(window, 'zmNCenter') &&
Object.prototype.hasOwnProperty.call(window, 'zmfolAction')
) {
const unreadNotifications = window.zmNCenter.counter.count(); // General Notifications by Zoho (Bell Icon)
const unreadMail = window.zmfolAction.getUnreadViewCount(); // Unread messages count

window.ferdium.setBadge(unreadMail, unreadNotifications);
// Wait for Ferdium to initialize
if (window.ferdium?.setBadge !== undefined) {
window.ferdium.setBadge(
window.ferdium.safeParseInt(window.zmfolAction?.getUnreadViewCount()) +
window.ferdium.safeParseInt(
document.querySelector('#wms_menu_unreadchats_cnt')?.textContent,
),
window.ferdium.safeParseInt(
window.zmTopBar?.topBandElements()?.notification?.children
?.notificationBadge?.textContent,
),
);
}

0 comments on commit 44d1197

Please sign in to comment.