feat: add preview unusernotifcations backend#280
Merged
Merged
Conversation
6f38161 to
1eca658
Compare
0fb4c3d to
46de6e7
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces an opt-in macOS notification backend based on UNUserNotificationCenter (preview-macos-un) and adds shared, cross-platform response types so consumers can handle notification outcomes without backend-specific cfg branching.
Changes:
- Added
preview-macos-unbackend for macOS (async + blocking send, typed responses incl. inline reply support). - Introduced cross-platform response/close types (
NotificationResponse,CloseReason, etc.) and adapted XDG backends to emit them. - Updated docs, examples, CI (macOS matrix), and added a helper script for running bundled macOS examples.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| src/xdg/zbus_rs.rs | Switches zbus XDG backend from legacy action responses to NotificationResponse. |
| src/xdg/mod.rs | Adapts XDG handle APIs to new response types and adds wait_for_response. |
| src/xdg/dbus_rs.rs | Switches dbus XDG backend from legacy action responses to NotificationResponse. |
| src/response.rs | Adds shared response/close types and callback traits. |
| src/notification.rs | Adds macOS preview fields/APIs (InterruptionLevel, new id type, show_async). |
| src/notification_id.rs | Adds cross-platform NotificationId abstraction. |
| src/macos/usernotifications.rs | New UNUserNotificationCenter preview backend implementation + response handling. |
| src/macos/nsusernotification.rs | Moves legacy NSUserNotificationCenter implementation into dedicated module. |
| src/macos/mod.rs | Selects legacy vs preview macOS backend based on preview-macos-un feature. |
| src/macos.rs | Removes old single-file macOS backend (replaced by src/macos/ module). |
| src/lib.rs | Documents preview backend, exports new types/APIs, adjusts macOS exports by feature. |
| src/interruption_level.rs | Adds (currently unused) InterruptionLevel type wrapper/placeholder. |
| src/error.rs | Adds macOS preview error integration and conditional macOS error exports. |
| run_bundled_example.sh | Adds helper script to bundle/sign/run macOS examples and stream logs. |
| examples/on_close.rs | Updates example gating and uses shared CloseReason type. |
| examples/mac.rs | Updates macOS example setup for preview backend vs legacy path. |
| examples/mac_usernotifications.rs | New preview-backend example demonstrating typed responses. |
| examples/mac_usernotifications_async.rs | New async preview-backend example using block_on_main. |
| examples/mac_app_id.rs | Gates legacy macOS app-id example; adds preview-backend message. |
| examples/interruption_level.rs | New example demonstrating interruption level usage. |
| examples/image_path.rs | Updates macOS setup for preview backend vs legacy path. |
| examples/common/mod.rs | Adds shared example setup utilities (logging/auth/key-wait). |
| examples/at_bus.rs | Makes env_logger init non-fatal (try_init). |
| examples/actions.rs | Updates action example to work on XDG + macOS preview backend. |
| Cargo.toml | Adds preview-macos-un feature + deps, new example metadata, bundle metadata. |
| .github/workflows/build-platforms.yml | Expands macOS CI to run with and without preview-macos-un. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fcbb0d8 to
fecb847
Compare
41f3ece to
e4516ea
Compare
This finally enables features provided by UNUserNotificationCenter, such as interruption levels (Active, Passive, TimeSensitive, Critical), async/await support, and proper permission handling via `request_auth_blocking`. The new backend is gated behind the `preview-macos-un` feature flag and wraps the `mac-usernotifications` crate. The existing `NSUserNotification` path is preserved as the default. Also adds: - `InterruptionLevel` type and `.urgency()` builder method - `NotificationId` type for cross-platform handle unification - `examples/common/mod.rs` for shared bundle/auth setup - New examples: `mac_usernotifications`, `mac_usernotifications_async`, `interruption_level` - CI matrix extended to test with and without `preview-macos-un`
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.
No description provided.