Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.
Rust apple-notesapple-reminderscloudkitcrdtdesktop-appicloudicloud-calendaricloud-driveicloud-notesicloud-photosiphonelinuxlinux-desktoplocal-firstoffline-firstprivacyrusttauritauri-appwindows
Calendar: alerts and repeats set for all of a series belong to the series (verified live); deleting a series or this-and-future clears every one of its days here; all-day reminders on their own day west of UTC; alerts up to a week ahead ring
Yashwanth Kamireddid8aec8615cc8
diff --git a/crates/quince-icloud/src/calendar.rs b/crates/quince-icloud/src/calendar.rsindex 7a9e0e5..eb9cd4b 100644--- a/crates/quince-icloud/src/calendar.rs+++ b/crates/quince-icloud/src/calendar.rs@@ -505,6 +505,14 @@ impl<'a> CalendarClient<'a> {_ => event,};let mut event_value = self.event_body(event, existing.as_ref());+ // Whose alerts and repeat these are. For all of a series, the series' — Apple's+ // own name for an alert or repeat object carries the series id; made under one day's+ // id, a change meant for every day belonged to that day alone.+ let owner: String = if occurrence && scope == Some(Scope::All) {+ series_of(&event.guid).to_string()+ } else {+ event.guid.clone()+ };let held: Vec<Value> = detail.as_ref().and_then(|d| d.get("Alarm"))@@ -521,7 +529,7 @@ impl<'a> CalendarClient<'a> {Some(minutes) => minutes.iter().take(2) // as icloud.com allows: an alert and a second alert- .map(|m| alarm_for(&event.guid, *m))+ .map(|m| alarm_for(&owner, *m)).collect(),};// Only a change of alerts rewrites the event's list of them; otherwise it goes back@@ -562,10 +570,10 @@ impl<'a> CalendarClient<'a> {body["Event"]["recurrence"] = Value::Null;}Some(Some(rule)) => {- let guid = format!("{}*MME-RID", event.guid);+ let guid = format!("{owner}*MME-RID");let mut object = serde_json::json!({"guid": guid,- "pGuid": event.guid,+ "pGuid": owner,"freq": rule.freq,"interval": rule.interval.max(1),});diff --git a/probe/examples/calendar_alert_series.rs b/probe/examples/calendar_alert_series.rsnew file mode 100644index 0000000..92e3309--- /dev/null+++ b/probe/examples/calendar_alert_series.rs@@ -0,0 +1,85 @@+//! Live, throwaway event only: a weekly event three times, an alert set from its second+//! occurrence for all events — every occurrence must then carry it — then deleted.+use anyhow::{anyhow, Result};+use serde_json::Value;+#[tokio::main]+async fn main() -> Result<()> {+ let dir = std::path::PathBuf::from(std::env::var("HOME")?).join(".local/share/quince-probe");+ let mut client = quince_auth::Client::new(&dir)?;+ if !client.resume().await? {+ return Err(anyhow!("no session"));+ }+ let root = client+ .session()+ .service_url("calendar")+ .ok_or_else(|| anyhow!("no calendar"))?;+ let (http, p) = (client.http().clone(), client.service_params());+ let cal = quince_icloud::calendar::CalendarClient::new(&http, &root, p.clone());+ let snap = cal+ .startup("2026-10-01", "2026-10-31", "Asia/Kolkata")+ .await?;+ let home = snap+ .calendars+ .iter()+ .find(|c| c.writable)+ .ok_or_else(|| anyhow!("no writable calendar"))?;+ let event = quince_core::calendar::Event {+ guid: uuid::Uuid::new_v4().to_string().to_uppercase(),+ calendar_guid: home.guid.clone(),+ title: "Quince alert series test".into(),+ starts_at: 1_793_000_000,+ ends_at: 1_793_003_600,+ timezone: Some("Asia/Kolkata".into()),+ ..Default::default()+ };+ let rule = quince_icloud::calendar::EventRepeat {+ freq: "weekly".into(),+ interval: 1,+ count: Some(3),+ };+ cal.put_event_full(&event, None, None, Some(Some(&rule)), None)+ .await?;+ let _raw = |from: &str, to: &str| {+ let mut q = p.clone();+ for (k, v) in [+ ("clientVersion", "5.1"),+ ("requestID", "4"),+ ("lang", "en-us"),+ ("usertz", "Asia/Kolkata"),+ ("startDate", from),+ ("endDate", to),+ ] {+ q.push((k.into(), v.into()));+ }+ (format!("{}/ca/events", root.trim_end_matches('/')), q)+ };+ let occ = |n: i64| {+ let mut e = event.clone();+ let d = 7 * 86_400 * n;+ e.starts_at += d;+ e.ends_at += d;+ e.guid = format!(+ "{}__{}",+ event.guid,+ jiff::Timestamp::from_second(e.starts_at)+ .unwrap()+ .strftime("%Y%m%dT%H%M%SZ")+ );+ e+ };+ let second = occ(1);+ cal.put_event_full(+ &second,+ None,+ Some(&[15]),+ None,+ Some(quince_icloud::calendar::Scope::All),+ )+ .await?;+ for (label, e) in [("first", occ(0)), ("second", occ(1)), ("third", occ(2))] {+ println!("{label}: alerts {:?}", cal.alerts(&e).await);+ }+ cal.delete_event(&event, None).await?;+ println!("deleted");+ Ok(())+}diff --git a/src-tauri/src/alerts.rs b/src-tauri/src/alerts.rsindex c81fc75..5166fe0 100644--- a/src-tauri/src/alerts.rs+++ b/src-tauri/src/alerts.rs@@ -220,7 +220,9 @@ pub fn spawn_events(app: AppHandle) {let data = app.state::<Data>();let library = data.0.lock().await;library- .events_starting_between(at - STILL_WORTH_SAYING, at + 2 * 86_400)+ // As far ahead as the earliest alert Calendar offers — a week before —+ // and a day more: looking two days ahead, a week-before alert never rang.+ .events_starting_between(at - STILL_WORTH_SAYING, at + 8 * 86_400).unwrap_or_default().into_iter().filter(|(guid, _)| !guid.starts_with("quince:"))diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rsindex 63ca9c9..50ba0d1 100644--- a/src-tauri/src/main.rs+++ b/src-tauri/src/main.rs@@ -538,10 +538,31 @@ async fn event_delete(.delete_event_scoped(&event, ctag.as_deref(), scope).await.map_err(|e| e.to_string())?;+ // What went at Apple goes here: the whole series for all of it, this day and those after+ // for this-and-future — not just the one day, which left the rest of a deleted series on+ // screen until the next sync.let mut library = data.0.lock().await;- library- .forget_events(std::slice::from_ref(&event.guid))- .map_err(|e| e.to_string())+ let series = quince_icloud::calendar::series_of(&event.guid).to_string();+ let gone: Vec<String> = match scope {+ Some(quince_icloud::calendar::Scope::All)+ | Some(quince_icloud::calendar::Scope::Future) => library+ .events_starting_between(i64::MIN / 2, i64::MAX / 2)+ .map_err(|e| e.to_string())?+ .into_iter()+ .map(|(g, _)| g)+ .filter(|g| quince_icloud::calendar::series_of(g) == series)+ .filter(|g| {+ scope == Some(quince_icloud::calendar::Scope::All)+ || library+ .event(g)+ .ok()+ .flatten()+ .is_some_and(|e| e.starts_at >= event.starts_at)+ })+ .collect(),+ _ => vec![event.guid.clone()],+ };+ library.forget_events(&gone).map_err(|e| e.to_string())}/// Events overlapping `[from, to]`, as unix seconds. Read straight from the library.diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsxindex f701715..85afd31 100644--- a/src/screens/calendar/CalendarView.tsx+++ b/src/screens/calendar/CalendarView.tsx@@ -313,7 +313,14 @@ export function CalendarView() {setEvents(Array.isArray(found) ? found : []);setCalendars(Array.isArray(cals) ? cals : []);// What is done is not on the schedule any more; Calendar hides completed reminders.- setDue(Array.isArray(reminders) ? reminders.filter((r) => !r.completedAt) : []);+ // An all-day reminder's date is Apple's: midnight UTC on its day. Read as an instant it+ // landed a day early for anyone west of UTC; it is that day, on this clock.+ const onItsDay = (r: Reminder) => {+ if (!r.allDay || r.dueAt === null) return r;+ const d = new Date(r.dueAt * 1000);+ return { ...r, dueAt: Math.floor(new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate()).getTime() / 1000) };+ };+ setDue(Array.isArray(reminders) ? reminders.filter((r) => !r.completedAt).map(onItsDay) : []);setLoaded(true);}, [range]);