From 5e526fb0001090ef73c836f620fa2938f46af80c Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Tue, 6 Jul 2021 08:35:50 +1000 Subject: [PATCH] Fix badge/counter icon not being removed correctly (fixes #1251) (PR #1252) The current check for `count` means the value to reset/remove the badge (`''`) is treated as `false` and therefore the badge does not get removed. This PR changes the check for `undefined` instead which resolves the issue. Related issue: https://github.com/nativefier/nativefier/issues/1251 Testing performed: - I ran `npm t` as per the docs. All tests passed. - I created a new app build for Twitter (`https://twitter.com`) and Messenger (`https://messenger.com`) to verify the correct behaviour. Both were showed the issue as resolved. Co-authored-by: Ronan Jouchet --- app/src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main.ts b/app/src/main.ts index b0bb0ce..2c46894 100644 --- a/app/src/main.ts +++ b/app/src/main.ts @@ -169,7 +169,7 @@ if (appArgs.lang) { let currentBadgeCount = 0; const setDockBadge = isOSX() ? (count?: number | string, bounce = false): void => { - if (count) { + if (count !== undefined) { app.dock.setBadge(count.toString()); if (bounce && count > currentBadgeCount) app.dock.bounce(); currentBadgeCount = typeof count === 'number' ? count : 0;