Skip to content

Native notifications support for macOS#55

Merged
Choochmeque merged 26 commits into
mainfrom
notification-macos
Dec 24, 2025
Merged

Native notifications support for macOS#55
Choochmeque merged 26 commits into
mainfrom
notification-macos

Conversation

@Choochmeque

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings December 23, 2025 22:23
@Choochmeque Choochmeque changed the title Native notifications for macOS Native notifications support for macOS Dec 23, 2025
@codecov-commenter

codecov-commenter commented Dec 23, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 55.64478% with 939 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.22%. Comparing base (472537e) to head (1b0b287).

Files with missing lines Patch % Lines
macos/Tests/PluginTests/MockFFI.swift 4.85% 333 Missing ⚠️
macos/Sources/NotificationPlugin.swift 10.43% 103 Missing ⚠️
macos/Sources/NotificationHandler.swift 24.34% 87 Missing ⚠️
src/commands.rs 0.00% 77 Missing ⚠️
src/listeners.rs 0.00% 70 Missing ⚠️
.../java/app/tauri/notification/NotificationPlugin.kt 0.00% 58 Missing ⚠️
src/desktop.rs 0.00% 54 Missing ⚠️
...c/main/java/app/tauri/notification/Notification.kt 23.07% 40 Missing ⚠️
macos/Sources/NotificationCategory.swift 61.66% 23 Missing ⚠️
macos/Sources/Notification.swift 86.42% 19 Missing ⚠️
... and 9 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #55      +/-   ##
============================================
- Coverage     60.33%   58.22%   -2.12%     
- Complexity       64       65       +1     
============================================
  Files            21       29       +8     
  Lines          2975     5065    +2090     
  Branches        218      235      +17     
============================================
+ Hits           1795     2949    +1154     
- Misses         1148     2082     +934     
- Partials         32       34       +2     
Flag Coverage Δ
android 28.74% <27.16%> (-0.11%) ⬇️
ios 77.69% <89.36%> (+1.00%) ⬆️
javascript 100.00% <100.00%> (ø)
macos 64.70% <64.70%> (?)
rust 47.96% <0.00%> (-19.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements native notifications for macOS using Swift and the UserNotifications framework. The implementation adds a macOS-specific backend that can be toggled with the notify-rust feature flag, refactors several APIs to async, and improves cross-platform consistency.

Key changes:

  • New macOS native implementation using Swift/FFI bridge for UserNotifications framework
  • Refactored permission and notification APIs to async across mobile and desktop platforms
  • Added listener management system for desktop platforms
  • Fixed Android notification storage and click handling issues

Reviewed changes

Copilot reviewed 42 out of 44 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/macos.rs New macOS implementation with Swift FFI bridge and validation
src/listeners.rs Desktop listener management replicating mobile plugin functionality
src/models.rs Added PermissionResponse/PushNotificationResponse models and Serialize derives
src/mobile.rs Converted APIs to async using run_mobile_plugin_async
src/lib.rs Integrated macOS module with conditional compilation
src/commands.rs Updated commands to call async APIs and added new commands
src/desktop.rs Added stub implementations for new notification APIs
src/error.rs Added desktop equivalents of mobile PluginInvokeError types
build.rs Added Swift compilation and FFI bridge generation for macOS
macos/Sources/*.swift Swift implementation for macOS notifications, handlers, categories
macos/Tests/*.swift Test files (contain wrong plugin references - IAP instead of notifications)
macos/Package.swift Swift package configuration for macOS
ios/Sources/*.swift Minor iOS improvements (Codable conformance, indentation fixes)
android/*.kt Improved logging, notification storage, and click handling
guest-js/index.ts Fixed command names for cancel_all and list_channels
Cargo.toml Added swift-bridge dependency and notify-rust as optional feature
permissions/* Added permissions for new commands (cancel_all, remove_listener)
examples/* Updated demo with better error handling and macOS support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread macos/Package.swift
Comment thread src/listeners.rs Outdated
Comment thread src/listeners.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread examples/notifications-demo/src-tauri/build.rs Outdated
Comment thread macos/Tests/PluginTests/PluginTests.swift Outdated
Comment thread macos/Tests/PluginTests/MockFFI.swift Outdated
Comment thread macos/Tests/PluginTests/PluginTests.swift
@Choochmeque
Choochmeque marked this pull request as draft December 23, 2025 22:31
Copilot AI review requested due to automatic review settings December 23, 2025 23:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 43 out of 45 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (1)

src/listeners.rs:1

  • The documentation incorrectly references 'transaction updates and other IAP events' which appears to be copied from an in-app purchase plugin. This should describe notification events instead.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

let notifications: [RemoveActiveNotification]
}

extension RustString {

Copilot AI Dec 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The decode extension method lacks documentation. Consider adding a doc comment explaining its purpose and the FFIResult error type.

Suggested change
extension RustString {
extension RustString {
/// Decodes this `RustString`, interpreted as a UTF-8 JSON string, into the specified `Decodable` type.
///
/// - Parameter type: The `Decodable` type to decode from the JSON representation.
/// - Throws: An `FFIResult.Err` if the string cannot be converted from UTF-8 data or if JSON decoding fails.

Copilot uses AI. Check for mistakes.
Comment thread android/src/main/java/app/tauri/notification/NotificationStorage.kt
Comment on lines +182 to +185
for (key in extras.keySet()) {
// Skip Android/Firebase internal keys
if (key.startsWith("android.") || key.startsWith("google.") ||
key.startsWith("gcm.") || key == "from" || key == "collapse_key") continue

Copilot AI Dec 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded list of internal keys to filter could be extracted to a constant set for better maintainability and reusability.

Copilot uses AI. Check for mistakes.
Comment thread examples/notifications-demo/src-tauri/build.rs Outdated
Comment thread android/src/main/java/app/tauri/notification/NotificationStorage.kt
Comment thread macos/Sources/bridging-header.h
Repository owner deleted a comment from Copilot AI Dec 23, 2025
Copilot AI review requested due to automatic review settings December 24, 2025 13:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 44 out of 46 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (2)

src/models.rs:1

  • The ActionType struct has fields with similar naming patterns that should use consistent field ordering. Consider grouping related boolean flags together (e.g., all hidden_previews_* fields) for better code organization and readability.
    src/mobile.rs:1
  • The method name is cancel_all (snake_case in Rust) but calls cancelAll (camelCase). While this is correct for the mobile plugin interface, consider adding a comment explaining this intentional naming convention difference between Rust and the mobile plugin API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread macos/Sources/NotificationPlugin.swift
Comment thread android/src/main/java/app/tauri/notification/NotificationStorage.kt Outdated
Copilot AI review requested due to automatic review settings December 24, 2025 14:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 48 out of 50 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings December 24, 2025 15:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 49 out of 51 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Choochmeque
Choochmeque marked this pull request as ready for review December 24, 2025 17:28
@Choochmeque
Choochmeque merged commit 6960d95 into main Dec 24, 2025
30 of 34 checks passed
@Choochmeque
Choochmeque deleted the notification-macos branch December 24, 2025 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants