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 <ronan@jouchet.fr>
This commit is contained in:
Sam Potts 2021-07-06 08:35:50 +10:00 committed by GitHub
parent 629369d885
commit 5e526fb000
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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;