Skip to content

Add ability to respond to notifications on macOS

Implement the UNTextInputNotificationAction and UNNotificationCategory stuff so that messages can actually be sent from the notification banner.

This requires adding a UNUserNotificationCenterDelegate object to respond to notification actions. This needs to be registered when the app launches (rather than when we receive a notification), so I have updated main.cpp to incorporate this. If there's a better way... let me know.

I also now properly check for permission access before trying to send a notification. I'm pretty sure it ends up as a no-op if you don't have permission, rather than a hard error, but I'd rather not waste cycles constructing a notification that will never see the light of day if it's not necessary!

See: https://developer.apple.com/documentation/usernotifications/declaring_your_actionable_notification_types?language=objc

Edited by Joe Donofry

Merge request reports

Loading