Cross-platform local notification surface.
More...
#include <push_notifications.hpp>
Cross-platform local notification surface.
Use the singleton via PushNotifications::instance(). The implementation is thread-safe: any thread may call post_local_notification, but the NotificationHandler is delivered on a platform-defined dispatch thread — callers must hop back to their own UI thread if the handler touches view state.
◆ ~PushNotifications()
| virtual pulp::events::PushNotifications::~PushNotifications |
( |
| ) |
|
|
virtualdefault |
◆ PushNotifications() [1/2]
| pulp::events::PushNotifications::PushNotifications |
( |
| ) |
|
|
protecteddefault |
◆ PushNotifications() [2/2]
| pulp::events::PushNotifications::PushNotifications |
( |
const PushNotifications & | | ) |
|
|
protecteddelete |
◆ backend_id()
| virtual std::string pulp::events::PushNotifications::backend_id |
( |
| ) |
const |
|
pure virtual |
Short identifier of the active backend ("user-notifications", "libnotify", "winrt-toast-scaffold", or "none").
Useful for diagnostics and host reports.
◆ cancel_all()
| virtual void pulp::events::PushNotifications::cancel_all |
( |
| ) |
|
|
pure virtual |
Cancel every notification this process has posted.
◆ cancel_notification()
| virtual bool pulp::events::PushNotifications::cancel_notification |
( |
const std::string & | id | ) |
|
|
pure virtual |
Cancel a previously-posted notification by id (no-op if already dismissed).
Returns true if the backend reported the cancellation.
◆ current_authorization()
Synchronous query for the current authorization state.
◆ instance()
◆ is_available()
| virtual bool pulp::events::PushNotifications::is_available |
( |
| ) |
const |
|
pure virtual |
◆ operator=()
◆ post_local_notification()
| virtual uint64_t pulp::events::PushNotifications::post_local_notification |
( |
const LocalNotification & | notification | ) |
|
|
pure virtual |
Post a notification.
Returns the assigned id (notification.id if non-empty, otherwise an auto-generated id) or 0 on failure / unavailable. The id is also surfaced to NotificationHandler if the user activates it.
◆ request_authorization()
Ask the OS for permission to post notifications.
The callback fires once the platform has resolved the request (synchronously on backends that don't require an OS prompt, e.g. libnotify).
◆ set_handler()
Register a callback that fires when the user activates a posted notification.
Pass {} to clear.
The documentation for this class was generated from the following file: