feat: add restoreWindow option for incoming call notifications
Ā
FA
2d ago+80+80+01234567890123456789-0-0-0123456789
Proposed changes
Adds an opt-in restoreWindow flag for incoming call notifications (notificationType: 'voice'). When it is set, the main process restores (if minimized), shows and focuses the root window, including when it is hidden in the tray. Default behavior is unchanged.
Why: incoming voice calls are easy to miss while the app is minimized or in the tray ā the OS toast alone often goes unnoticed. This lets the web client ask for the window to come back for incoming calls.
The web client side (setting the flag for incoming calls) is in RocketChat/Rocket.Chat#42146.
Changes
restoreWindow?: booleanadded toExtendedNotificationOptionsandCustomNotificationOptions, and forwarded bydispatchCustomNotificationin the preloadhandleCreateEventrestores the root window only fornotificationType: 'voice'notifications withrestoreWindow: true; text notifications and notifications without the flag ignore it- Uses the existing
focusSecondaryWindowhelper (restore if minimized, then show and focus), so a window hidden in the tray comes back too - Runs only when a notification is created, after the tag check, so an update with the same tag does not focus the window again
- Not awaited: the toast is not delayed by the 300 ms
getRootWindow()lookup; failures are only logged
Testing
jest src/notifications: 7 suites, 44 tests pass (the two restore tests fail againstdev's code, as expected)tsc --noEmitpasses; ESLint clean on the changed files
š¤ Generated with Claude Code
Summary by CodeRabbit
- New Features
- Incoming voice notifications can request that the app window be restored, shown, and focused. Custom notifications can pass this setting through their options.
- Tests
- Added coverage for minimized and already visible windows, repeated restoration requests, and cases where window restoration is not requested.