Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Calendar: All Future Events — change or delete from this occurrence on

Yashwanth Kamireddi34a00c230cda
diff --git a/.uiverify/calendar-repeat.mjs b/.uiverify/calendar-repeat.mjs
index bcbf13f..6b2ef13 100644
--- a/.uiverify/calendar-repeat.mjs
+++ b/.uiverify/calendar-repeat.mjs
@@ -53,6 +53,18 @@ await page.getByRole("button", { name: "All Events", exact: true }).click();
await page.waitForTimeout(300);
const all = await page.evaluate(() => window.__eventSaves?.at(-1));
ok(all?.scope === "all", `and "all events" sends the change for the series ${JSON.stringify({ s: all?.scope })}`);
+// All future events: from this day on, the days before kept.
+await page.locator(".cx-block", { hasText: "Weekly" }).first().click();
+await page.waitForTimeout(250);
+await page.locator('input[placeholder="New Event"]').first().fill("Weekly standup, new room");
+await page.locator('input[placeholder="New Event"]').first().press("Enter");
+await page.waitForTimeout(250);
+const buttons = await page.getByRole("alertdialog").getByRole("button").allInnerTexts();
+ok(buttons.join("|") === "Only This Event|All Future Events|All Events|Cancel", `the question offers this, future, all, as macOS stacks them ${JSON.stringify(buttons)}`);
+await page.getByRole("button", { name: "All Future Events", exact: true }).click();
+await page.waitForTimeout(300);
+const future = await page.evaluate(() => window.__eventSaves?.at(-1));
+ok(future?.scope === "future" && future?.guid === "SERIES__20261020T040000Z", `and "all future events" sends that, from this occurrence ${JSON.stringify({ s: future?.scope })}`);
// Repeat: an occurrence shows its series' repeat; a one-off can be made to repeat.
await page.locator(".cx-block", { hasText: "Weekly" }).first().click();
await page.waitForTimeout(300);
@@ -75,5 +87,15 @@ await page.locator('input[placeholder="New Event"]').first().press("Enter");
await page.waitForTimeout(300);
const never = await page.evaluate(() => window.__eventSaves?.at(-1));
ok(never?.scope === "all" && never?.repeat === null && (await page.getByRole("alertdialog").count()) === 0, `a series set to Never, for all of it ${JSON.stringify({ s: never?.scope, r: never?.repeat })}`);
+// Deleting from this day on.
+await page.locator(".cx-block", { hasText: "Weekly" }).first().click();
+await page.waitForTimeout(250);
+await page.evaluate(() => document.activeElement?.blur());
+await page.keyboard.press("Delete");
+await page.waitForTimeout(250);
+await page.getByRole("button", { name: "Delete All Future Events" }).click();
+await page.waitForTimeout(300);
+const gone = await page.evaluate(() => window.__eventDeletes?.at(-1));
+ok(gone?.scope === "future", `"delete all future events" sends that ${JSON.stringify(gone)}`);
await b.close();
process.exitCode = failures ? 1 : 0;
diff --git a/crates/quince-icloud/src/calendar.rs b/crates/quince-icloud/src/calendar.rs
index de146cf..7a9e0e5 100644
--- a/crates/quince-icloud/src/calendar.rs
+++ b/crates/quince-icloud/src/calendar.rs
@@ -319,6 +319,9 @@ fn minutes_of(m: &Value) -> Option<i64> {
pub enum Scope {
/// This one alone; the rest of the series as it was.
This,
+ /// This one and every one after it — the series before it stays as it was. Apple splits
+ /// the series at this occurrence; on the first occurrence it is the same as `All`.
+ Future,
/// The whole series: what changed here — and, if this occurrence was moved, the series
/// moved by as much — every occurrence, past and future.
All,
@@ -586,6 +589,11 @@ impl<'a> CalendarClient<'a> {
body["Event"]["changeRecurring"] = Value::from("all");
path.push_str("/all");
}
+ // The occurrence's own dates go, not the series': from here on is what changes.
+ Some(Scope::Future) if occurrence => {
+ body["Event"]["changeRecurring"] = Value::from("future");
+ path.push_str("/future");
+ }
_ => {}
}
let answer = self
@@ -632,6 +640,7 @@ impl<'a> CalendarClient<'a> {
match scope {
Some(Scope::This) => path.push_str("/this"),
Some(Scope::All) if is_occurrence(&event.guid) => path.push_str("/all"),
+ Some(Scope::Future) if is_occurrence(&event.guid) => path.push_str("/future"),
_ => {}
}
match self
@@ -1361,6 +1370,32 @@ mod write_tests {
assert_eq!(body["Event"]["changeRecurring"], "this");
}
+ /// "All future events" goes to the occurrence's `/future` path with its own dates —
+ /// measured live, Apple splits the series there and the days before keep their name.
+ #[tokio::test]
+ async fn from_this_occurrence_on_goes_to_its_future_path() {
+ let server = server().await;
+ let http = reqwest::Client::new();
+ let client = CalendarClient::new(&http, &server.uri(), vec![]);
+ let mut one = event();
+ one.guid = "SERIES__20261102T073300Z".into();
+ client
+ .put_event_full(&one, None, None, None, Some(Scope::Future))
+ .await
+ .unwrap();
+ let sent = request(&server).await;
+ assert!(
+ sent.url
+ .path()
+ .ends_with("/SERIES__20261102T073300Z/future"),
+ "{}",
+ sent.url.path()
+ );
+ let body: Value = serde_json::from_slice(&sent.body).unwrap();
+ assert_eq!(body["Event"]["changeRecurring"], "future");
+ assert!(body["Event"].get("recurrenceException").is_none());
+ }
+
/// Apple failing to say what an event holds is not "a new event": building the save
/// from nothing would write empty recurrence, alerts and guests over the real one.
#[tokio::test]
diff --git a/probe/examples/calendar_future.rs b/probe/examples/calendar_future.rs
new file mode 100644
index 0000000..f6f94fa
--- /dev/null
+++ b/probe/examples/calendar_future.rs
@@ -0,0 +1,133 @@
+//! Live, throwaway event only: a weekly event four times, its third occurrence renamed for
+//! "all future events" — the first two must keep their name — then every piece 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 future 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(4),
+ };
+ 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 list = |label: &'static str| {
+ let (url, q) = raw("2026-10-26", "2026-12-01");
+ let http = http.clone();
+ async move {
+ let body: Value = http.get(url).query(&q).send().await?.json().await?;
+ let found: Vec<(String, String, String)> = body["Event"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .filter(|e| {
+ e["title"]
+ .as_str()
+ .is_some_and(|t| t.starts_with("Quince future test"))
+ })
+ .map(|e| {
+ (
+ e["guid"].as_str().unwrap_or("").to_string(),
+ e["title"].as_str().unwrap_or("").to_string(),
+ e["startDate"].to_string(),
+ )
+ })
+ .collect();
+ for f in &found {
+ println!("{label}: {f:?}");
+ }
+ anyhow::Ok(found)
+ }
+ };
+ let before = list("before").await?;
+ let third_id = before
+ .get(2)
+ .map(|f| f.0.clone())
+ .ok_or_else(|| anyhow!("no third occurrence"))?;
+ let mut third = event.clone();
+ third.guid = third_id;
+ third.starts_at += 14 * 86_400;
+ third.ends_at += 14 * 86_400;
+ third.title = "Quince future test, from third".into();
+ let outcome = cal
+ .put_event_full(
+ &third,
+ None,
+ None,
+ None,
+ Some(quince_icloud::calendar::Scope::Future),
+ )
+ .await;
+ println!(
+ "future edit: {:?}",
+ outcome
+ .as_ref()
+ .map(|_| "accepted")
+ .map_err(|e| e.to_string())
+ );
+ let after = list("after").await?;
+ let renamed = after
+ .iter()
+ .filter(|f| f.1 == "Quince future test, from third")
+ .count();
+ let kept = after.iter().filter(|f| f.1 == "Quince future test").count();
+ println!("RESULT kept={kept} renamed={renamed} (want 2 and 2)");
+ // Every series that came of it, deleted.
+ let mut series: Vec<String> = after
+ .iter()
+ .map(|f| quince_icloud::calendar::series_of(&f.0).to_string())
+ .collect();
+ series.sort();
+ series.dedup();
+ for s in series {
+ let mut e = event.clone();
+ e.guid = s;
+ if let Err(err) = cal.delete_event(&e, None).await {
+ println!("delete {}: {err}", e.guid);
+ }
+ }
+ list("left").await?;
+ Ok(())
+}
diff --git a/src/lib/ipc.ts b/src/lib/ipc.ts
index 6683400..6c3d8bf 100644
--- a/src/lib/ipc.ts
+++ b/src/lib/ipc.ts
@@ -76,7 +76,7 @@ export const api = {
eventSave: (draft: EventWrite) => invoke<string>("event_save", { draft }),
eventAlerts: (guid: string) => invoke<number[]>("event_alerts", { guid }),
eventRepeat: (guid: string) => invoke<EventRepeat | null>("event_repeat", { guid }),
- eventDelete: (guid: string, scope?: "this" | "all") => invoke<void>("event_delete", { guid, scope: scope ?? null }),
+ eventDelete: (guid: string, scope?: EventScope) => invoke<void>("event_delete", { guid, scope: scope ?? null }),
calendarSync: (from: string, to: string, timezone: string) =>
invoke<SyncSummary>("calendar_sync", { from, to, timezone }),
/** Events holding every word of the query, soonest first. */
@@ -243,7 +243,7 @@ export type EventWrite = {
repeat?: EventRepeat | null;
repeatChanged?: boolean;
/** For one occurrence of a repeating event: whether the change is for it alone or the series. */
- scope?: "this" | "all";
+ scope?: EventScope;
};
/** How an event repeats, in icloud.com's words. */
@@ -425,6 +425,9 @@ export type ContactList = {
etag: string | null;
};
+/** Which events a change to one day of a repeating event is for. */
+export type EventScope = "this" | "future" | "all";
+
export type Contact = {
guid: string;
firstName: string | null;
diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsx
index cae8b99..133b280 100644
--- a/src/screens/calendar/CalendarView.tsx
+++ b/src/screens/calendar/CalendarView.tsx
@@ -10,8 +10,7 @@ import {
messageOf,
type Calendar,
type CalendarEvent,
- type Reminder,
-} from "../../lib/ipc";
+ type Reminder, type EventScope } from "../../lib/ipc";
import { useSync } from "../../lib/sync";
import { Picker } from "../../components/Picker";
import {
@@ -394,7 +393,7 @@ export function CalendarView() {
* that occurrence alone, as Calendar asks — sent as though it were an event, Apple took it
* as the whole series.
*/
- const [asking, setAsking] = useState<{ verb: "change" | "delete"; answer: (scope: "this" | "all" | null) => void } | null>(null);
+ const [asking, setAsking] = useState<{ verb: "change" | "delete"; answer: (scope: EventScope | null) => void } | null>(null);
useEffect(() => {
if (!asking) return undefined;
const onKey = (e: KeyboardEvent) => {
@@ -407,7 +406,7 @@ export function CalendarView() {
return () => window.removeEventListener("keydown", onKey, true);
}, [asking]);
const whichEvents = (verb: "change" | "delete") =>
- new Promise<"this" | "all" | null>((answer) => setAsking({ verb, answer: (scope) => { setAsking(null); answer(scope); } }));
+ new Promise<EventScope | null>((answer) => setAsking({ verb, answer: (scope) => { setAsking(null); answer(scope); } }));
const save = useCallback(
async (d: Draft) => {
@@ -434,7 +433,16 @@ export function CalendarView() {
}, (rows) => {
// Shown where it now sits at once; a new one is drawn by its draft until Apple names it.
if (!d.guid) return rows;
- return rows.map((e) => e.guid === d.guid ? {
+ // Future and All carry the words to the other days too; their times Apple settles.
+ const series = d.guid.split("__")[0];
+ const from = events.find((e) => e.guid === d.guid)?.startsAt ?? d.startsAt;
+ const alsoThis = (e: { guid: string; startsAt: number }) =>
+ e.guid !== d.guid && e.guid.split("__")[0] === series &&
+ (scope === "all" || (scope === "future" && e.startsAt >= from));
+ return rows.map((e) => alsoThis(e) ? {
+ ...e, title: d.title.trim() || "New Event", location: d.location.trim() || null,
+ notes: d.notes.trim() || null,
+ } : e.guid === d.guid ? {
...e, calendarGuid: d.calendarGuid, title: d.title.trim() || "New Event",
location: d.location.trim() || null, startsAt: d.startsAt,
endsAt: Math.max(d.endsAt, d.startsAt + (d.allDay ? 86_400 : 900)),
@@ -442,7 +450,7 @@ export function CalendarView() {
} : e);
});
},
- [write]
+ [write, events]
);
/**
@@ -460,7 +468,10 @@ export function CalendarView() {
const series = guid.split("__")[0];
if (await write(
() => api.eventDelete(guid, scope ?? undefined),
- (rows) => rows.filter((e) => (scope === "all" ? e.guid.split("__")[0] !== series : e.guid !== guid)),
+ (rows) => rows.filter((e) =>
+ scope === "all" ? e.guid.split("__")[0] !== series
+ : scope === "future" ? !(e.guid.split("__")[0] === series && e.startsAt >= (gone?.startsAt ?? 0))
+ : e.guid !== guid),
)) {
// Undo makes the event again; for one day out of a series that would be a new event,
// not the day put back, so it is not offered.
@@ -853,17 +864,21 @@ export function CalendarView() {
<h2>This is a repeating event.</h2>
<p>
{asking.verb === "delete"
- ? "Do you want to delete only this event, or all events in the series?"
- : "Do you want to change only this event, or all events in the series?"}
+ ? "Do you want to delete only this event, this and all future events, or all events in the series?"
+ : "Do you want to change only this event, this and all future events, or all events in the series?"}
</p>
+ {/* Stacked, the chosen-by-default first, as macOS stacks an alert's choices. */}
<div className="cx-ask-actions">
- <button className="quiet" onClick={() => asking.answer(null)}>Cancel</button>
- <button className={asking.verb === "delete" ? "quiet danger" : "quiet"} onClick={() => asking.answer("all")}>
- {asking.verb === "delete" ? "Delete All Events" : "All Events"}
- </button>
<button className={asking.verb === "delete" ? "primary danger" : "primary"} autoFocus onClick={() => asking.answer("this")}>
{asking.verb === "delete" ? "Delete Only This Event" : "Only This Event"}
</button>
+ <button className={asking.verb === "delete" ? "quiet danger" : "quiet"} onClick={() => asking.answer("future")}>
+ {asking.verb === "delete" ? "Delete All Future Events" : "All Future Events"}
+ </button>
+ <button className={asking.verb === "delete" ? "quiet danger" : "quiet"} onClick={() => asking.answer("all")}>
+ {asking.verb === "delete" ? "Delete All Events" : "All Events"}
+ </button>
+ <button className="quiet" onClick={() => asking.answer(null)}>Cancel</button>
</div>
</div>
</div>
diff --git a/src/styles/calendar.css b/src/styles/calendar.css
index 20a5864..c806a9e 100644
--- a/src/styles/calendar.css
+++ b/src/styles/calendar.css
@@ -741,7 +741,8 @@
.cx:has(.cx-pane-month) .cx-side .cx-minimonth { display: none; }
/* Calendar's question for a repeating event: what it is, then the two answers. */
-.cx-ask { width: min(380px, calc(100vw - 32px)); padding: 20px 22px 16px; }
+.cx-ask { width: min(300px, calc(100vw - 32px)); padding: 20px 18px 16px; text-align: center; }
.cx-ask h2 { margin: 0 0 6px; font-size: var(--t-15); font-weight: 600; }
.cx-ask p { margin: 0 0 16px; color: var(--text-2); font-size: var(--t-13); }
-.cx-ask-actions { display: flex; justify-content: flex-end; gap: 8px; }
+.cx-ask-actions { display: flex; flex-direction: column; gap: 8px; }
+.cx-ask-actions > button { width: 100%; }