pub struct PushSubscriber {
inner: Arc<RwLock<PushSubscriberState>>,
}
Expand description
Manages subscription to Apple Push Notification services.
This structure is created by account manager and is shared between accounts. To enable notifications, application should request the device token as described in https://developer.apple.com/documentation/usernotifications/registering-your-app-with-apns and give it to the account manager, which will forward the token in this structure.
Each account (context) can then retrieve device token
from this structure and give it to the email server.
If email server does not support push notifications,
account can call subscribe
method
to register device token with the heartbeat
notification provider server as a fallback.
Fields§
§inner: Arc<RwLock<PushSubscriberState>>
Implementations§
source§impl PushSubscriber
impl PushSubscriber
sourcepub(crate) async fn set_device_token(&self, token: &str)
pub(crate) async fn set_device_token(&self, token: &str)
Sets device token for Apple Push Notification service or Firebase Cloud Messaging.
sourcepub(crate) async fn device_token(&self) -> Option<String>
pub(crate) async fn device_token(&self) -> Option<String>
Retrieves device token.
The token is encrypted with OpenPGP.
Token may be not available if application is not running on Apple platform, does not have Google Play services, failed to register for remote notifications or is in the process of registering.
IMAP loop should periodically check if device token is available and send the token to the email server if it supports push notifications.
sourcepub(crate) async fn subscribe(&self, _context: &Context) -> Result<()>
pub(crate) async fn subscribe(&self, _context: &Context) -> Result<()>
Placeholder to skip subscribing to heartbeat notifications outside iOS.
pub(crate) async fn heartbeat_subscribed(&self) -> bool
Trait Implementations§
source§impl Clone for PushSubscriber
impl Clone for PushSubscriber
source§fn clone(&self) -> PushSubscriber
fn clone(&self) -> PushSubscriber
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PushSubscriber
impl Debug for PushSubscriber
source§impl Default for PushSubscriber
impl Default for PushSubscriber
source§fn default() -> PushSubscriber
fn default() -> PushSubscriber
Auto Trait Implementations§
impl Freeze for PushSubscriber
impl !RefUnwindSafe for PushSubscriber
impl Send for PushSubscriber
impl Sync for PushSubscriber
impl Unpin for PushSubscriber
impl !UnwindSafe for PushSubscriber
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)