diff --git a/src/imap.rs b/src/imap.rs index 4b2adca1b..b313f2084 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -1489,7 +1489,7 @@ impl Session { } else if !context.push_subscriber.heartbeat_subscribed().await { let context = context.clone(); // Subscribe for heartbeat notifications. - tokio::spawn(async move { context.push_subscriber.subscribe().await }); + tokio::spawn(async move { context.push_subscriber.subscribe(&context).await }); } Ok(()) diff --git a/src/push.rs b/src/push.rs index def916611..0498f8473 100644 --- a/src/push.rs +++ b/src/push.rs @@ -48,7 +48,7 @@ impl PushSubscriber { /// Subscribes for heartbeat notifications with previously set device token. #[cfg(target_os = "ios")] - pub(crate) async fn subscribe(&self) -> Result<()> { + pub(crate) async fn subscribe(&self, context: &Context) -> Result<()> { use crate::net::http; let mut state = self.inner.write().await; @@ -61,8 +61,9 @@ impl PushSubscriber { return Ok(()); }; - let socks5_config = None; - let response = http::get_client(socks5_config)? + let load_cache = true; + let response = http::get_client(context, load_cache) + .await? .post("https://notifications.delta.chat/register") .body(format!("{{\"token\":\"{token}\"}}")) .send() @@ -77,7 +78,7 @@ impl PushSubscriber { /// Placeholder to skip subscribing to heartbeat notifications outside 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; state.heartbeat_subscribed = true; Ok(())