mirror of
https://github.com/chatmail/core.git
synced 2026-04-20 15:06:30 +03:00
fix: fix compilation on iOS
This commit is contained in:
@@ -1489,7 +1489,7 @@ impl Session {
|
|||||||
} else if !context.push_subscriber.heartbeat_subscribed().await {
|
} else if !context.push_subscriber.heartbeat_subscribed().await {
|
||||||
let context = context.clone();
|
let context = context.clone();
|
||||||
// Subscribe for heartbeat notifications.
|
// Subscribe for heartbeat notifications.
|
||||||
tokio::spawn(async move { context.push_subscriber.subscribe().await });
|
tokio::spawn(async move { context.push_subscriber.subscribe(&context).await });
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ impl PushSubscriber {
|
|||||||
|
|
||||||
/// Subscribes for heartbeat notifications with previously set device token.
|
/// Subscribes for heartbeat notifications with previously set device token.
|
||||||
#[cfg(target_os = "ios")]
|
#[cfg(target_os = "ios")]
|
||||||
pub(crate) async fn subscribe(&self) -> Result<()> {
|
pub(crate) async fn subscribe(&self, context: &Context) -> Result<()> {
|
||||||
use crate::net::http;
|
use crate::net::http;
|
||||||
|
|
||||||
let mut state = self.inner.write().await;
|
let mut state = self.inner.write().await;
|
||||||
@@ -61,8 +61,9 @@ impl PushSubscriber {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
|
|
||||||
let socks5_config = None;
|
let load_cache = true;
|
||||||
let response = http::get_client(socks5_config)?
|
let response = http::get_client(context, load_cache)
|
||||||
|
.await?
|
||||||
.post("https://notifications.delta.chat/register")
|
.post("https://notifications.delta.chat/register")
|
||||||
.body(format!("{{\"token\":\"{token}\"}}"))
|
.body(format!("{{\"token\":\"{token}\"}}"))
|
||||||
.send()
|
.send()
|
||||||
@@ -77,7 +78,7 @@ impl PushSubscriber {
|
|||||||
|
|
||||||
/// Placeholder to skip subscribing to heartbeat notifications outside iOS.
|
/// Placeholder to skip subscribing to heartbeat notifications outside iOS.
|
||||||
#[cfg(not(target_os = "ios"))]
|
#[cfg(not(target_os = "ios"))]
|
||||||
pub(crate) async fn subscribe(&self) -> Result<()> {
|
pub(crate) async fn subscribe(&self, _context: &Context) -> Result<()> {
|
||||||
let mut state = self.inner.write().await;
|
let mut state = self.inner.write().await;
|
||||||
state.heartbeat_subscribed = true;
|
state.heartbeat_subscribed = true;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user