Repository navigation
feat: native macOS notifications that update in place, withdraw, and open the right page - #44
Merged
Merged
Conversation
…open the right page The plugin used until now can only fire and forget on the desktop: no update by id, no withdrawal, no click callback. The bus needs all three — the same thing is said once and then only its count moves, a recovery withdraws what was said, and a click lands on the page that can fix it. src-tauri/src/notices/macos/ now talks to UNUserNotificationCenter: - un.rs holds the Objective-C calls and nothing else: authorisation, post or replace by identifier, a passive interruption level for count updates so they replace quietly, withdrawal, and a delegate that shows nothing but the list while the app is in front and reports clicks. It depends on neither Tauri nor the bus, so it was verified on a real machine by a small separate app that includes the file as-is under another bundle id — the shipping app shares its bundle id and data directory with the copy the user runs, and two of them at once interfere. - Authorisation is asked for when the first interrupting notice is about to be shown, not at launch, so the prompt arrives with a reason. - A click brings the window back (recreating it if the menu-bar app had none) and lands on the notice's page; a window created for the click collects the page when it mounts. What the machine test established on 2026-09-18: an app signed without a team identifier does get authorisation, notifications show with no window open, the same identifier replaces, removal withdraws and clicks arrive — but only for an app installed and registered in a normal location; one launched from a temporary directory is refused outright, without a prompt. tauri dev runs outside an app bundle, where asking for the notification centre throws, so the plugin remains the fallback there. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Merged
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.
Summary
The notification bus (#41, #42) needs three things from the system that
tauri-plugin-notificationcannot do on the desktop:src-tauri/src/notices/macos/now talks toUNUserNotificationCenterdirectly.How it behaves
tauri devVerified on a real machine
The shipping app shares its bundle id and
~/.thinkwatchwith the copy already running, and running two at once interferes. So the verification did not use it:un.rsholds only the Objective-C calls and depends on neither Tauri nor the bus.~/Applications, and was run. The user clicked Allow and then clicked the notification.The test and an earlier Swift spike established:
Test plan
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test(94)pnpm typecheck,pnpm build,pnpm testun.rsas above🤖 Generated with Claude Code