diff options
author | 2021-10-23 04:31:50 +0530 | |
---|---|---|
committer | 2021-10-23 04:31:50 +0530 | |
commit | c5af7f0d0ca6fb2e111389bc3a997721090939c2 (patch) | |
tree | 4dc5d04d192598c01ba4a83eab3770a33dacff1d | |
parent | fix: correct the import of API_VERSION (#2112) (diff) | |
download | ferdium-app-c5af7f0d0ca6fb2e111389bc3a997721090939c2.tar.gz ferdium-app-c5af7f0d0ca6fb2e111389bc3a997721090939c2.tar.zst ferdium-app-c5af7f0d0ca6fb2e111389bc3a997721090939c2.zip |
fix: Remove 'counterCache' which was precluding from resetting the badge once the counts reached zero (#2113)
-rw-r--r-- | CONTRIBUTING.md | 2 | ||||
-rw-r--r-- | src/webview/badge.ts | 20 |
2 files changed, 2 insertions, 20 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4459c46f7..a7cd0df55 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md | |||
@@ -196,7 +196,7 @@ DEBUG=Ferdi:* npm run start | |||
196 | - Optionally, you can run both commands in one terminal with [concurrently](https://www.npmjs.com/package/concurrently): | 196 | - Optionally, you can run both commands in one terminal with [concurrently](https://www.npmjs.com/package/concurrently): |
197 | 197 | ||
198 | ```bash | 198 | ```bash |
199 | DEBUG=Ferdi:* npm run start:all-dev | 199 | DEBUG_COLORS=1 DEBUG=Ferdi:* npm run start:all-dev |
200 | ``` | 200 | ``` |
201 | 201 | ||
202 | Note: please prefer [`debug()`](https://github.com/visionmedia/debug) over `console.log()`. | 202 | Note: please prefer [`debug()`](https://github.com/visionmedia/debug) over `console.log()`. |
diff --git a/src/webview/badge.ts b/src/webview/badge.ts index fb696723d..02bd3fb15 100644 --- a/src/webview/badge.ts +++ b/src/webview/badge.ts | |||
@@ -3,15 +3,6 @@ import { ipcRenderer } from 'electron'; | |||
3 | const debug = require('debug')('Ferdi:Plugin:BadgeHandler'); | 3 | const debug = require('debug')('Ferdi:Plugin:BadgeHandler'); |
4 | 4 | ||
5 | export class BadgeHandler { | 5 | export class BadgeHandler { |
6 | countCache: { direct: number; indirect: number }; | ||
7 | |||
8 | constructor() { | ||
9 | this.countCache = { | ||
10 | direct: 0, | ||
11 | indirect: 0, | ||
12 | }; | ||
13 | } | ||
14 | |||
15 | // TODO: Need to extract this into a utility class and reuse outside of the recipes | 6 | // TODO: Need to extract this into a utility class and reuse outside of the recipes |
16 | safeParseInt(text: string | number | undefined | null) { | 7 | safeParseInt(text: string | number | undefined | null) { |
17 | if (text === undefined || text === null) { | 8 | if (text === undefined || text === null) { |
@@ -35,16 +26,7 @@ export class BadgeHandler { | |||
35 | indirect: this.safeParseInt(indirect), | 26 | indirect: this.safeParseInt(indirect), |
36 | }; | 27 | }; |
37 | 28 | ||
38 | if ( | 29 | debug('Sending badge count to host: %j', count); |
39 | this.countCache.direct.toString() === count.direct.toString() && | ||
40 | this.countCache.indirect.toString() === count.indirect.toString() | ||
41 | ) { | ||
42 | return; | ||
43 | } | ||
44 | |||
45 | debug('Sending badge count to host', count); | ||
46 | ipcRenderer.sendToHost('message-counts', count); | 30 | ipcRenderer.sendToHost('message-counts', count); |
47 | |||
48 | Object.assign(this.countCache, count); | ||
49 | } | 31 | } |
50 | } | 32 | } |