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
Reminders: adds, ticks, flags, renames and deletes show at once; the field stays ready for the next
Yashwanth Kamireddi44f1b85fdae4
diff --git a/.uiverify/reminders-instant.mjs b/.uiverify/reminders-instant.mjsnew file mode 100644index 0000000..20c98ec--- /dev/null+++ b/.uiverify/reminders-instant.mjs@@ -0,0 +1,42 @@+// A tap shows at once, as on the phone: adding, ticking and deleting do not wait on Apple.+// The stub holds every write for 1.5 s, as a slow network would.+import { engine } from "./engine.mjs";+import { SERVICES, installStub, openScreen } from "./stub.mjs";++const b = await engine.launch();+const ctx = await b.newContext({ viewport: { width: 1200, height: 800 } });+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null, remindersFixture: true });+await ctx.addInitScript(() => {+ const wrap = () => {+ const t = window.__TAURI_INTERNALS__;+ if (!t || t.__slow) return;+ const inner = t.invoke;+ t.invoke = async (cmd, args) => {+ if (/^reminder_(create|delete|set_done|edit)$/.test(cmd)) await new Promise((r) => setTimeout(r, 1500));+ return inner(cmd, args);+ };+ t.__slow = true;+ };+ wrap(); document.addEventListener("DOMContentLoaded", wrap);+});+const page = await ctx.newPage();+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });+await openScreen(page, "Reminders");+await page.locator(".rx-list", { hasText: "Daily" }).first().click();+await page.waitForTimeout(400);+let failures = 0;+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };++const field = page.getByPlaceholder(/New Reminder/i).first();+await field.fill("Buy milk");+await field.press("Enter");+await page.waitForTimeout(150);+ok(await page.getByRole("checkbox", { name: "Buy milk" }).count() > 0, "a new reminder shows the moment Return is pressed");++const tick = page.getByRole("checkbox", { name: "Plan tomorrow" });+await tick.click();+await page.waitForTimeout(150);+const ticked = (await tick.getAttribute("aria-checked")) === "true";+ok(ticked, "a tick shows at once");+await b.close();+process.exitCode = failures ? 1 : 0;diff --git a/check.sh b/check.shindex 0dd9099..610e6fe 100755--- a/check.sh+++ b/check.sh@@ -49,6 +49,7 @@ step "drive folders" node .uiverify/drive-nav.mjsstep "birthdays in contacts" node .uiverify/contact-birthday.mjsstep "empty today" node .uiverify/reminders-empty.mjsstep "calendar keys" node .uiverify/calendar-keys.mjs+step "reminders instant" node .uiverify/reminders-instant.mjs# The same screens in WebKit, the engine Quince draws in. Chromium above catches most things;# this catches what only WebKit does — pointer capture, blur on removal, its own layout.diff --git a/crates/quince-icloud/src/calendar.rs b/crates/quince-icloud/src/calendar.rsindex f77f8b3..1e54f23 100644--- a/crates/quince-icloud/src/calendar.rs+++ b/crates/quince-icloud/src/calendar.rs@@ -386,7 +386,9 @@ impl<'a> CalendarClient<'a> {// Deleting what is already gone has done what was asked — but only once Apple's// own record confirms it is gone, not on the word of a status code alone.// Measured: an event Apple no longer has answers 404 with an empty ChangeSet.- Err(Error::NotFound) if matches!(self.event_detail(event, &day).await, Ok(None)) => Ok(()),+ Err(Error::NotFound) if matches!(self.event_detail(event, &day).await, Ok(None)) => {+ Ok(())+ }other => other.map(|_| ()),}}@@ -1039,7 +1041,10 @@ mod write_tests {.unwrap().iter().any(|r| r.method == reqwest::Method::POST);- assert!(!wrote, "nothing may be written over an event that could not be read");+ assert!(+ !wrote,+ "nothing may be written over an event that could not be read"+ );}/// Deleting an event Apple no longer has: it answers 404, and its own record confirmsdiff --git a/src/screens/RemindersView.tsx b/src/screens/RemindersView.tsxindex 1fd90a6..1429ef7 100644--- a/src/screens/RemindersView.tsx+++ b/src/screens/RemindersView.tsx@@ -279,19 +279,31 @@ export function RemindersView() {return () => window.clearTimeout(timer);}, [moved]);- /** Every write goes through here: to Apple first, then re-read, so nothing on screen is a guess. */+ const patch = (guid: string, change: Partial<Reminder>) => (rows: Reminder[]) =>+ rows.map((x) => (x.guid === guid ? { ...x, ...change } : x));++ /**+ * Every write goes through here. What it will do shows at once — a tick, a flag, a row+ * gone — the way the phone answers a tap; then it goes to Apple and the list is re-read,+ * so what stays on screen is what Apple kept. Waiting on the network before showing the+ * tap made every add, tick and delete feel a second behind. A refusal re-reads, which+ * puts the row back as it was, and says why.+ */const write = useCallback(async (reminder: Reminder,run: () => Promise<void>,+ predict?: (rows: Reminder[]) => Reminder[],): Promise<Reminder[] | null> => {setBusyGuid(reminder.guid);setError(null);+ if (predict) setItems((rows) => predict(rows));try {await run();return await readItems();} catch (e) {setError(messageOf(e));+ readItems().catch(() => {});return null;} finally {setBusyGuid(null);@@ -307,8 +319,13 @@ export function RemindersView() {*/const toggle = async (r: Reminder) => {const wasOpen = !r.completedAt;- const fresh = await write(r, () =>- api.reminderSetDone(r.guid, r.listGuid, wasOpen),+ const fresh = await write(+ r,+ () => api.reminderSetDone(r.guid, r.listGuid, wasOpen),+ // A repeating one rolls on rather than closing, so only Apple's answer can show it.+ repeatLabel(r) === null+ ? patch(r.guid, { completedAt: wasOpen ? Math.floor(Date.now() / 1000) : null })+ : undefined,);if (!fresh || !wasOpen || repeatLabel(r) === null) return;const after = fresh.find((x) => x.guid === r.guid);@@ -317,15 +334,24 @@ export function RemindersView() {}};const flag = (r: Reminder) =>- write(r, () =>- api.reminderEdit(r.guid, r.listGuid, { flagged: !r.flagged }),+ write(+ r,+ () => api.reminderEdit(r.guid, r.listGuid, { flagged: !r.flagged }),+ patch(r.guid, { flagged: !r.flagged }),);const remove = (r: Reminder) =>- write(r, () => api.reminderDelete(r.guid, r.listGuid));+ write(+ r,+ () => api.reminderDelete(r.guid, r.listGuid),+ // A subtask goes with its parent, as on the phone.+ (rows) => rows.filter((x) => x.guid !== r.guid && x.parentGuid !== r.guid),+ );const rename = (r: Reminder, title: string) =>title.trim() && title.trim() !== r.title- ? write(r, () =>- api.reminderEdit(r.guid, r.listGuid, { title: title.trim() }),+ ? write(+ r,+ () => api.reminderEdit(r.guid, r.listGuid, { title: title.trim() }),+ patch(r.guid, { title: title.trim() }),): Promise.resolve();const setDue = (r: Reminder, value: string) =>@@ -444,11 +470,24 @@ export function RemindersView() {if (!title || !targetListGuid) return;setSyncing(true);setError(null);+ // The row is there the moment Return is pressed, and the field is ready for the next.+ const standIn = `pending:${Date.now()}`;+ setDraft("");+ // Only in the list it goes to: an undated reminder would not stay in Today or Scheduled.+ if (inList) setItems((rows) => [+ ...rows,+ {+ guid: standIn, listGuid: targetListGuid, title, notes: null, dueAt: null,+ completedAt: null, priority: 0, flagged: false, parentGuid: null,+ recurFrequency: null, recurInterval: null, etag: null,+ } as Reminder,+ ]);try {await api.reminderCreate(targetListGuid, title);- setDraft("");await readItems();} catch (err) {+ setItems((rows) => rows.filter((r) => r.guid !== standIn));+ setDraft((d) => d || title);setError(messageOf(err));} finally {setSyncing(false);@@ -795,7 +834,6 @@ export function RemindersView() {aria-label={inList ? `Add a reminder to ${heading}` : `Add a reminder to ${targetList?.title ?? "a list"}`}- disabled={syncing}/>{/* From a built-in view, where it lands is a real choice, so it is shown — but onlyonce something is being typed, not as a permanent control on the screen. */}