static PushNotifications & instance()
virtual NotificationAuthorization current_authorization() const =0
Synchronous query for the current authorization state.
PushNotifications(const PushNotifications &)=delete
virtual ~PushNotifications()=default
virtual uint64_t post_local_notification(const LocalNotification ¬ification)=0
Post a notification.
virtual void set_handler(NotificationHandler handler)=0
Register a callback that fires when the user activates a posted notification.
virtual void request_authorization(AuthorizationCallback callback)=0
Ask the OS for permission to post notifications.
virtual void cancel_all()=0
Cancel every notification this process has posted.
PushNotifications()=default
virtual bool cancel_notification(const std::string &id)=0
Cancel a previously-posted notification by id (no-op if already dismissed).
virtual std::string backend_id() const =0
Short identifier of the active backend ("user-notifications", "libnotify", "winrt-toast-scaffold",...
PushNotifications & operator=(const PushNotifications &)=delete
virtual bool is_available() const =0
Returns true when a real notification backend is wired up on this build.
Definition child_process_manager.hpp:18
NotificationAuthorization
Outcome of request_authorization().
Definition push_notifications.hpp:38
@ Denied
The user (or policy) declined.
Definition push_notifications.hpp:40
@ NotDetermined
The OS has never been asked.
Definition push_notifications.hpp:39
@ Granted
The app may post notifications.
Definition push_notifications.hpp:41
@ Unsupported
This platform has no bounded pump implementation.
Definition message_loop_integration.hpp:74
std::function< void(NotificationAuthorization)> AuthorizationCallback
Definition push_notifications.hpp:60
std::function< void(const NotificationActivation &)> NotificationHandler
Definition push_notifications.hpp:61
Posted notification descriptor.
Definition push_notifications.hpp:46
std::string body
Optional secondary message.
Definition push_notifications.hpp:48
std::string title
Bold first line.
Definition push_notifications.hpp:47
std::string category
Optional grouping / action category id.
Definition push_notifications.hpp:49
std::string id
Optional caller-supplied id; auto-assigned when empty.
Definition push_notifications.hpp:50
Delivered to set_handler() when the user activates a notification.
Definition push_notifications.hpp:54
std::string id
Matches LocalNotification::id.
Definition push_notifications.hpp:55
std::string action_id
Empty for default activation.
Definition push_notifications.hpp:57
std::string category
Matches LocalNotification::category.
Definition push_notifications.hpp:56