mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 19:06:35 +03:00
fix: do not try to register non-iOS tokens for heartbeats
Notification server uses APNS server for heartbeat notifications, so registering FCM tokens there will result in failing to notify them and unregistering them anyway.
This commit is contained in:
12
src/push.rs
12
src/push.rs
@@ -5,7 +5,6 @@ use anyhow::Result;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use crate::context::Context;
|
||||
use crate::net::http;
|
||||
|
||||
/// Manages subscription to Apple Push Notification services.
|
||||
///
|
||||
@@ -48,7 +47,10 @@ impl PushSubscriber {
|
||||
}
|
||||
|
||||
/// Subscribes for heartbeat notifications with previously set device token.
|
||||
#[cfg(target_os = "ios")]
|
||||
pub(crate) async fn subscribe(&self) -> Result<()> {
|
||||
use crate::net::http;
|
||||
|
||||
let mut state = self.inner.write().await;
|
||||
|
||||
if state.heartbeat_subscribed {
|
||||
@@ -73,6 +75,14 @@ impl PushSubscriber {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Placeholder to skip subscribing to heartbeat notifications outside iOS.
|
||||
#[cfg(not(target_os = "ios"))]
|
||||
pub(crate) async fn subscribe(&self) -> Result<()> {
|
||||
let mut state = self.inner.write().await;
|
||||
state.heartbeat_subscribed = true;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) async fn heartbeat_subscribed(&self) -> bool {
|
||||
self.inner.read().await.heartbeat_subscribed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user