diff --git a/app/browser/index.js b/app/browser/index.js index bde0b884..757de85f 100644 --- a/app/browser/index.js +++ b/app/browser/index.js @@ -58,7 +58,7 @@ function initializeModules(config, ipcRenderer) { require('./tools/shortcuts').init(config); require('./tools/chromeApi')(config); require('./tools/mutationTitle').init(config); - // require('./tools/trayIconRenderer').init(config, ipcRenderer); + require('./tools/trayIconRenderer').init(config, ipcRenderer); require('./tools/settings').init(config, ipcRenderer); require('./tools/customBackgrounds')(config, ipcRenderer); require('./tools/theme').init(config, ipcRenderer); diff --git a/app/browser/notifications/activityManager.js b/app/browser/notifications/activityManager.js index 1af18fe8..8f829580 100644 --- a/app/browser/notifications/activityManager.js +++ b/app/browser/notifications/activityManager.js @@ -1,4 +1,3 @@ -const TrayIconRenderer = require('../tools/trayIconRenderer'); const activityHub = require('../tools/activityHub'); const wakeLock = require('../tools/wakeLock'); @@ -9,21 +8,10 @@ class ActivityManager { */ constructor(ipcRenderer, config) { this.ipcRenderer = ipcRenderer; - this.iconRenderer = new TrayIconRenderer().init(config); this.config = config; this.myStatus = -1; } - updateActivityCount(count) { - this.iconRenderer.render(count).then(icon => { - this.ipcRenderer.send('tray-update', { - icon: icon, - flash: (count > 0 && !this.config.disableNotificationWindowFlash) - }); - }); - this.ipcRenderer.invoke('set-badge-count', count); - } - start() { setActivityHandlers(this); setEventHandlers(this); @@ -79,9 +67,8 @@ function setEventHandlers(self) { */ function updateActivityCountHandler() { return async (data) => { - // const event = new CustomEvent('unread-count', { detail: { number: data.count } }); - // window.dispatchEvent(event); - self.updateActivityCount(data.count); + const event = new CustomEvent('unread-count', { detail: { number: data.count } }); + window.dispatchEvent(event); }; } diff --git a/app/browser/tools/trayIconRenderer.js b/app/browser/tools/trayIconRenderer.js index 37617dbb..085bfaba 100644 --- a/app/browser/tools/trayIconRenderer.js +++ b/app/browser/tools/trayIconRenderer.js @@ -1,25 +1,25 @@ const { nativeImage } = require('electron'); const TrayIconChooser = require('./trayIconChooser'); class TrayIconRenderer { - constructor(config) { - // init(config, ipcRenderer) { - // this.ipcRenderer = ipcRenderer; + init(config, ipcRenderer) { + this.ipcRenderer = ipcRenderer; + this.config = config; const iconChooser = new TrayIconChooser(config); this.baseIcon = nativeImage.createFromPath(iconChooser.getFile()); this.iconSize = this.baseIcon.getSize(); - // window.addEventListener('unread-count', this.updateActivityCount.bind(this)); - // } + window.addEventListener('unread-count', this.updateActivityCount.bind(this)); + } - // updateActivityCount(event) { - // const count = event.detail.number; - // this.render(count).then(icon => { - // console.log('sending tray-update'); - // this.ipcRenderer.send('tray-update', { - // icon: icon, - // flash: (count > 0 && !this.config.disableNotificationWindowFlash) - // }); - // }); - // this.ipcRenderer.invoke('set-badge-count', count); + updateActivityCount(event) { + const count = event.detail.number; + this.render(count).then(icon => { + console.log('sending tray-update'); + this.ipcRenderer.send('tray-update', { + icon: icon, + flash: (count > 0 && !this.config.disableNotificationWindowFlash) + }); + }); + this.ipcRenderer.invoke('set-badge-count', count); } render(newActivityCount) { diff --git a/package.json b/package.json index 5e65a4b5..95800a1f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "teams-for-linux", - "version": "1.4.18", + "version": "1.4.19", "main": "app/index.js", "description": "Unofficial client for Microsoft Teams for Linux", "homepage": "https://github.com/IsmaelMartinez/teams-for-linux",