pub struct NotificationEffects<'a, 'b, S: AppState> { /* private fields */ }Expand description
Convenience builder for the standard notification host capabilities.
Implementations§
Source§impl<'a, 'b, S: AppState> NotificationEffects<'a, 'b, S>
impl<'a, 'b, S: AppState> NotificationEffects<'a, 'b, S>
Sourcepub fn request_permission(
self,
request: NotificationPermissionRequest,
) -> EffectBuilder<'a, 'b, S>
pub fn request_permission( self, request: NotificationPermissionRequest, ) -> EffectBuilder<'a, 'b, S>
Requests notification permission from the active host.
request declares which notification features the app wants, such as
alerts, badges, sounds, or provisional delivery. The returned
EffectBuilder should normally bind success and error actions so the
reducer can update state after the user responds to the platform prompt.
Sourcepub fn settings(self) -> EffectBuilder<'a, 'b, S>
pub fn settings(self) -> EffectBuilder<'a, 'b, S>
Queries the host’s current notification settings without showing a prompt.
Use this before rendering notification-dependent controls or when a
settings screen needs to explain why delivery is unavailable. The success
action receives NotificationSettings.
Sourcepub fn show(self, request: NotificationRequest) -> EffectBuilder<'a, 'b, S>
pub fn show(self, request: NotificationRequest) -> EffectBuilder<'a, 'b, S>
Shows an immediate local notification through the host.
request supplies the stable notification id, visible title/body, badge,
sound policy, optional deep link, and action buttons. Use schedule
instead when delivery should happen at a future time.
Sourcepub fn schedule(self, request: NotificationRequest) -> EffectBuilder<'a, 'b, S>
pub fn schedule(self, request: NotificationRequest) -> EffectBuilder<'a, 'b, S>
Schedules a local notification for future delivery.
The schedule field on request controls the delivery time. Hosts may
reject schedules they cannot persist, cannot deliver in the background, or
cannot map to the platform notification model.
Sourcepub fn cancel(
self,
request: CancelNotificationRequest,
) -> EffectBuilder<'a, 'b, S>
pub fn cancel( self, request: CancelNotificationRequest, ) -> EffectBuilder<'a, 'b, S>
Cancels one pending or displayed notification by id.
Use the same NotificationId that was used for show or schedule. A
host may treat cancelling an unknown id as success if the desired final
state is already true.
Sourcepub fn cancel_all(self) -> EffectBuilder<'a, 'b, S>
pub fn cancel_all(self) -> EffectBuilder<'a, 'b, S>
Cancels all notifications owned by this app where the host supports it.
Use this for sign-out, workspace switching, or clearing a notification
center state that no longer matches app state. Hosts that cannot bulk
cancel should return NotificationError.
Sourcepub fn set_badge_count(
self,
request: SetBadgeCountRequest,
) -> EffectBuilder<'a, 'b, S>
pub fn set_badge_count( self, request: SetBadgeCountRequest, ) -> EffectBuilder<'a, 'b, S>
Sets or clears the app badge count.
request.count = Some(n) asks the host to show a badge count.
request.count = None clears the badge. Badge support varies by desktop
shell, launcher, browser, and mobile platform.
Sourcepub fn register_push(
self,
request: PushRegistrationRequest,
) -> EffectBuilder<'a, 'b, S>
pub fn register_push( self, request: PushRegistrationRequest, ) -> EffectBuilder<'a, 'b, S>
Registers the app for remote or push notifications.
request carries provider-specific public registration inputs such as a
web push application-server key, Android sender id, or requested topics.
Secrets and store credentials belong in host configuration, not in app
state.
Sourcepub fn unregister_push(self) -> EffectBuilder<'a, 'b, S>
pub fn unregister_push(self) -> EffectBuilder<'a, 'b, S>
Unregisters the app from remote or push notification delivery.
Use this during sign-out, account removal, or when a user disables remote notifications. The host should invalidate or delete its platform token where the provider supports that operation.
Auto Trait Implementations§
impl<'a, 'b, S> Freeze for NotificationEffects<'a, 'b, S>
impl<'a, 'b, S> !RefUnwindSafe for NotificationEffects<'a, 'b, S>
impl<'a, 'b, S> Send for NotificationEffects<'a, 'b, S>
impl<'a, 'b, S> Sync for NotificationEffects<'a, 'b, S>
impl<'a, 'b, S> Unpin for NotificationEffects<'a, 'b, S>
impl<'a, 'b, S> UnsafeUnpin for NotificationEffects<'a, 'b, S>
impl<'a, 'b, S> !UnwindSafe for NotificationEffects<'a, 'b, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.