pub struct Notifications<R: Runtime> { /* private fields */ }Expand description
Access to the notification APIs.
You can get an instance of this type via NotificationsExt
Implementations§
Source§impl<R: Runtime> Notifications<R>
impl<R: Runtime> Notifications<R>
pub fn builder(&self) -> NotificationsBuilder<R>
pub async fn request_permission(&self) -> Result<PermissionState>
Sourcepub async fn register_for_push_notifications(&self) -> Result<String>
pub async fn register_for_push_notifications(&self) -> Result<String>
On Linux with the push-notifications feature this registers with the
selected (or first available) UnifiedPush distributor and returns the
endpoint URL. Apps that need endpoint stability across launches should
call set_token before this with a persisted token.
Sourcepub fn unregister_for_push_notifications(&self) -> Result<()>
pub fn unregister_for_push_notifications(&self) -> Result<()>
Sync signature preserved for source compatibility — callers that need
the Linux UnifiedPush unregister path should use
[unregister_for_push_notifications_async] instead.
Sourcepub async fn unregister_for_push_notifications_async(&self) -> Result<()>
pub async fn unregister_for_push_notifications_async(&self) -> Result<()>
Async unregister used by the Tauri command bridge. On Linux with the
push-notifications feature this calls
org.unifiedpush.Distributor1.Unregister and clears the in-memory
active registration.
pub async fn permission_state(&self) -> Result<PermissionState>
pub async fn pending(&self) -> Result<Vec<PendingNotification>>
Sourcepub async fn active(&self) -> Result<Vec<ActiveNotification>>
pub async fn active(&self) -> Result<Vec<ActiveNotification>>
Linux: returns the currently-tracked notifications. The list is
populated by NotificationsBuilder::show and pruned by
cancel/cancel_all/remove_active. Entries dismissed by the user
or expired by the OS may linger until the next explicit cancel call,
since notify-rust doesn’t expose a non-consuming “closed” callback.
macOS / Windows: still unsupported.
pub fn set_click_listener_active(&self, _active: bool) -> Result<()>
Sourcepub fn remove_active(&self, ids: Vec<i32>) -> Result<()>
pub fn remove_active(&self, ids: Vec<i32>) -> Result<()>
Linux: closes every tracked notification whose caller-supplied id
appears in ids and removes it from the active map.
macOS / Windows: unsupported.
pub fn remove_all_active(&self) -> Result<()>
Sourcepub fn cancel(&self, notifications: Vec<i32>) -> Result<()>
pub fn cancel(&self, notifications: Vec<i32>) -> Result<()>
Same semantics as remove_active on Linux;
macOS / Windows: unsupported.
Sourcepub fn cancel_all(&self) -> Result<()>
pub fn cancel_all(&self) -> Result<()>
Linux: closes every tracked notification. macOS / Windows: unsupported.