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: changing, moving or deleting one occurrence of a repeating event asks, as Calendar does — Only This Event or All Events — and sends exactly that; Cancel sends nothing
Yashwanth Kamireddi05e34c898a8a
diff --git a/.uiverify/calendar-repeat.mjs b/.uiverify/calendar-repeat.mjsnew file mode 100644index 0000000..16dbfaa--- /dev/null+++ b/.uiverify/calendar-repeat.mjs@@ -0,0 +1,57 @@+// One occurrence of a repeating event is changed or deleted only once Calendar's question is+// answered — "only this event" — and is then sent as that occurrence alone.+import { engine } from "./engine.mjs";+import { SERVICES, installStub, openScreen } from "./stub.mjs";+const b = await engine.launch();+const ctx = await b.newContext({ viewport: { width: 1300, height: 850 } });+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, calendarFixture: true });+const page = await ctx.newPage();+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });+await openScreen(page, "Calendar");+await page.keyboard.press("Control+2");+await page.waitForTimeout(300);+let failures = 0;+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };++await page.locator(".cx-block", { hasText: "Weekly standup" }).first().click();+await page.waitForTimeout(250);+const title = page.locator('input[placeholder="New Event"]').first();+await title.fill("Weekly standup, moved room");+await title.press("Enter");+await page.waitForTimeout(250);+ok((await page.getByRole("alertdialog").count()) === 1, "changing one occurrence asks first");+await page.keyboard.press("Escape");+await page.waitForTimeout(200);+ok((await page.evaluate(() => (window.__eventSaves ?? []).length)) === 0, "Cancel sends nothing");++await page.locator(".cx-block", { hasText: "Weekly standup" }).first().click();+await page.waitForTimeout(250);+await page.locator('input[placeholder="New Event"]').first().fill("Weekly standup, moved room");+await page.locator('input[placeholder="New Event"]').first().press("Enter");+await page.waitForTimeout(250);+await page.getByRole("button", { name: "Only This Event", exact: true }).click();+await page.waitForTimeout(300);+const saved = await page.evaluate(() => window.__eventSaves?.at(-1));+ok(saved?.scope === "this" && saved?.guid === "SERIES__20261020T040000Z", `and "only this event" sends that occurrence alone ${JSON.stringify({ g: saved?.guid, s: saved?.scope })}`);++await page.locator(".cx-block", { hasText: "Weekly standup" }).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 Only This Event" }).click();+await page.waitForTimeout(300);+const del = await page.evaluate(() => window.__eventDeletes?.at(-1));+ok(del?.scope === "this", `deleting one occurrence deletes it alone ${JSON.stringify(del)}`);+// All events: the change goes to the whole series.+await page.locator(".cx-block", { hasText: "Weekly standup" }).first().click();+await page.waitForTimeout(250);+await page.locator('input[placeholder="New Event"]').first().fill("Weekly sync");+await page.locator('input[placeholder="New Event"]').first().press("Enter");+await page.waitForTimeout(250);+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 })}`);+await b.close();+process.exitCode = failures ? 1 : 0;diff --git a/.uiverify/stub.mjs b/.uiverify/stub.mjsindex 7073117..fa406a6 100644--- a/.uiverify/stub.mjs+++ b/.uiverify/stub.mjs@@ -26,6 +26,10 @@ export function installStub({ screen, services, twoFactor, calendarFixture, note{ guid: "e3", calendarGuid: "work", title: "Sprint planning", location: "Room 2",startsAt: base + DAY + 2 * HOUR, endsAt: base + DAY + 3 * HOUR, allDay: false,timezone: "Asia/Kolkata", url: null, notes: null, etag: null },+ // One day of a weekly series, as Apple names an occurrence: the series' id and its start.+ { guid: "SERIES__20261020T040000Z", calendarGuid: "work", title: "Weekly standup", location: null,+ startsAt: base + 2 * HOUR, endsAt: base + 2 * HOUR + 1800, allDay: false,+ timezone: "Asia/Kolkata", url: null, notes: null, etag: null },{ guid: "e4", calendarGuid: "personal", title: "Flight to Hyderabad", location: null,startsAt: base + 3 * DAY, endsAt: base + 4 * DAY, allDay: true,timezone: "Asia/Kolkata", url: null, notes: null, etag: null },@@ -142,7 +146,7 @@ export function installStub({ screen, services, twoFactor, calendarFixture, notecase "calendar_list": return calendars;case "event_alerts": return args.guid === "e2" ? [15] : [];case "event_save": (window.__eventSaves ??= []).push(args.draft); return "E-new";- case "event_delete": return null;+ case "event_delete": (window.__eventDeletes ??= []).push(args); return null;case "calendar_sync": return { calendars: calendars.length, events: events.length };case "reminder_counts": return { today: 4, scheduled: 7, flagged: 2, all: 12, lists: [["L1", 5], ["L2", 3], ["lists", 4]] };case "reminder_lists": return !remindersFixture ? [] : reminderLists;diff --git a/check.sh b/check.shindex 089dd73..92b0deb 100755--- a/check.sh+++ b/check.sh@@ -61,6 +61,7 @@ step "list info" node .uiverify/reminders-list-info.mjsstep "reminder date" node .uiverify/reminders-date.mjsstep "contacts order" node .uiverify/contacts-order.mjsstep "calendar alerts" node .uiverify/calendar-alerts.mjs+step "calendar repeat" node .uiverify/calendar-repeat.mjsstep "reminder add/done" node .uiverify/reminders-add-done.mjsstep "notes formatted" node .uiverify/notes-formatted.mjsstep "notes merge" node .uiverify/notes-merge.mjsdiff --git a/src/lib/ipc.ts b/src/lib/ipc.tsindex feb6345..12c7464 100644--- a/src/lib/ipc.ts+++ b/src/lib/ipc.ts@@ -75,7 +75,7 @@ export const api = {eventSave: (draft: EventWrite) => invoke<string>("event_save", { draft }),eventAlerts: (guid: string) => invoke<number[]>("event_alerts", { guid }),- eventDelete: (guid: string) => invoke<void>("event_delete", { guid }),+ eventDelete: (guid: string, scope?: "this" | "all") => 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. */@@ -228,6 +228,8 @@ export type EventWrite = {/** Set the alerts to exactly these minutes before the start (0 at the time); left out,* the event keeps the alerts Apple holds. */alerts?: number[];+ /** For one occurrence of a repeating event: whether the change is for it alone or the series. */+ scope?: "this" | "all";};export type CalendarEvent = {diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsxindex 52a38bc..0bab93f 100644--- a/src/screens/calendar/CalendarView.tsx+++ b/src/screens/calendar/CalendarView.tsx@@ -367,10 +367,34 @@ export function CalendarView() {[read]);+ /**+ * One occurrence of a repeating event is changed only once the person has said it is for+ * 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);+ useEffect(() => {+ if (!asking) return undefined;+ const onKey = (e: KeyboardEvent) => {+ if (e.key === "Escape") {+ e.stopPropagation();+ asking.answer(null);+ }+ };+ window.addEventListener("keydown", onKey, true);+ 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); } }));+const save = useCallback(- async (d: Draft) =>- write(async () => {+ async (d: Draft) => {+ const occurrence = Boolean(d.guid && d.guid.includes("__"));+ const scope = occurrence ? await whichEvents("change") : null;+ if (occurrence && !scope) return false;+ return write(async () => {await api.eventSave({+ ...(scope ? { scope } : {}),guid: d.guid,calendarGuid: d.calendarGuid,title: d.title.trim() || "New Event",@@ -392,7 +416,8 @@ export function CalendarView() {endsAt: Math.max(d.endsAt, d.startsAt + (d.allDay ? 86_400 : 900)),allDay: d.allDay, notes: d.notes.trim() || null,} : e);- }),+ });+ },[write]);@@ -403,9 +428,19 @@ export function CalendarView() {const remove = useCallback(async (guid: string) => {const gone = events.find((e) => e.guid === guid) ?? null;+ const occurrence = guid.includes("__");+ const scope = occurrence ? await whichEvents("delete") : null;+ if (occurrence && !scope) return;setDraft(null);- if (await write(() => api.eventDelete(guid), (rows) => rows.filter((e) => e.guid !== guid))) {- setUndo(gone);+ // All of a series leaves every one of its days; one, only itself.+ 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)),+ )) {+ // 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.+ if (!occurrence) setUndo(gone);}},[events, write]@@ -783,6 +818,30 @@ export function CalendarView() {/>)}+ {asking && (+ <Portal>+ <div className="modal-veil" onClick={() => asking.answer(null)}>+ <div className="modal-sheet cx-ask" role="alertdialog" aria-label="Repeating event" onClick={(e) => e.stopPropagation()}>+ <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?"}+ </p>+ <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>+ </div>+ </div>+ </div>+ </Portal>+ )}+{undo && (<div className="cx-toast" role="status">Deleted “{undo.title}”diff --git a/src/styles/calendar.css b/src/styles/calendar.cssindex 36c8938..20a5864 100644--- a/src/styles/calendar.css+++ b/src/styles/calendar.css@@ -739,3 +739,9 @@.cx-pane-month { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--separator); }/* With the month in the Day pane, the sidebar's copy would be the same month twice. */.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 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; }