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.

Reminders date: a day and a Time switch as on the phone, verified live — all day reads back AllDay=1 with no zone, a time AllDay=0 with its zone

Yashwanth Kamireddi4823712a747b
diff --git a/.uiverify/reminders-date.mjs b/.uiverify/reminders-date.mjs
new file mode 100644
index 0000000..5919fe8
--- /dev/null
+++ b/.uiverify/reminders-date.mjs
@@ -0,0 +1,25 @@
+// A reminder's date, as the phone sets one: a day, and a Time switch. Off is all day; on
+// keeps a time. Each is sent as such.
+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 });
+const page = await ctx.newPage();
+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });
+await openScreen(page, "Reminders");
+await page.locator(".rx-list", { hasText: "GYM" }).click();
+await page.waitForTimeout(300);
+let failures = 0;
+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };
+await page.getByRole("button", { name: "Details for Evening run" }).click();
+await page.waitForTimeout(200);
+const sw = page.getByRole("switch", { name: "Time for Evening run" });
+ok((await sw.isChecked()) && (await page.getByLabel("Time of day for Evening run").count()) === 1, "a timed reminder shows its date, the Time switch on, and its time");
+await sw.click();
+await page.waitForTimeout(200);
+const off = await page.evaluate(() => window.__edits?.at(-1));
+const utcMidnight = off && off.dueAt % 86400 === 0;
+ok(off?.allDay === true && utcMidnight, `Time off makes it all day, sent as that day's UTC midnight ${JSON.stringify(off)}`);
+await b.close();
+process.exitCode = failures ? 1 : 0;
diff --git a/.uiverify/stub.mjs b/.uiverify/stub.mjs
index 6c42888..98d2831 100644
--- a/.uiverify/stub.mjs
+++ b/.uiverify/stub.mjs
@@ -151,7 +151,7 @@ export function installStub({ screen, services, twoFactor, calendarFixture, note
case "reminder_delete": return null;
case "reminder_set_done": return null;
case "reminder_set_repeat": return null;
- case "reminder_edit": return null;
+ case "reminder_edit": (window.__edits ??= []).push(args.edit); return null;
case "reminder_list_colour": {
(window.__listColours ??= []).push([args.listGuid, args.colour]);
const hex = { purple: "#C077DB", red: "#FF3B30", blue: "#007AFF" }[args.colour];
diff --git a/check.sh b/check.sh
index d0fb3ec..aac23dc 100755
--- a/check.sh
+++ b/check.sh
@@ -58,6 +58,7 @@ step "drive info" node .uiverify/drive-info.mjs
step "drive delete" node .uiverify/drive-delete.mjs
step "notes folders" node .uiverify/notes-folders.mjs
step "list info" node .uiverify/reminders-list-info.mjs
+step "reminder date" node .uiverify/reminders-date.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/probe/examples/reminder_allday_roundtrip.rs b/probe/examples/reminder_allday_roundtrip.rs
new file mode 100644
index 0000000..6608f57
--- /dev/null
+++ b/probe/examples/reminder_allday_roundtrip.rs
@@ -0,0 +1,23 @@
+//! Live, throwaway list and reminder only: an all-day date, then a timed one, read back.
+use anyhow::{anyhow, Result};
+#[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("ckdatabasews").ok_or_else(|| anyhow!("no ckdatabasews"))?;
+ let (http, p) = (client.http().clone(), client.service_params());
+ use quince_icloud::reminders as r;
+ let list = r::create_list_cloudkit(&http, &root, p.clone(), "Quince all-day test").await?;
+ let guid = r::create_cloudkit(&http, &root, p.clone(), &list, "All-day test").await?;
+ let zc = quince_icloud::cloudkit::ZoneClient::new(&http, &root, "com.apple.reminders", p.clone());
+ let reminder = quince_core::reminders::Reminder { guid: guid.clone(), list_guid: list.clone(), title: "All-day test".into(), ..Default::default() };
+ let show = |rec: &serde_json::Value| format!("AllDay={} DueDate={} TimeZone={}", rec["fields"]["AllDay"]["value"], rec["fields"]["DueDate"]["value"], rec["fields"]["TimeZone"]["value"]);
+ r::edit_cloudkit(&http, &root, p.clone(), &reminder, &r::ReminderEdit { due_at: Some(Some(1_792_195_200)), all_day: Some(true), ..Default::default() }).await?;
+ println!("all day: {}", show(&zc.lookup_record("Reminders", &guid).await?.ok_or_else(|| anyhow!("gone"))?));
+ r::edit_cloudkit(&http, &root, p.clone(), &reminder, &r::ReminderEdit { due_at: Some(Some(1_792_230_000)), ..Default::default() }).await?;
+ println!("timed: {}", show(&zc.lookup_record("Reminders", &guid).await?.ok_or_else(|| anyhow!("gone"))?));
+ r::delete_list_cloudkit(&http, &root, p, &list).await?;
+ println!("test list deleted");
+ Ok(())
+}