Repository navigation
Backlog
Backlog
Pending-request notifications on macOS: Notification Center removal and click opens the request#1711
Feature
Copy link
Labels
Milestone
Description
Goal
On macOS, a pending-request notification disappears from Notification Center once its request is answered or the user returns to the app. Clicking it brings the app to the front and opens the tab of the request.
Context
- Pending requests: native notification and Dock/taskbar attention while the app is in the background #1709 added:
- the
PendingRequestNotifiertrait; - the desktop implementation and the OS notification backend boundary in
crates/app-shell(show by id, remove by id, remove all); activate_pending_request(id).
- the
- It also added Dock bouncing (
request_user_attention(Critical)). tauri-plugin-notificationuses the deprecatedNSUserNotificationAPI on macOS (viamac-notification-sys). It can neither remove delivered notifications nor report clicks.
Requirements
- macOS backend on
UNUserNotificationCenter(e.g.objc2-user-notifications):- Request authorization on the first pending request. Denied authorization is logged once.
- The notification identifier is derived from the request id.
- Remove uses
removeDeliveredNotificationsWithIdentifiers:(and pending ones). - Remove all removes every pending-request identifier.
- Delegate:
didReceiveNotificationResponsecallsactivate_pending_request(id).willPresentNotificationshows nothing while the app is in the foreground, which matches the "background only" rule.
- Plugs into the boundary from Pending requests: native notification and Dock/taskbar attention while the app is in the background #1709, with no change to the trait or callers.
- Removes a request's notification when it ends, and all pending-request notifications when the main window gets focus.
- Unbundled builds (
cargo run/dev without a bundle identifier) cannot useUNUserNotificationCenter. They fall back to the plugin backend and log once. - No approve/deny actions in the notification.
Acceptance Criteria
- On a bundled macOS build, a pending-request notification is removed from Notification Center when its request ends (approved, denied, timeout, tab closed) and when the main window gets focus.
- Clicking the notification activates the app and switches to the tab of the request.
- The Dock icon bounces until the app is activated (behaviour from Pending requests: native notification and Dock/taskbar attention while the app is in the background #1709 still works with the new backend).
- With notification authorization denied, the app logs once without content, keeps bouncing the Dock icon (if that setting is on), and the request flow is unchanged.
- An unbundled build falls back to the plugin backend without crashing.
- Unit tests for the identifier mapping and the remove logic with a fake backend. The macOS module compiles in the macOS CI job.
- Relevant automated tests pass.
Technical Notes
- Real Notification Center behaviour needs a bundled, signed app on a real Mac. The reviewer lists manual test steps.
- Delegate callbacks arrive on the main thread. Hand the id to the async runtime and do not block.
- No content in logs (Spec 0094).
Files: crates/app-shell/src/ (pending_request_notifications backend module for macos), crates/app-shell/Cargo.toml, Cargo.lock, docs/specs/ (pending-request notification spec)
Spec impact: update the pending-request notification spec created by #1709 (macOS behaviour)
Open questions
- Binding crate:
objc2-user-notifications(recommended, matches theobjc2stack Tauri already uses) or hand-writtenobjc2messages.
Related Work
- Pending-request notifications on Windows and Linux: remove when handled, click opens the request #1710 (Windows and Linux backends, same boundary)
- Pending requests: native notification and Dock/taskbar attention while the app is in the background #1709 (shared mechanism), epic Notify on pending requests #1708
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
P2 - Normal
Activity