Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use the new NotificationFramework for pushing notifications #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nicholaswmin
Copy link

Fixes #52

Replace NSUserNotification API with UserNotifications.frameworks API.

  • Import UserNotifications/UserNotifications.h in alerter/AppDelegate.h and alerter/AppDelegate.m.
  • Conform to UNUserNotificationCenterDelegate instead of NSUserNotificationCenterDelegate in alerter/AppDelegate.h.
  • Replace NSUserNotification with UNNotificationRequest for creating notifications in alerter/AppDelegate.m.
  • Replace NSUserNotificationCenter delegate methods with UNUserNotificationCenter delegate methods in alerter/AppDelegate.m.
  • Update methods to use UNUserNotificationCenter for managing notifications in alerter/AppDelegate.m.
  • Remove references to NSUserNotification in alerter/main.m.

Fixes vjeantet#52

Replace `NSUserNotification` API with `UserNotifications.frameworks` API.

* Import `UserNotifications/UserNotifications.h` in `alerter/AppDelegate.h` and `alerter/AppDelegate.m`.
* Conform to `UNUserNotificationCenterDelegate` instead of `NSUserNotificationCenterDelegate` in `alerter/AppDelegate.h`.
* Replace `NSUserNotification` with `UNNotificationRequest` for creating notifications in `alerter/AppDelegate.m`.
* Replace `NSUserNotificationCenter` delegate methods with `UNUserNotificationCenter` delegate methods in `alerter/AppDelegate.m`.
* Update methods to use `UNUserNotificationCenter` for managing notifications in `alerter/AppDelegate.m`.
* Remove references to `NSUserNotification` in `alerter/main.m`.
@Tobbe
Copy link

Tobbe commented Mar 14, 2025

What's the status of this PR? Is it ready to be merged? If I pull this down, can I build it and use it with the new MacOS notification API? What about code signing? Is that something I need to read up on? I've never have to deal with that before.

@nicholaswmin
Copy link
Author

@Tobbe Hi Tobbe; sorry for the late reply - should be good. No code-signing.
But should be buildable, have you tried doing so?

@Tobbe
Copy link

Tobbe commented Mar 18, 2025

No worries at all about the reply. Thanks for getting back to me 🙏
I haven't tried building yet, but next time I have time for the side-project I need this for I'll give it a go.
About code signing – it was more about being able/allowed to show the alerts. Maybe it was specifically for having a custom icon? But don't worry about it. I'll just try it and see what happens :D

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.

Use the new Apple Notification Framework
2 participants