pub trait PushService {
// Required methods
fn available(&self) -> bool;
fn provider(&self) -> &'static str;
fn register(&mut self, config: &PushConfig);
// Provided methods
fn unregister(&mut self) { ... }
fn shows_notifications(&self) -> bool { ... }
fn poll(&mut self) -> Vec<PushEvent> { ... }
}Expand description
Notificações push (o componente PushNotifications). O registro responde depois: o
token, as mensagens e os toques chegam por push_event (de qualquer thread, quando o
sistema chama) ou pelo PushService::poll.
Required Methods§
Sourcefn available(&self) -> bool
fn available(&self) -> bool
Há um serviço de push aqui (no Android, o Google Play Services; no navegador, a Push API e o service worker).
Sourcefn provider(&self) -> &'static str
fn provider(&self) -> &'static str
O serviço: fcm, apns, webpush, wns ou unifiedpush (o servidor precisa saber
por onde enviar).
Sourcefn register(&mut self, config: &PushConfig)
fn register(&mut self, config: &PushConfig)
Pede a permissão de notificar (onde é preciso) e registra; o token chega como
PushEvent::Token.
Provided Methods§
Sourcefn unregister(&mut self)
fn unregister(&mut self)
Deixa de receber (o token deixa de valer).
Sourcefn shows_notifications(&self) -> bool
fn shows_notifications(&self) -> bool
A própria plataforma mostra a notificação da mensagem (Android, iOS, macOS,
navegador). Sem isso (o WNS raw, o UnifiedPush), o componente mostra pelo
NotificationService com o show_in_foreground.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".