api!: remove getPushState() and core's internal tracking of it.

Since https://github.com/deltachat/deltachat-ios/pull/3224 pushstate is not used
(android, desktop etc. never used it, only ios)
This commit is contained in:
holger krekel
2026-07-26 17:06:45 +02:00
parent 0bb3d88bc6
commit 35555ca753
10 changed files with 0 additions and 98 deletions

View File

@@ -638,22 +638,6 @@ int dc_get_connectivity (dc_context_t* context);
char* dc_get_connectivity_html (dc_context_t* context);
#define DC_PUSH_NOT_CONNECTED 0
#define DC_PUSH_CONNECTED 2
/**
* Get the current push notification state.
* One of:
* - DC_PUSH_NOT_CONNECTED
* - DC_PUSH_CONNECTED
*
* @memberof dc_context_t
* @param context The context object.
* @return Push notification state.
*/
int dc_get_push_state (dc_context_t* context);
// connect
/**

View File

@@ -397,16 +397,6 @@ pub unsafe extern "C" fn dc_get_connectivity_html(
}
}
#[unsafe(no_mangle)]
pub unsafe extern "C" fn dc_get_push_state(context: *const dc_context_t) -> libc::c_int {
if context.is_null() {
eprintln!("ignoring careless call to dc_get_push_state()");
return 0;
}
let ctx = unsafe { &*context };
ctx.push_state() as libc::c_int
}
fn spawn_configure(ctx: Context) {
spawn(async move {
ctx.configure()

View File

@@ -53,7 +53,6 @@ use types::contact::{ContactObject, VcardContact};
use types::events::Event;
use types::http::HttpResponse;
use types::message::{MessageData, MessageObject, MessageReadReceipt};
use types::notify_state::JsonrpcNotifyState;
use types::reactions::JsonrpcReactions;
use types::webxdc::WebxdcMessageInfo;
@@ -328,12 +327,6 @@ impl CommandApi {
}
}
/// Get the current push notification state.
async fn get_push_state(&self, account_id: u32) -> Result<JsonrpcNotifyState> {
let ctx = self.get_context(account_id).await?;
Ok(ctx.push_state().into())
}
/// Get the combined filesize of an account in bytes
async fn get_account_file_size(&self, account_id: u32) -> Result<u64> {
let ctx = self.get_context(account_id).await?;

View File

@@ -8,8 +8,6 @@ pub mod http;
pub mod location;
pub mod login_param;
pub mod message;
pub mod notify_state;
pub mod qr;
pub mod reactions;
pub mod webxdc;

View File

@@ -1,22 +0,0 @@
use deltachat::push::NotifyState;
use serde::Serialize;
use typescript_type_def::TypeDef;
#[derive(Serialize, TypeDef, schemars::JsonSchema)]
#[serde(rename = "NotifyState")]
pub enum JsonrpcNotifyState {
/// Not subscribed to push notifications.
NotConnected,
/// Subscribed to push notifications for new messages.
Connected,
}
impl From<NotifyState> for JsonrpcNotifyState {
fn from(state: NotifyState) -> Self {
match state {
NotifyState::NotConnected => Self::NotConnected,
NotifyState::Connected => Self::Connected,
}
}
}

View File

@@ -44,7 +44,6 @@ const constants = data
key.startsWith("DC_CERTCK_") ||
key.startsWith("DC_SOCKET_") ||
key.startsWith("DC_LP_AUTH_") ||
key.startsWith("DC_PUSH_") ||
key.startsWith("DC_TEXT1_") ||
key.startsWith("DC_CHAT_TYPE")
);

View File

@@ -246,13 +246,6 @@ class ProviderStatus(IntEnum):
BROKEN = 3
class PushNotifyState(IntEnum):
"""Push notifications state."""
NOT_CONNECTED = 0
CONNECTED = 2
class ShowEmails(IntEnum):
"""Show emails mode."""

View File

@@ -4,7 +4,6 @@ use std::collections::{BTreeMap, HashMap};
use std::ffi::OsString;
use std::ops::Deref;
use std::path::{Path, PathBuf};
use std::sync::atomic::AtomicBool;
use std::sync::{Arc, OnceLock, Weak};
use std::time::Duration;
@@ -296,9 +295,6 @@ pub struct InnerContext {
/// Push subscriber to store device token.
pub(crate) push_subscriber: PushSubscriber,
/// True if account has subscribed to push notifications via IMAP.
pub(crate) push_subscribed: AtomicBool,
/// TLS session resumption cache.
pub(crate) tls_session_store: TlsSessionStore,
@@ -497,7 +493,6 @@ impl Context {
migration_error: parking_lot::RwLock::new(None),
debug_logging: std::sync::RwLock::new(None),
push_subscriber,
push_subscribed: AtomicBool::new(false),
tls_session_store: TlsSessionStore::new(),
spki_hash_store: SpkiHashStore::new(),
iroh: Arc::new(RwLock::new(None)),

View File

@@ -10,7 +10,6 @@ use std::{
iter::Peekable,
mem::take,
str::FromStr,
sync::atomic::Ordering,
time::{Duration, UNIX_EPOCH},
};
@@ -1509,8 +1508,6 @@ impl Session {
context,
"Transport {transport_id}: Failed to store device token: {err:#}."
);
} else {
context.push_subscribed.store(true, Ordering::Relaxed);
}
Ok(())

View File

@@ -7,14 +7,12 @@
//! which holds push notification token for the device,
//! shared by all accounts.
use std::sync::Arc;
use std::sync::atomic::Ordering;
use anyhow::{Context as _, Result};
use base64::Engine as _;
use pgp::crypto::aead::{AeadAlgorithm, ChunkSize};
use pgp::crypto::sym::SymmetricKeyAlgorithm;
use crate::context::Context;
use crate::key::DcKey;
/// Manages subscription to Apple Push Notification services.
@@ -117,29 +115,6 @@ impl PushSubscriber {
}
}
/// Push notification state
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, FromPrimitive, ToPrimitive)]
#[repr(i8)]
pub enum NotifyState {
/// Not subscribed to push notifications.
#[default]
NotConnected = 0,
/// Subscribed to push notifications for new messages.
Connected = 2,
}
impl Context {
/// Returns push notification subscriber state.
pub fn push_state(&self) -> NotifyState {
if self.push_subscribed.load(Ordering::Relaxed) {
NotifyState::Connected
} else {
NotifyState::NotConnected
}
}
}
#[cfg(test)]
mod tests {
use super::*;