From 25da63a01e800c80c3fd1c82b1abea1cd93687cb Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Wed, 21 May 2025 14:03:24 +0800 Subject: [PATCH] chore: remove electron-notification-state dependency and update notification settings - Removed the electron-notification-state package from dependencies as it is no longer used. - Updated NotificationService to eliminate Do Not Disturb handling. - Changed default notification settings in the Redux store to false for assistant messages, backups, and knowledge embedding. --- package.json | 1 - src/main/services/NotificationService.ts | 4 -- src/renderer/src/store/settings.ts | 6 +-- yarn.lock | 69 ------------------------ 4 files changed, 3 insertions(+), 77 deletions(-) diff --git a/package.json b/package.json index c7f5831e38..23da4289a0 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,6 @@ "diff": "^7.0.0", "docx": "^9.0.2", "electron-log": "^5.1.5", - "electron-notification-state": "^1.0.4", "electron-store": "^8.2.0", "electron-updater": "6.6.4", "electron-window-state": "^5.0.3", diff --git a/src/main/services/NotificationService.ts b/src/main/services/NotificationService.ts index cde4d5204a..e06036b523 100644 --- a/src/main/services/NotificationService.ts +++ b/src/main/services/NotificationService.ts @@ -1,5 +1,4 @@ import { BrowserWindow, Notification as ElectronNotification } from 'electron' -import { getDoNotDisturb } from 'electron-notification-state' import { Notification } from 'src/renderer/src/types/notification' import icon from '../../../build/icon.png?asset' @@ -13,13 +12,10 @@ class NotificationService { } public async sendNotification(notification: Notification) { - const shouldSilent = getDoNotDisturb() ?? !!notification.silent - // 使用 Electron Notification API const electronNotification = new ElectronNotification({ title: notification.title, body: notification.message, - silent: shouldSilent, icon: icon }) diff --git a/src/renderer/src/store/settings.ts b/src/renderer/src/store/settings.ts index 11a0e19d33..cda007c7f8 100644 --- a/src/renderer/src/store/settings.ts +++ b/src/renderer/src/store/settings.ts @@ -293,9 +293,9 @@ export const initialState: SettingsState = { serviceTier: 'auto' }, notification: { - assistant: true, - backup: true, - knowledgeEmbed: true + assistant: false, + backup: false, + knowledgeEmbed: false } } diff --git a/yarn.lock b/yarn.lock index a80241ac83..a05e585083 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5807,7 +5807,6 @@ __metadata: electron-devtools-installer: "npm:^3.2.0" electron-icon-builder: "npm:^2.0.1" electron-log: "npm:^5.1.5" - electron-notification-state: "npm:^1.0.4" electron-store: "npm:^8.2.0" electron-updater: "npm:6.6.4" electron-vite: "npm:^3.1.0" @@ -6535,15 +6534,6 @@ __metadata: languageName: node linkType: hard -"bindings@npm:^1.3.0, bindings@npm:^1.5.0": - version: 1.5.0 - resolution: "bindings@npm:1.5.0" - dependencies: - file-uri-to-path: "npm:1.0.0" - checksum: 10c0/3dab2491b4bb24124252a91e656803eac24292473e56554e35bbfe3cc1875332cfa77600c3bac7564049dc95075bf6fcc63a4609920ff2d64d0fe405fcf0d4ba - languageName: node - linkType: hard - "birecord@npm:^0.1.1": version: 0.1.1 resolution: "birecord@npm:0.1.1" @@ -8855,17 +8845,6 @@ __metadata: languageName: node linkType: hard -"electron-notification-state@npm:^1.0.4": - version: 1.0.4 - resolution: "electron-notification-state@npm:1.0.4" - dependencies: - macos-notification-state: "npm:^1.1.0" - windows-notification-state: "npm:^1.3.0" - windows-quiet-hours: "npm:^1.2.2" - checksum: 10c0/040af9b2d6966ce962712e54fe325e5863cf895d41e78dd31caf3da5fa2708c851321ec5c4ce84f192c25c72050d7aaa8d443d2c057712fe02f93f86d8d865b4 - languageName: node - linkType: hard - "electron-publish@npm:26.0.13": version: 26.0.13 resolution: "electron-publish@npm:26.0.13" @@ -10190,13 +10169,6 @@ __metadata: languageName: node linkType: hard -"file-uri-to-path@npm:1.0.0": - version: 1.0.0 - resolution: "file-uri-to-path@npm:1.0.0" - checksum: 10c0/3b545e3a341d322d368e880e1c204ef55f1d45cdea65f7efc6c6ce9e0c4d22d802d5629320eb779d006fe59624ac17b0e848d83cc5af7cd101f206cb704f5519 - languageName: node - linkType: hard - "file-url@npm:^2.0.0": version: 2.0.2 resolution: "file-url@npm:2.0.2" @@ -12947,16 +12919,6 @@ __metadata: languageName: node linkType: hard -"macos-notification-state@npm:^1.1.0": - version: 1.3.6 - resolution: "macos-notification-state@npm:1.3.6" - dependencies: - bindings: "npm:^1.5.0" - node-gyp: "npm:latest" - checksum: 10c0/2b9c2d358e7e0d331506ef97a808c6e16b26de32c4240ba2c0aee2e826007e8aa393f3389883975aa68734a4bb38466662f084523710ce4688b728515161d7f9 - languageName: node - linkType: hard - "magic-string@npm:^0.30.17": version: 0.30.17 resolution: "magic-string@npm:0.30.17" @@ -14426,15 +14388,6 @@ __metadata: languageName: node linkType: hard -"nan@npm:^2.14.0, nan@npm:^2.7.0": - version: 2.22.2 - resolution: "nan@npm:2.22.2" - dependencies: - node-gyp: "npm:latest" - checksum: 10c0/971f963b8120631880fa47a389c71b00cadc1c1b00ef8f147782a3f4387d4fc8195d0695911272d57438c11562fb27b24c4ae5f8c05d5e4eeb4478ba51bb73c5 - languageName: node - linkType: hard - "nanoid@npm:^3.3.7, nanoid@npm:^3.3.8": version: 3.3.11 resolution: "nanoid@npm:3.3.11" @@ -19840,28 +19793,6 @@ __metadata: languageName: node linkType: hard -"windows-notification-state@npm:^1.3.0": - version: 1.3.4 - resolution: "windows-notification-state@npm:1.3.4" - dependencies: - bindings: "npm:^1.5.0" - nan: "npm:^2.14.0" - node-gyp: "npm:latest" - checksum: 10c0/d92e59acb21369204b5ff3d4633b216fe6c374f27eed5a62ad25b859b4201023a2903b64d1d11e8ded266da6109b6a68fb95753c75e873cc173dd80e91e75c5a - languageName: node - linkType: hard - -"windows-quiet-hours@npm:^1.2.2": - version: 1.2.7 - resolution: "windows-quiet-hours@npm:1.2.7" - dependencies: - bindings: "npm:^1.3.0" - nan: "npm:^2.7.0" - node-gyp: "npm:latest" - checksum: 10c0/1a1076f40f0a66ebe6cc39e7f52a199ae59f6e94e733e363a6e1e168c8b38435020404f66f35268174a11015104e8ee8265f2e190a664d7923a70822d327a887 - languageName: node - linkType: hard - "windows-system-proxy@npm:^1.0.0": version: 1.0.0 resolution: "windows-system-proxy@npm:1.0.0"