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.

Sidebar shows only what works; upgraded libraries re-read Reminders lists

Yashwanth Kamireddi2e11bc1e15b9
diff --git a/.uiverify/a11y.mjs b/.uiverify/a11y.mjs
index a3df07e..3c98ddd 100644
--- a/.uiverify/a11y.mjs
+++ b/.uiverify/a11y.mjs
@@ -91,7 +91,6 @@ const screens = [
} },
{ name: "library", screen: "library", act: async (p) => {
await p.waitForSelector(".sidebar .nav-item");
- await p.click(".nav-toggle"); // audit the expanded state too
} },
{ name: "drive-move", screen: "library", driveItems: [
{ drivewsid: "FOLDER::a", parentId: null, name: "Downloads", extension: null,
diff --git a/.uiverify/assert.mjs b/.uiverify/assert.mjs
index 313f247..7454d89 100644
--- a/.uiverify/assert.mjs
+++ b/.uiverify/assert.mjs
@@ -89,23 +89,19 @@ p.on("pageerror", (e) => errs.push(String(e)));
await p.goto("http://localhost:4173", { waitUntil: "networkidle" });
await p.waitForSelector(".sidebar .nav-item");
-const toggle = await p.textContent(".nav-toggle");
-const count = await p.locator(".sidebar .nav-item").count();
-const first = await p.textContent(".sidebar .nav-item");
-const selected = await p.textContent('.nav-item[aria-current="true"]');
-
-console.log("toggle label :", JSON.stringify(toggle?.trim()));
-console.log("nav items :", count, "(10 primary + 1 toggle expected when collapsed)");
-console.log("first item :", JSON.stringify(first?.trim()));
-console.log("selected :", JSON.stringify(selected?.trim()));
+// The sidebar holds what works, most used first. Apple's thirty-odd services — "CloudKit
+// data", "Push", "Account gateway" — and screens that only said they were not built (Photos,
+// Mail, Find My, Shared albums) were all listed; none of them is anything to use here.
+const names = (await p.locator(".sidebar .nav-item").allInnerTexts()).map((t) => t.trim());
+const selected = (await p.textContent('.nav-item[aria-current="true"]'))?.trim();
+console.log("nav items :", JSON.stringify(names));
console.log("page errors :", errs.length ? errs : "none");
-
-const collapsed = toggle?.includes("Show") && count === 11;
-// Opening on a screen that works beats opening on a placeholder, so selection must land on
-// a built service rather than simply the first one listed.
-const selectsBuilt = selected?.trim() === "Calendar";
-console.log(collapsed ? "PASS collapsed by default" : "FAIL not collapsed by default");
-console.log(selectsBuilt ? "PASS opens on a built screen" : `FAIL opened on ${selected}`);
+const collapsed =
+ JSON.stringify(names) ===
+ JSON.stringify(["Reminders", "Notes", "iCloud Drive", "Calendar", "Contacts"]);
+const selectsBuilt = selected === "Reminders";
+console.log(collapsed ? "PASS the sidebar holds only what works, most used first" : `FAIL the sidebar holds ${JSON.stringify(names)}`);
+console.log(selectsBuilt ? "PASS opens on the first screen" : `FAIL opened on ${selected}`);
// ── Calendar's four scopes each render their own view ─────────────────────────────────
// A scope that only changed a label would pass a screenshot; this checks it changed the view.
@@ -290,7 +286,7 @@ let failures = 0;
{
const page = await ctx.newPage();
await page.goto("http://localhost:4173", { waitUntil: "networkidle" });
- await page.getByRole("button", { name: "iCloud Drive" }).click();
+ await page.locator(".nav-item", { hasText: "iCloud Drive" }).click();
await page.waitForSelector(".drive-rows");
await page.getByRole("button", { name: "New Folder" }).click();
await page.keyboard.type("downloads");
@@ -315,7 +311,7 @@ let failures = 0;
{
const page = await ctx.newPage();
await page.goto("http://localhost:4173", { waitUntil: "networkidle" });
- await page.getByRole("button", { name: "iCloud Drive" }).click();
+ await page.locator(".nav-item", { hasText: "iCloud Drive" }).click();
await page.waitForSelector(".drive-row-hit");
const folderRow = page.locator(".drive-row.is-folder .drive-row-hit").first();
diff --git a/.uiverify/keyboard.mjs b/.uiverify/keyboard.mjs
index da2c746..2412d8e 100644
--- a/.uiverify/keyboard.mjs
+++ b/.uiverify/keyboard.mjs
@@ -215,7 +215,7 @@ const focused = (page) =>
// --- the pop-up button: one tab stop, arrows move, Escape leaves it alone ---
{
const { ctx, page } = await open("library");
- await page.getByRole("button", { name: "Reminders" }).click();
+ await page.getByRole("button", { name: "Reminders", exact: true }).click();
await page.waitForSelector(".rx-rows li");
// Open a reminder's details, where the pickers live.
diff --git a/.uiverify/shots.mjs b/.uiverify/shots.mjs
index daf3546..942b7b1 100644
--- a/.uiverify/shots.mjs
+++ b/.uiverify/shots.mjs
@@ -224,9 +224,9 @@ const shots = [
await p.waitForSelector(".help", { timeout: 5000 });
} },
{ name: "07-calendar", screen: "library", theme: "light", calendarFixture: true,
- act: async (p) => { await p.waitForSelector(".cal-grid"); } },
+ act: async (p) => { await p.locator(".nav-item", { hasText: "Calendar" }).click(); await p.waitForSelector(".cal-grid"); } },
{ name: "08-calendar-dark", screen: "library", theme: "dark", calendarFixture: true,
- act: async (p) => { await p.waitForSelector(".cal-grid"); } },
+ act: async (p) => { await p.locator(".nav-item", { hasText: "Calendar" }).click(); await p.waitForSelector(".cal-grid"); } },
// The window is often half a screen, where four columns do not fit.
{ name: "09-notes-narrow", screen: "library", theme: "dark", notesFixture: true,
viewport: { width: 958, height: 1038 },
@@ -288,7 +288,7 @@ const shots = [
} },
{ name: "17-calendar-wide", screen: "library", theme: "dark", calendarFixture: true,
viewport: { width: 1920, height: 1080 },
- act: async (p) => { await p.waitForSelector(".cal-grid"); } },
+ act: async (p) => { await p.locator(".nav-item", { hasText: "Calendar" }).click(); await p.waitForSelector(".cal-grid"); } },
{ name: "18-drive-move", screen: "library", theme: "dark", driveFixture: true,
act: async (p) => {
await p.click('.nav-item:has-text("iCloud Drive")');
diff --git a/crates/quince-core/src/lib.rs b/crates/quince-core/src/lib.rs
index dc8a0d0..0720d3a 100644
--- a/crates/quince-core/src/lib.rs
+++ b/crates/quince-core/src/lib.rs
@@ -123,6 +123,30 @@ mod tests {
);
}
+ /// A library from before lists kept their look reads every list again once, or lists no
+ /// one had touched would never get their colour and group. Only Reminders is reset.
+ #[test]
+ fn an_upgraded_library_reads_its_reminders_lists_whole() {
+ let dir = tempfile::tempdir().unwrap();
+ {
+ let conn = rusqlite::Connection::open(dir.path().join("library.db")).unwrap();
+ for migration in &schema::MIGRATIONS[..21] {
+ conn.execute_batch(migration).unwrap();
+ }
+ conn.pragma_update(None, "user_version", 21).unwrap();
+ conn.execute_batch(
+ "INSERT INTO sync_state (service, token) VALUES ('reminders', 'old'), ('notes', 'kept');",
+ )
+ .unwrap();
+ }
+ let library = Library::open(dir.path()).unwrap();
+ assert_eq!(library.sync_token("reminders").unwrap(), None);
+ assert_eq!(
+ library.sync_token("notes").unwrap().as_deref(),
+ Some("kept")
+ );
+ }
+
#[test]
fn opening_twice_does_not_re_run_migrations() {
let dir = tempfile::tempdir().unwrap();
diff --git a/crates/quince-core/src/schema.rs b/crates/quince-core/src/schema.rs
index c6eb088..07d82a8 100644
--- a/crates/quince-core/src/schema.rs
+++ b/crates/quince-core/src/schema.rs
@@ -321,4 +321,14 @@ pub const MIGRATIONS: &[&str] = &[
r#"
ALTER TABLE reminder_lists ADD COLUMN reminder_order TEXT;
"#,
+ // 22 — read every reminders list again, once.
+ //
+ // 20 and 21 added what a list looks like and how it orders its reminders, but a library
+ // made before them only ever asks Apple what changed since its last pass — and a list
+ // nobody has touched never changes, so its new columns stayed empty and it kept drawing
+ // as a white dot with its colour stored as raw JSON. Forgetting the position makes the
+ // next pass a whole one, which fills them in.
+ r#"
+ UPDATE sync_state SET token = NULL WHERE service = 'reminders';
+ "#,
];
diff --git a/src/screens/Library.tsx b/src/screens/Library.tsx
index 109ecaf..89c16fa 100644
--- a/src/screens/Library.tsx
+++ b/src/screens/Library.tsx
@@ -8,110 +8,69 @@ import { NotesView } from "./NotesView";
import { ContactsView } from "./ContactsView";
import { DriveView } from "./DriveView";
-const NAMES: Record<string, string> = {
- photos: "Photos",
- sharedlibrary: "Shared library",
- sharedstreams: "Shared albums",
- photosupload: "Photo upload",
- calendar: "Calendar",
- contacts: "Contacts",
- contactsweb: "Contacts (web)",
- reminders: "Reminders",
- notes: "Notes",
- mail: "Mail",
- premiummailsettings: "Mail settings",
- drivews: "iCloud Drive",
- docws: "Documents",
- ubiquity: "Drive (legacy)",
- archivews: "Archives",
- ckdatabasews: "CloudKit data",
- cksharews: "CloudKit sharing",
- ckdeviceservice: "CloudKit devices",
- findme: "Find My",
- keyvalue: "App data",
- account: "Account",
- settings: "Account settings",
- iwmb: "iWork",
- iworkexportws: "iWork export",
- iworkthumbnailws: "iWork previews",
- uploadimagews: "Image upload",
- geows: "Location",
- push: "Push",
- mpp: "Private Relay",
- mcc: "Account services",
- mccgateway: "Account gateway",
- developerapi: "Developer",
- schoolwork: "Schoolwork",
-};
-
-/** Services with a real screen behind them. Opening on one of these beats opening on a
- * placeholder, so selection prefers them. */
-const BUILT = new Set([
- "calendar",
- "reminders",
- "notes",
- "contacts",
- "drivews",
-]);
-
-/** What a person actually came for, in the order they'd look for it. */
-const PRIMARY = [
- "photos",
- "calendar",
- "reminders",
- "notes",
- "contacts",
- "drivews",
- "mail",
- "findme",
- "sharedlibrary",
- "sharedstreams",
+/**
+ * What the sidebar holds: the services with a real screen behind them, most used first.
+ *
+ * Apple advertises thirty-odd services for an account — "CloudKit data", "Push", "Account
+ * gateway" — and they were all listed, behind "Show 23 more", along with Photos, Mail and Find
+ * My, which opened onto a page saying they were not built. None of that is something a person
+ * can use here, so none of it is shown. A service joins this list when it works.
+ */
+const SCREENS: { key: string; name: string }[] = [
+ { key: "reminders", name: "Reminders" },
+ { key: "notes", name: "Notes" },
+ { key: "drivews", name: "iCloud Drive" },
+ { key: "calendar", name: "Calendar" },
+ { key: "contacts", name: "Contacts" },
];
+/** The screen open last time, so the app reopens where it was left. */
+const LAST_KEY = "quince.library.screen";
+
export function Library({ onSignOut }: { onSignOut: () => void }) {
const [services, setServices] = useState<string[]>([]);
const [selected, setSelected] = useState<string | null>(null);
- const [showAll, setShowAll] = useState(false);
const [error, setError] = useState<string | null>(null);
+ const [ready, setReady] = useState(false);
useEffect(() => {
api
.services()
.then((list) => {
- // Apple advertises several keys that resolve to the same surface; show each once.
- const seen = new Set<string>();
- const unique = list.filter((k) => {
- const label = NAMES[k] ?? k;
- if (seen.has(label)) return false;
- seen.add(label);
- return true;
- });
- setServices(unique);
- setSelected(
- PRIMARY.find((k) => unique.includes(k) && BUILT.has(k)) ??
- PRIMARY.find((k) => unique.includes(k)) ??
- unique[0] ??
- null,
- );
+ const offered = SCREENS.map((s) => s.key).filter((k) => list.includes(k));
+ setServices(offered);
+ let last: string | null = null;
+ try {
+ last = window.localStorage.getItem(LAST_KEY);
+ } catch {
+ // Without storage it opens on the first screen, which is fine.
+ }
+ setSelected(last && offered.includes(last) ? last : (offered[0] ?? null));
+ setReady(true);
})
.catch((e) => setError(messageOf(e)));
}, []);
- const primary = PRIMARY.filter((k) => services.includes(k));
- // Everything else is infrastructure — real, but not something anyone navigates to.
- const rest = services.filter((k) => !PRIMARY.includes(k));
+ const choose = (key: string) => {
+ setSelected(key);
+ try {
+ window.localStorage.setItem(LAST_KEY, key);
+ } catch {
+ // Remembering is a convenience; choosing still works.
+ }
+ };
// Native sidebars move with the arrow keys and occupy a single tab stop. Without this a
// keyboard user has to Tab through every row to reach the content.
const rows = useRef<(HTMLButtonElement | null)[]>([]);
- const order = showAll ? [...primary, ...rest] : primary;
+ const order = services;
function onKeyDown(e: React.KeyboardEvent, index: number) {
const move = (to: number) => {
e.preventDefault();
const clamped = Math.max(0, Math.min(to, order.length - 1));
rows.current[clamped]?.focus();
- setSelected(order[clamped]);
+ choose(order[clamped]);
};
if (e.key === "ArrowDown") move(index + 1);
else if (e.key === "ArrowUp") move(index - 1);
@@ -131,9 +90,9 @@ export function Library({ onSignOut }: { onSignOut: () => void }) {
aria-current={selected === key}
tabIndex={selected === key ? 0 : -1}
onKeyDown={(e) => onKeyDown(e, index)}
- onClick={() => setSelected(key)}
+ onClick={() => choose(key)}
>
- <span>{NAMES[key] ?? key}</span>
+ <span>{SCREENS.find((s) => s.key === key)?.name ?? key}</span>
</button>
);
};
@@ -143,22 +102,12 @@ export function Library({ onSignOut }: { onSignOut: () => void }) {
<div className="library enter-library">
<nav className="sidebar" aria-label="Your iCloud">
<h2>Your iCloud</h2>
- {primary.map(item)}
- {services.length === 0 && !error && <p className="badge">Loading…</p>}
-
- {rest.length > 0 && (
- <>
- <button
- className="nav-item nav-toggle"
- aria-expanded={showAll}
- onClick={() => setShowAll((v) => !v)}
- >
- <span>
- {showAll ? "Hide" : "Show"} {rest.length} more
- </span>
- </button>
- {showAll && rest.map(item)}
- </>
+ {services.map(item)}
+ {!ready && !error && <p className="badge">Loading…</p>}
+ {error && (
+ <p className="error" role="alert">
+ {error}
+ </p>
)}
<div className="sidebar-foot">
@@ -181,28 +130,13 @@ export function Library({ onSignOut }: { onSignOut: () => void }) {
) : selected === "drivews" ? (
<DriveView />
) : (
- <>
- <h1>
- {selected ? (NAMES[selected] ?? selected) : "You're signed in"}
- </h1>
- <p>
- Quince is holding a live session with Apple, and it survived
- quitting and reopening the app — no password, no code. The list
- on the left is what Apple reports for your account, nothing
- invented.
- </p>
- <p>
- Reading this into a local library is what comes next, so it
- opens instantly and works offline. Until then this screen tells
- you the truth: the connection works, the data layer isn't built
- yet.
+ ready &&
+ services.length === 0 && (
+ <p className="cal-empty">
+ Apple hasn’t offered Reminders, Notes, iCloud Drive, Calendar or Contacts to
+ this account yet.
</p>
- {error && (
- <p className="error" role="alert">
- {error}
- </p>
- )}
- </>
+ )
)}
</main>
</div>
diff --git a/src/screens/RemindersView.tsx b/src/screens/RemindersView.tsx
index 9d53a1d..2d8b9ff 100644
--- a/src/screens/RemindersView.tsx
+++ b/src/screens/RemindersView.tsx
@@ -23,7 +23,8 @@ const SMART: { kind: SmartList; title: string; glyph: GlyphName; colour: string
];
/** A list's own colour, or Apple's blue for one that has none. */
-const colourOf = (list: ReminderList | undefined | null) => list?.colour || "var(--sys-blue)";
+const colourOf = (list: ReminderList | undefined | null) =>
+ list?.colour && /^#[0-9a-f]{6}$/i.test(list.colour) ? list.colour : "var(--sys-blue)";
/** Groups the viewer has folded shut, remembered on this computer. */
const FOLDED_KEY = "quince.reminders.folded";
diff --git a/src/styles/reminders.css b/src/styles/reminders.css
index 87381ee..7e4b63b 100644
--- a/src/styles/reminders.css
+++ b/src/styles/reminders.css
@@ -126,8 +126,10 @@
white-space: nowrap;
}
-.rx-tile[aria-current="true"] { background: var(--tile); color: #fff; }
-.rx-tile[aria-current="true"] .rx-tile-glyph { background: #fff; color: var(--tile); }
+/* A shade under the tile's own colour, so white type on it reads at 4.5:1 — the colour
+ Apple's Increase Contrast setting draws these in. */
+.rx-tile[aria-current="true"] { background: color-mix(in srgb, var(--tile) 82%, #000); color: #fff; }
+.rx-tile[aria-current="true"] .rx-tile-glyph { background: #fff; color: color-mix(in srgb, var(--tile) 82%, #000); }
.rx-tile[aria-current="true"] .rx-tile-name { color: #fff; }
/* On the same left edge as the list badges beneath it, where a source list puts a heading. */