fix(notifications): switch to UNUserNotificationCenter so banners pop#23
Merged
Conversation
tauri-plugin-notification → notify-rust → mac-notification-sys all call
NSUserNotificationCenter, deprecated since macOS 10.14. On Sequoia (and
progressively on earlier modern macOS) the deprecated API still delivers
notifications to Notification Center but no longer pops a banner —
Apple's slow-roll deprecation. Other native apps (Mail, Slack, Things,
Linear) all use UNUserNotificationCenter; ours was the odd one out.
This swaps the macOS notification path to UNUserNotificationCenter via
the objc2-user-notifications crate. No upstream plugin migration is
needed; we drive UN ourselves.
src-tauri/Cargo.toml + objc2 / objc2-foundation /
objc2-user-notifications / block2
- tauri-plugin-notification
src-tauri/src/
native_notifications.rs new: thin wrapper over UN — request auth,
query state, send. Uses block2
RcBlock for completion handlers,
mpsc::channel to make the async
callbacks block the (Tauri-worker)
calling thread.
lib.rs + three #[tauri::command]s:
notify_request_permission
notify_permission_state
notify_send
- tauri_plugin_notification::init()
src-tauri/capabilities/ - notification:default (plugin gone)
src/renderer/services/
notifications.ts rewritten: same public surface
(initNotifications / notifyNewEmails /
testNotification), now calls our
commands via @tauri-apps/api/core's
invoke() instead of the plugin.
components/SetupWizard.tsx, use the new state words ("authorized" /
components/SettingsPanel.tsx "provisional" / "denied" / "not_
determined" / "ephemeral") that UN
returns instead of the plugin's
"granted"/"denied"/"default" subset.
package.json - @tauri-apps/plugin-notification
Deferred (follow-up):
- UNUserNotificationCenterDelegate for willPresent (so foreground
notifications pop a banner instead of going silently to NC) and
didReceiveResponse (so clicks route to a specific thread). The
delegate needs a custom Objective-C class registered at startup —
larger change than the v1 fix. Without it, background banners pop
(the user's actual complaint), foreground notifications go to NC
silently, clicks just bring the app forward.
- Rich content (subtitle, attachments, threadIdentifier, sound).
- Cross-platform path. AOS Mail is macOS-only today; the new
commands no-op on other platforms.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Owner
Author
|
Roll back checkpoint 1 |
4 tasks
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.
What
Swap the macOS notification path off
tauri-plugin-notificationand onto our own Rust commands that talk toUNUserNotificationCenterdirectly.Why
tauri-plugin-notification→notify-rust→mac-notification-sysstill callNSUserNotificationCenter, which Apple deprecated in macOS 10.14. On Sequoia (and progressively on earlier modern macOS) the deprecated API delivers notifications to Notification Center but no longer pops a banner — Apple's slow-roll deprecation behavior. Every native Mac app a user can name (Mail, Slack, Things, Linear, Spark…) usesUNUserNotificationCenter; ours was the odd one out.The user-visible symptom: notifications fire, show up in Notification Center on the top right, but never pop as a banner — even with System Settings → Notifications → AOS Mail set to Alert Style: Temporary, "Allow notifications" on, Desktop ✓.
No upstream plugin migration is needed for us to fix this — we drive UN ourselves.
How
The Rust side bridges UN's Objective-C completion handlers via
block2::RcBlockand astd::sync::mpsc::channelso each#[tauri::command]looks like a normal synchronous call from JS (Tauri runs sync commands on a worker thread, so the blockingrx.recv()doesn't stall anything).Deferred to a follow-up
UNUserNotificationCenterDelegate— needs a custom Objective-C class registered at startup so we can implementwillPresentNotification:(foreground banners) anddidReceiveNotificationResponse:(route clicks to a specific thread). Without it, background banners pop — which is the user's actual complaint here — but foreground notifications go silently to Notification Center, and clicks just bring the app forward instead of jumping to the email.Verification plan
I can't fully test banners from the dev machine (UN refuses to deliver from unsigned dev builds). Verification happens on the v0.1.10 release:
If banners still don't pop after this lands, the next thing to check is whether UN is granting permission at all (we should see
notify_permission_statereturn"authorized"); failure modes from here are narrow and easy to chase.Test plan
🤖 Generated with Claude Code