aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/badge.ts
diff options
context:
space:
mode:
authorLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2021-10-23 04:31:50 +0530
committerLibravatar GitHub <noreply@github.com>2021-10-23 04:31:50 +0530
commitc5af7f0d0ca6fb2e111389bc3a997721090939c2 (patch)
tree4dc5d04d192598c01ba4a83eab3770a33dacff1d /src/webview/badge.ts
parentfix: correct the import of API_VERSION (#2112) (diff)
downloadferdium-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)
Diffstat (limited to 'src/webview/badge.ts')
-rw-r--r--src/webview/badge.ts20
1 files changed, 1 insertions, 19 deletions
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';
3const debug = require('debug')('Ferdi:Plugin:BadgeHandler'); 3const debug = require('debug')('Ferdi:Plugin:BadgeHandler');
4 4
5export class BadgeHandler { 5export 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}