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
Opening an album from its page shows that album at once, never the hidden view behind the page; shared covers load with their cards
Yashwanth Kamireddi7160ca0cf4c2
diff --git a/.uiverify/photos-shared.mjs b/.uiverify/photos-shared.mjsindex 3399185..07ad81c 100644--- a/.uiverify/photos-shared.mjs+++ b/.uiverify/photos-shared.mjs@@ -44,6 +44,35 @@ await page.waitForTimeout(300);ok((await page.locator(".px-albums-page .px-card img").count()) === 0 && (await page.locator(".px-albums-page .px-card svg").count()) === 2, "a cover that won't load gives way to the album's glyph");ok((await page.getByRole("button", { name: "New Shared Album" }).count()) === 0, "no New Shared Album: making one isn't possible from here yet");+// Opened straight after another view — Recently Deleted, as in the recording that found it —+// with Apple slow to answer: not one frame of that view's photos shows before the album's own.+await page.locator(".px-source", { hasText: "Recently Deleted" }).click();+await page.waitForTimeout(400);+await page.locator(".px-source", { hasText: "Shared Albums" }).click();+await page.waitForTimeout(300);+await page.evaluate(() => {+ window.__pageDelay = 150;+ window.__indexDelay = 150;+ window.__seen = new Set();+ window.__titles = new Set();+ const tick = () => {+ if (!document.querySelector(".px-main[data-page]")) {+ for (const t of document.querySelectorAll(".px-tile")) if (t.getClientRects().length) window.__seen.add(t.dataset.id);+ const h = document.querySelector(".px-main h1")?.textContent;+ if (h) window.__titles.add(h);+ }+ if (!window.__stopSeen) requestAnimationFrame(tick);+ };+ requestAnimationFrame(tick);+});+await page.locator(".px-albums-page .px-card", { hasText: "Wallpapers" }).click();+await page.waitForTimeout(700);+const [seen, titles] = await page.evaluate(() => { window.__stopSeen = true; window.__pageDelay = 0; window.__indexDelay = 0; return [[...window.__seen], [...window.__titles]]; });+ok(seen.length > 0 && seen.every((id) => id.startsWith("s")) && JSON.stringify(titles) === '["Wallpapers"]',+ `opening it shows only its own title and photos, never the last view's ${JSON.stringify({ seen, titles })}`);+await page.locator(".px-source", { hasText: "Shared Albums" }).click();+await page.waitForTimeout(300);+// Opened: its photos in the grid, under its name.await page.locator(".px-albums-page .px-card", { hasText: "Wallpapers" }).click();await page.waitForTimeout(350);diff --git a/.uiverify/stub.mjs b/.uiverify/stub.mjsindex 0a4f28c..6038a03 100644--- a/.uiverify/stub.mjs+++ b/.uiverify/stub.mjs@@ -699,7 +699,8 @@ export function installStub({ screen, services, twoFactor, calendarFixture, noteconst order = sortable ? args.order : null;const key = (p) => (order?.by === "added" || (!order && src.view === "recents") ? (p.addedAt ?? p.takenAt) : p.takenAt);if (order) list = [...list].sort((a, b) => (key(b) - key(a)) * (order.oldest ? -1 : 1) || (a.id < b.id ? -1 : 1));- if (cmd === "photos_page") { const from = args.after ? list.findIndex((p) => p.id === args.after.id) + 1 : 0; return list.slice(from, from + args.limit); }+ // A page that takes its time (`__pageDelay` ms), as the real app's does over IPC.+ if (cmd === "photos_page") { if (window.__pageDelay) await new Promise((r) => setTimeout(r, window.__pageDelay)); const from = args.after ? list.findIndex((p) => p.id === args.after.id) + 1 : 0; return list.slice(from, from + args.limit); }(window.__indexReads ??= []).push(src);// A large library's index takes a moment: a test can make it take one.if (window.__indexDelay) await new Promise((r) => setTimeout(r, window.__indexDelay));diff --git a/src/screens/PhotosView.tsx b/src/screens/PhotosView.tsxindex 842a4dc..147b05f 100644--- a/src/screens/PhotosView.tsx+++ b/src/screens/PhotosView.tsx@@ -2913,7 +2913,18 @@ export function PhotosView() {const t = window.setTimeout(() => setSlow(true), 120);return () => window.clearTimeout(t);}, [switching, view, album?.id, searching]);- const waiting = switching && slow;+ /**+ * An album opened from the Albums or Shared Albums page. The view the grid last drew was out+ * of sight behind that page, so keeping it up while the album comes (as a switch between+ * views does, for its first moment) showed something not looked at — Recently Deleted's+ * title and photos for a frame, in a recording of a shared album opening. The album's own+ * title and plain tiles are up at once instead.+ */+ const [fromPage, setFromPage] = useState(false);+ useEffect(() => {+ if (!switching) setFromPage(false);+ }, [switching]);+ const waiting = switching && (slow || fromPage);const shownAs = waiting ? { view, album, query: searching } : drawn;const title = shownAs.query? `“${shownAs.query}”`@@ -3304,6 +3315,10 @@ export function PhotosView() {<SharedAlbumsonError={(m) => setError(m)}onOpen={(a) => {+ // The grid underneath still holds the last view's photos (Recently Deleted, say):+ // let go of first, so they never show for a frame before the album's own.+ setPhotos(null);+ setFromPage(true);setAlbum({ id: `shared:${a.zone}`, name: a.title ?? "Shared Album", position: 0, changeTag: null, shared: a.zone });setAlbumsPage(false);setSharedPage(false);@@ -3360,6 +3375,11 @@ export function PhotosView() {className={`px-card${a.folder ? " is-folder" : ""}`}onClick={() => {if (a.folder) return openFolder(a.id);+ // As a shared album opens: the last view's photos never show first.+ if (album?.id !== a.id) {+ setPhotos(null);+ setFromPage(true);+ }setAlbum(a);setAlbumsPage(false);setSharedPage(false);diff --git a/src/screens/photos/SharedAlbums.tsx b/src/screens/photos/SharedAlbums.tsxindex b06f026..ea53be6 100644--- a/src/screens/photos/SharedAlbums.tsx+++ b/src/screens/photos/SharedAlbums.tsx@@ -23,7 +23,8 @@ function expiry(at: number | null): string | null {function Cover({ id }: { id: string | null }) {const [failed, setFailed] = useState(false);if (!id || failed) return <Users size={34} strokeWidth={1.6} aria-hidden="true" />;- return <img src={pictureSrc(id, "thumb")} alt="" loading="lazy" decoding="async" draggable={false} onError={() => setFailed(true)} />;+ // A few covers, asked for at once: lazily, each came a frame or two after its card (grey first).+ return <img src={pictureSrc(id, "thumb")} alt="" loading="eager" decoding="async" draggable={false} onError={() => setFailed(true)} />;}export function SharedAlbums({ onError, onOpen }: { onError: (message: string) => void; onOpen: (album: SharedAlbum) => void }) {