✨ Feature(notification): refactor notification and add notificationSound settings#1370
Merged
Molunerfinn merged 3 commits intodevfrom Jan 4, 2026
Merged
✨ Feature(notification): refactor notification and add notificationSound settings#1370Molunerfinn merged 3 commits intodevfrom
Molunerfinn merged 3 commits intodevfrom
Conversation
…und settings ISSUES CLOSED: #1229
There was a problem hiding this comment.
Pull request overview
This PR refactors the notification system and adds a notificationSound setting to control whether notification sounds are played. The main changes include converting the renderer-side notification handling to use RPC communication with the main process, adding support for notification callbacks, and updating all notification usages throughout the codebase.
Key Changes
- Added
notificationSoundboolean setting to control notification sound behavior (defaults to true) - Refactored notification system to use RPC pattern instead of direct Electron Notification API in renderer process
- Implemented notification callback mechanism to handle click events with automatic cleanup
Reviewed changes
Copilot reviewed 28 out of 33 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/universal/types/view.d.ts | Added notificationSound field to settings interface |
| src/universal/types/types.d.ts | Updated notification interfaces to replace icon with text and clickFn with callback |
| src/universal/types/rpc.d.ts | Added IShowNotificationArgs type for RPC notifications |
| src/universal/types/i18n.d.ts | Added i18n key for notification sound setting |
| src/universal/types/enum.ts | Added SHOW_NOTIFICATION RPC action type |
| src/universal/events/constants.ts | Added PICGO_NOTIFICATION_CLICKED event constant |
| src/renderer/utils/dataSender.ts | Converted saveConfig to async/await pattern using invoke |
| src/renderer/utils/common.ts | Refactored showNotification to use RPC with callback support and cleanup logic |
| src/renderer/pages/*.vue | Updated all notification calls to use new object-based API |
| src/main/utils/common.ts | Enhanced showNotification to support silent option based on settings |
| src/main/lifeCycle/index.ts | Updated notification list processing to use refactored function |
| src/main/events/rpc/routes/system.ts | Added RPC handler for notification with callback support |
| src/main/events/picgoCoreIPC.ts | Converted save config IPC to handle pattern |
| src/main/events/ipcList.ts | Updated notification calls to use unified function |
| src/main/apis/gui/index.ts | Updated notification calls to use refactored function |
| src/main/apis/app/uploader/*.ts | Updated notification calls to use refactored function |
| src/main/apis/app/system/index.ts | Updated notification calls to use refactored function |
| src/main/apis/app/remoteNotice/index.ts | Renamed clickFn to callback for consistency |
| public/i18n/*.yml | Added translation strings for notification sound setting |
| .gitignore | Added specs/ directory to ignore list |
Comments suppressed due to low confidence (1)
src/main/utils/common.ts:52
- The callback is always attached to the notification click handler, even when no callback is provided. This creates an unnecessary event listener that checks for a falsy callback on every notification click. Consider only attaching the click handler when a callback is actually provided by checking if
options.callbackoroptions.clickToCopyis truthy before callingnotification.once('click', handleClick).
const handleClick = () => {
if (options.clickToCopy) {
clipboard.writeText(options.copyContent || body)
}
if (options.callback) {
options.callback()
}
}
notification.once('click', handleClick)
notification.once('close', () => {
notification.removeListener('click', handleClick)
})
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ISSUES CLOSED: #1229