diff --git a/source/browser/conversation-list.ts b/source/browser/conversation-list.ts index 1aaed22..adc42a8 100644 --- a/source/browser/conversation-list.ts +++ b/source/browser/conversation-list.ts @@ -1,6 +1,7 @@ import {ipcRenderer as ipc} from 'electron-better-ipc'; import elementReady from 'element-ready'; import selectors from './selectors'; +import config from '../config'; const icon = { read: 'data-caprine-icon', @@ -257,6 +258,11 @@ export async function sendConversationList(): Promise { const knownUnreadMessages = new Map(); function countUnread(mutationsList: MutationRecord[]): void { + // Check if notifications are muted + if (config.get('notificationsMuted')) { + return; + } + const processedHrefs = new Set(); for (const mutation of mutationsList) { diff --git a/source/menu.ts b/source/menu.ts index aa6f59c..1b28afe 100644 --- a/source/menu.ts +++ b/source/menu.ts @@ -282,12 +282,8 @@ Press Command/Ctrl+R in Caprine to see your changes. }, }, { - // TODO: Fix notifications. - // ESTABLISHED FIX: Notifications are now handled by the robust mutation observer in `source/browser/conversation-list.ts`. - // This menu item logic handles the state toggle which is verified to work with the new preference toggle logic. label: 'Show Notifications', type: 'checkbox', - visible: is.development, checked: !config.get('notificationsMuted'), click(menuItem) { config.set('notificationsMuted', !menuItem.checked); @@ -417,7 +413,8 @@ Press Command/Ctrl+R in Caprine to see your changes. dialog.showMessageBox({ type: 'info', message: 'Press the Alt key to toggle the menu bar.', - buttons: ['OK'], + buttons: [ + 'OK'], }); } },