fix(desktop): enable Windows-native winrt/toast notifications and make them reliable - #7614
Open
bernhardkaindl wants to merge 4 commits into
Open
Conversation
The show_native_notification command only handled Linux and macOS. On Windows it returned an error, forcing the frontend to fall through to window.Notification (WebKit API). WebView2's Notification.permission reports 'denied' even when the WinRT toast API is available, so the app never appeared in Windows Settings > System > Notifications and the settings toggle was stuck showing 'Desktop notifications are blocked.' - Add tauri-winrt-notification as a Windows-specific dependency - Add a windows module in notifications.rs that posts WinRT toasts using the app's Tauri identifier as AppUserModelID (this is what registers the app with Windows notification settings) - Handle click actions through WinRT Activated handler, forwarding to the same native-notification-activated event that Linux uses - Add isWindowsPlatform() helper to platform.ts - Skip WebView2 Notification.permission check on Windows in getDesktopNotificationPermissionState() — use the Tauri plugin's isPermissionGranted() which queries native WinRT status - Route Windows through the native show_native_notification path in sendDesktopNotification() - Skip the Tauri plugin's onAction listener on Windows (click actions come through the native WinRT event instead) Fixes block#6377 Signed-off-by: Fatima Nur <fatimanur424@example.com>
Problem ------- Windows notification delivery and activation had three related gaps: - permission repair could still be in flight when the first notification was sent, - clicking a normal message notification could open an empty reply branch, - broad live channel subscriptions updated only the projected message cache, so an active channel could miss the message until reload. Solution -------- - Await and confirm desktop notification permission before feed, DM, and dedicated thread-reply delivery. - Carry explicit timeline-versus-thread intent in notification targets and channel routes. - Merge visible live channel messages into the authoritative channel window store before projection. - Add focused regression coverage for permission sequencing, activation routing, notify-while-viewing, and live window projection. Signed-off-by: Bernhard Kaindl <bernhardkaindl7@gmail.com>
🔐 Codex Security Review
|
Signed-off-by: Bernhard Kaindl <bernhardkaindl7@gmail.com>
Signed-off-by: Bernhard Kaindl <bernhardkaindl7@gmail.com>
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.
fix(desktop): enable Windows-native winrt notifications and make them reliable
This PR combines @fatima-n09's PR
Tested on Windows 11: When clicking the notification, the correct message, and if in a thread/branch, the message in the thread opens, and is highlighted as having just arrived.
Fixes
Obsoletes
Related to
Problems
Solution