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.

Photos: Shared Albums, page-drawn fades, glide zoom, decode-first stepping, Apple icons

Yashwanth Kamireddi4f4fc99ebbab
diff --git a/.uiverify/photos-burst-live.mjs b/.uiverify/photos-burst-live.mjs
index 690f0a7..52e775b 100644
--- a/.uiverify/photos-burst-live.mjs
+++ b/.uiverify/photos-burst-live.mjs
@@ -62,13 +62,23 @@ await page.locator('.px-tile[data-id="p4"]').dblclick();
await page.waitForTimeout(600);
const live = page.getByRole("button", { name: "Play Live Photo" });
ok((await live.count()) === 1 && /LIVE/.test(await live.innerText()), "a Live Photo is marked LIVE");
+const place = await page.evaluate(() => {
+ const m = document.querySelector(".px-mark").getBoundingClientRect(), p = document.querySelector(".px-pan").getBoundingClientRect();
+ return { dx: Math.round(m.left - p.left), dy: Math.round(m.top - p.top) };
+});
+ok(place.dx >= 4 && place.dx <= 20 && place.dy >= 4 && place.dy <= 20, `LIVE sits on the photo's own top-left corner (${JSON.stringify(place)} from it)`);
await live.hover();
await page.waitForTimeout(200);
const v = page.locator(".px-pan video.px-live");
ok((await v.count()) === 1 && (await v.getAttribute("src")) === `${base}/p4/video`, `resting on LIVE plays its moving part over the still ${await v.getAttribute("src").catch(() => "")}`);
+await page.keyboard.press("z");
+await page.waitForTimeout(400);
+ok((await page.getByRole("button", { name: "Play Live Photo" }).count()) === 0, "zoomed in, the mark is not over the picture");
+await page.keyboard.press("z");
+await page.waitForTimeout(400);
await page.keyboard.press("ArrowRight");
await page.waitForTimeout(250);
-ok((await page.locator("video.px-live").count()) === 0, "and it stops when the photo changes");
+ok((await page.locator("video.px-live").count()) === 0, "and the moving part stops when the photo changes");
await b.close();
server.close();
process.exitCode = failures ? 1 : (process.exitCode ?? 0);
diff --git a/.uiverify/photos-jump.mjs b/.uiverify/photos-jump.mjs
index 9374818..e1a2da8 100644
--- a/.uiverify/photos-jump.mjs
+++ b/.uiverify/photos-jump.mjs
@@ -21,8 +21,19 @@ await page.waitForTimeout(500);
let failures = 0;
const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };
-await page.getByRole("button", { name: "Go to a Month" }).click();
-await page.waitForTimeout(250);
+const pick = await page.evaluate(() => new Promise((resolve) => {
+ const seen = [];
+ const t0 = performance.now();
+ const tick = () => {
+ const d = document.querySelector(".px-jump");
+ if (d) seen.push(Number(getComputedStyle(d).opacity));
+ if (performance.now() - t0 < 350) requestAnimationFrame(tick); else resolve({ seen, engine: document.querySelector(".px-jump")?.getAnimations({ subtree: true }).length ?? 0 });
+ };
+ document.querySelector('[aria-label="Go to a Month"]').click();
+ requestAnimationFrame(tick);
+}));
+ok(pick.seen.length > 0 && pick.seen[0] < 0.6 && pick.seen.at(-1) === 1 && pick.engine === 0,
+ `the month picker fades in, drawn by the page — never whole for a frame first, never the engine's animation (first frame ${pick.seen[0]?.toFixed(2)}, last ${pick.seen.at(-1)}, engine ${pick.engine})`);
const dialog = page.getByRole("dialog", { name: "Go to a month" });
ok((await dialog.count()) === 1, "the calendar button opens the month picker");
ok(JSON.stringify(await dialog.getByRole("tab").allInnerTexts()) === JSON.stringify(["2026", "2025"]), `years down the side, newest first ${await dialog.getByRole("tab").allInnerTexts()}`);
diff --git a/.uiverify/photos-loading.mjs b/.uiverify/photos-loading.mjs
index b7b4a56..8443424 100644
--- a/.uiverify/photos-loading.mjs
+++ b/.uiverify/photos-loading.mjs
@@ -46,5 +46,22 @@ const boxed = await page.evaluate(() => new Promise((resolve) => {
[...document.querySelectorAll(".px-source")].find((e) => /Library/.test(e.textContent)).click();
}));
ok(!boxed, "a view that comes quickly never shows the boxes — nothing flashes");
+// Switching views settles in with a short fade drawn by the page (never the compositor's, which
+// glitched on his screen): part-shown at first, whole within a moment, nothing the engine animates.
+const fade = await page.evaluate(() => new Promise((resolve) => {
+ const scroll = document.querySelector(".px-scroll");
+ const seen = [];
+ let engine = 0;
+ const t0 = performance.now();
+ const tick = () => {
+ seen.push(Number(getComputedStyle(scroll).opacity));
+ engine = Math.max(engine, scroll.getAnimations({ subtree: true }).filter((a) => a.playState === "running").length);
+ if (performance.now() - t0 < 400) requestAnimationFrame(tick); else resolve({ seen, engine });
+ };
+ [...document.querySelectorAll(".px-source")].find((e) => /Favorites/.test(e.textContent)).click();
+ requestAnimationFrame(tick);
+}));
+ok(Math.min(...fade.seen) >= 0.3 && Math.min(...fade.seen) < 1 && fade.seen.at(-1) === 1 && fade.engine === 0,
+ `a view settles in with a short fade — never from nothing, whole within a moment, none of it the engine's (min ${Math.min(...fade.seen).toFixed(2)}, last ${fade.seen.at(-1)}, engine ${fade.engine})`);
await b.close();
process.exitCode = failures ? 1 : (process.exitCode ?? 0);
diff --git a/.uiverify/photos-real.mjs b/.uiverify/photos-real.mjs
index f026ea3..c8faf31 100644
--- a/.uiverify/photos-real.mjs
+++ b/.uiverify/photos-real.mjs
@@ -63,7 +63,16 @@ await page.keyboard.press("Escape");
await page.locator(".px-tile").nth(1).dblclick();
await page.waitForTimeout(500);
-ok(/full/.test((await page.locator(".px-sharp").getAttribute("src")) ?? ""), "an opened photo fetches the whole picture at once, not only when zoomed");
+// The picture made for the stage's own size (fit<N>), never smaller than the stage draws it —
+// sharp from the first frame; the whole file only once zoomed in, where its pixels are seen.
+{
+ const { src, long } = await page.locator(".px-shown").evaluate((img) => {
+ const r = img.getBoundingClientRect();
+ return { src: img.getAttribute("data-picture") ?? "", long: Math.max(r.width, r.height) * devicePixelRatio };
+ });
+ const n = Number(/fit(\d+)/.exec(src)?.[1] ?? 0);
+ ok(n >= Math.min(long, 3840) - 1, `an opened photo is shown from a picture at least the stage's size (fit${n} for ${Math.round(long)}px)`);
+}
// Media types as icloud.com lists them: only the kinds the library has — a panorama appears
// once there is one (Apple's assetSubtypeV2 1); no empty ones.
ok((await page.locator(".px-source", { hasText: "Panoramas" }).count()) === 0, "no Panoramas in the sidebar while there are none");
diff --git a/.uiverify/photos-shared.mjs b/.uiverify/photos-shared.mjs
new file mode 100644
index 0000000..2f4c921
--- /dev/null
+++ b/.uiverify/photos-shared.mjs
@@ -0,0 +1,60 @@
+// Sharing, as icloud.com lists it: Shared Albums from Apple's own service — empty, a new one
+// named in a sheet and on the page at once, deleted from its menu after asking; a refusal puts
+// things back and says why.
+import { engine } from "./engine.mjs";
+import { SERVICES, installStub, openScreen } from "./stub.mjs";
+const b = await engine.launch();
+const ctx = await b.newContext({ viewport: { width: 1280, height: 800 } });
+await ctx.addInitScript(installStub, { screen: "library", services: SERVICES, twoFactor: null });
+await ctx.addInitScript(() => { window.__shared = [{ guid: "J1", name: "Family", createdAt: 1790000000, owned: false, public: false, contributions: true }]; });
+const page = await ctx.newPage();
+page.on("pageerror", (e) => { console.log(`FAIL page error: ${e.message}`); process.exitCode = 1; });
+await page.goto("http://localhost:4173", { waitUntil: "networkidle" });
+await openScreen(page, "Photos");
+await page.waitForTimeout(400);
+let failures = 0;
+const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };
+const cards = () => page.locator(".px-albums-page .px-card").allInnerTexts();
+
+await page.locator(".px-source", { hasText: "Shared Albums" }).click();
+await page.waitForTimeout(300);
+ok((await page.locator(".px-albums-page h1").innerText()) === "Shared Albums" && (await page.locator(".px-tile:visible").count()) === 0, "Sharing → Shared Albums opens its page in place of the photos");
+ok((await page.locator(".px-source", { hasText: "Library" }).getAttribute("aria-current")) !== "true" && (await page.locator(".px-source", { hasText: "Shared Albums" }).getAttribute("aria-current")) === "true",
+ "and the sidebar marks it, not the view before");
+ok(/Family[\s\S]*Shared with you/.test((await cards()).join()), `an album shared with this account says so ${JSON.stringify(await cards())}`);
+
+await page.getByRole("button", { name: "New Shared Album" }).first().click();
+await page.waitForTimeout(200);
+await page.getByLabel("Album Name").fill("Beach Trip");
+await page.keyboard.press("Enter");
+await page.waitForTimeout(250);
+ok(/Beach Trip[\s\S]*Shared by you/.test((await cards())[0] ?? "") && (await page.getByRole("dialog", { name: "New Shared Album" }).count()) === 0, "a new one, named in a sheet, is on the page at once — shared by you");
+ok(await page.evaluate(() => window.__shared.some((a) => a.name === "Beach Trip")), "and made at Apple");
+
+// Deleted from its menu, after asking.
+await page.locator(".px-albums-page .px-card", { hasText: "Beach Trip" }).click({ button: "right" });
+await page.locator(".row-menu").getByText("Delete Shared Album").click();
+ok(/everyone it is shared with/.test(await page.locator(".px-ask").innerText()), "deleting asks first, saying it goes for everyone");
+await page.locator(".px-ask .is-act").click();
+await page.waitForTimeout(250);
+ok(!(await cards()).join().includes("Beach Trip") && !(await page.evaluate(() => window.__shared.some((a) => a.name === "Beach Trip"))), "and it is gone, here and at Apple");
+// One shared with this account cannot be deleted from here.
+await page.locator(".px-albums-page .px-card", { hasText: "Family" }).click({ button: "right" });
+ok((await page.locator(".row-menu").getByText("Delete Shared Album").count()) === 0, "one shared with you offers no delete — only its owner can");
+await page.keyboard.press("Escape");
+
+// Apple refuses: the new one goes again, and the reason is said.
+await page.evaluate(() => { window.__sharedFail = true; });
+await page.getByRole("button", { name: "New Shared Album" }).first().click();
+await page.getByLabel("Album Name").fill("Nope");
+await page.keyboard.press("Enter");
+await page.waitForTimeout(300);
+ok(!(await cards()).join().includes("Nope") && /refused/.test(await page.locator(".notice").innerText().catch(() => "")), "a refusal takes it back and says why");
+await page.evaluate(() => { window.__sharedFail = false; });
+
+// Back to the library.
+await page.locator(".px-source", { hasText: "Library" }).click();
+await page.waitForTimeout(300);
+ok((await page.locator(".px-albums-page").count()) === 0 && (await page.locator(".px-tile:visible").count()) > 0, "Library brings the photos back");
+await b.close();
+process.exitCode = failures ? 1 : (process.exitCode ?? 0);
diff --git a/.uiverify/photos-show.mjs b/.uiverify/photos-show.mjs
index b749c2b..d25468e 100644
--- a/.uiverify/photos-show.mjs
+++ b/.uiverify/photos-show.mjs
@@ -38,12 +38,17 @@ await page.waitForTimeout(150);
await page.keyboard.press("ArrowLeft");
await page.waitForTimeout(150);
ok((await count()) === "2 of 5", "and the left back");
-// The one leaving dissolves away above the next (never left whole behind it), then is gone.
+// The next dissolves in over the one leaving (drawn frame by frame by the page, never the
+// compositor's), the leaving one still beneath it, then gone.
await page.keyboard.press("ArrowRight");
await page.waitForTimeout(250);
-const mid = await page.locator(".px-slide.is-leaving").evaluate((e) => Number(getComputedStyle(e).opacity)).catch(() => -1);
+const mid = await page.evaluate(() => {
+ const a = document.querySelector(".px-slide:not(.is-leaving)"), l = document.querySelector(".px-slide.is-leaving");
+ return { arriving: Number(getComputedStyle(a).opacity), leaving: l ? Number(getComputedStyle(l).opacity) : -1, engine: document.querySelector(".px-show").getAnimations({ subtree: true }).length };
+});
await page.waitForTimeout(900);
-ok(mid > 0 && mid < 1 && (await page.locator(".px-slide.is-leaving").count()) === 0, `the photo leaving fades out over the next, then goes (opacity ${mid.toFixed?.(2)} mid-way)`);
+ok(mid.arriving > 0 && mid.arriving < 1 && mid.leaving === 1 && mid.engine === 0 && (await page.locator(".px-slide.is-leaving").count()) === 0,
+ `the next dissolves in over the one leaving, none of it the engine's, then the old one goes ${JSON.stringify(mid)}`);
await page.keyboard.press("ArrowLeft");
await page.waitForTimeout(150);
await page.keyboard.press("Escape");
diff --git a/.uiverify/photos-strip.mjs b/.uiverify/photos-strip.mjs
index 4c44e78..b2efe10 100644
--- a/.uiverify/photos-strip.mjs
+++ b/.uiverify/photos-strip.mjs
@@ -25,7 +25,7 @@ const centred = () => page.evaluate(() => {
await page.locator(".px-tile").nth(40).dblclick();
await page.waitForTimeout(800);
-ok((await page.locator(".px-slip").count()) <= 61 && (await page.locator(".px-slip").count()) > 20, `only the nearest slips are built (${await page.locator(".px-slip").count()} of 2000)`);
+ok((await page.locator(".px-slip").count()) <= 2 * Math.max(30, Math.ceil(1280 / 28 / 2) + 12) + 1 && (await page.locator(".px-slip").count()) > 20, `only the nearest slips are built (${await page.locator(".px-slip").count()} of 2000)`);
ok((await centred()) <= 1, "the shown photo's slip sits in the middle");
await page.locator(".px-slip").nth(25).click();
await page.waitForTimeout(700);
@@ -35,7 +35,7 @@ ok(shown.split("pic%2F")[1]?.split("%2F")[0] === slip.split("pic%2F")[1]?.split(
ok((await centred()) <= 1, "and the strip glides to keep it in the middle");
for (let i = 0; i < 40; i++) await page.keyboard.press("ArrowRight");
await page.waitForTimeout(700);
-ok((await centred()) <= 1 && (await page.locator(".px-slip").count()) <= 61, "stepping far along, still in the middle and still few");
+ok((await centred()) <= 1 && (await page.locator(".px-slip").count()) <= 2 * Math.max(30, Math.ceil(1280 / 28 / 2) + 12) + 1, "stepping far along, still in the middle and still few");
// A wheel or a two-finger swipe over the strip skims: four notches of 40 go four photos on,
// and the slips glide on the compositor, never jump.
const which = async () => (await page.locator(".px-slip.is-shown img").getAttribute("src")).split("pic%2F")[1].split("%2F")[0];
diff --git a/.uiverify/photos.mjs b/.uiverify/photos.mjs
index 4268e57..5f60c11 100644
--- a/.uiverify/photos.mjs
+++ b/.uiverify/photos.mjs
@@ -192,6 +192,10 @@ const scaleOf = () => page.locator(".px-pan").evaluate((el) => new DOMMatrix(get
await page.locator(".px-pan").dblclick({ position: { x: 40, y: 40 } });
await page.waitForTimeout(400); // the zoom glides
ok((await scaleOf()) > 2, `double-click zooms in ×${(await scaleOf()).toFixed(2)}`);
+ok(await page.locator(".px-pan").evaluate((p) => {
+ const cs = getComputedStyle(p);
+ return cs.willChange === "auto" && cs.transitionDuration.split(",").every((d) => parseFloat(d) === 0) && !/matrix3d|translate3d/.test(p.style.transform) && p.getAnimations().length === 0;
+}), "zooming is drawn by the page: no transition, no will-change, no 3D layer, no compositor animation (each flickered)");
ok(/full/.test((await page.locator(".px-sharp").getAttribute("src")) ?? ""), "and the full picture is laid over");
await page.keyboard.press("Escape");
await page.waitForTimeout(400); // the zoom glides
diff --git a/.uiverify/stub.mjs b/.uiverify/stub.mjs
index 9c6ecd2..e1094a9 100644
--- a/.uiverify/stub.mjs
+++ b/.uiverify/stub.mjs
@@ -331,6 +331,18 @@ export function installStub({ screen, services, twoFactor, calendarFixture, note
return answer;
}
case "photos_prepare": (window.__prepared ??= []).push(args.shown); return null;
+ case "photos_shared_albums": return [...(window.__shared ??= [])];
+ case "photos_shared_create": {
+ if (window.__sharedFail) throw "Shared Albums refused that (503).";
+ const guid = `S-${(window.__shared ??= []).length + 1}`;
+ window.__shared.unshift({ guid, name: args.name, createdAt: 1792500000, owned: true, public: false, contributions: true });
+ return guid;
+ }
+ case "photos_shared_delete": {
+ if (window.__sharedFail) throw "Shared Albums refused that (503).";
+ window.__shared = (window.__shared ?? []).filter((a) => a.guid !== args.guid);
+ return null;
+ }
case "photos_burst": {
// Three shots; the library's own photo is the chosen one, in the middle.
const pick = (window.__photos ?? []).find((p) => p.burst === args.burst);
diff --git a/crates/quince-icloud/src/lib.rs b/crates/quince-icloud/src/lib.rs
index 8504797..62ff3fb 100644
--- a/crates/quince-icloud/src/lib.rs
+++ b/crates/quince-icloud/src/lib.rs
@@ -16,6 +16,7 @@ pub mod photos;
pub mod photos_upload;
pub mod push;
pub mod reminders;
+pub mod shared_albums;
pub mod sync;
pub mod table;
pub mod topotext;
diff --git a/crates/quince-icloud/src/shared_albums.rs b/crates/quince-icloud/src/shared_albums.rs
new file mode 100644
index 0000000..302b508
--- /dev/null
+++ b/crates/quince-icloud/src/shared_albums.rs
@@ -0,0 +1,189 @@
+//! Shared Albums, as icloud.com keeps them: not CloudKit but the `sharedstreams` web service.
+//! Every call is `POST {sharedstreams}/{dsid}/sharedstreams/{endpoint}` with a JSON body sent as
+//! plain text (icloud.com's own way, `main.js:20440`), the session's cookies and query params.
+//! Mapped and proven live on throwaways (probe/examples/shared_album_roundtrip.rs; see
+//! docs/icloud-web/photos.md).
+
+use crate::{Error, Result};
+use serde_json::{json, Value};
+
+/// A shared album, as its list gives it.
+#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct SharedAlbum {
+ pub guid: String,
+ pub name: String,
+ /// When it was made, unix seconds.
+ pub created_at: Option<i64>,
+ /// Made by this account (`sharingtype` "owned"), as against one it was invited to.
+ pub owned: bool,
+ /// Anyone with its link can see it (`ispublic`).
+ pub public: bool,
+ /// Those invited can add photos too (`allowcontributions`).
+ pub contributions: bool,
+}
+
+/// The service, for one signed-in account.
+pub struct SharedStreams<'a> {
+ pub http: &'a reqwest::Client,
+ /// The `sharedstreams` service's address, as the session gives it.
+ pub root: &'a str,
+ pub params: &'a [(String, String)],
+}
+
+impl SharedStreams<'_> {
+ fn dsid(&self) -> Result<&str> {
+ self.params
+ .iter()
+ .find(|(k, _)| k == "dsid")
+ .map(|(_, v)| v.as_str())
+ .ok_or_else(|| Error::Protocol("the session has no dsid".into()))
+ }
+
+ async fn call(&self, endpoint: &str, body: Value) -> Result<Value> {
+ let url = format!(
+ "{}/{}/sharedstreams/{endpoint}",
+ self.root.trim_end_matches('/'),
+ self.dsid()?
+ );
+ let r = self
+ .http
+ .post(&url)
+ .query(self.params)
+ .header("content-type", "text/plain;charset=UTF-8")
+ .body(body.to_string())
+ .send()
+ .await?;
+ let status = r.status();
+ let text = r.text().await?;
+ if status.as_u16() == 401 || status.as_u16() == 450 {
+ return Err(Error::ReauthRequired);
+ }
+ if !status.is_success() {
+ return Err(Error::Refused(format!(
+ "Shared Albums refused that ({status})."
+ )));
+ }
+ // Some answers are a bare word ("OK") rather than JSON.
+ Ok(serde_json::from_str(&text).unwrap_or(Value::String(text)))
+ }
+
+ /// Every shared album this account has, made or joined, newest first.
+ pub async fn list(&self) -> Result<Vec<SharedAlbum>> {
+ let v = self.call("webgetalbumslist", json!({})).await?;
+ let mut out: Vec<SharedAlbum> = v["albums"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .filter_map(album_of)
+ .collect();
+ out.sort_by(|a, b| b.created_at.cmp(&a.created_at).then(a.name.cmp(&b.name)));
+ Ok(out)
+ }
+
+ /// A new shared album, as icloud.com makes one: its own id chosen here (upper-case UUID), the
+ /// people it is for able to add photos. Answers its id.
+ pub async fn create(&self, name: &str) -> Result<String> {
+ let guid = uuid::Uuid::new_v4().to_string().to_uppercase();
+ let v = self
+ .call("createalbum", json!({ "albumguid": guid, "attributes": { "name": name, "allowcontributions": "1" } }))
+ .await?;
+ if v["albumguid"].as_str() != Some(guid.as_str()) {
+ return Err(Error::Protocol(
+ "Shared Albums did not say the album was made".into(),
+ ));
+ }
+ Ok(guid)
+ }
+
+ /// A shared album deleted, for everyone it was shared with. `"OK"` is Apple's answer.
+ pub async fn delete(&self, guid: &str) -> Result<()> {
+ let v = self
+ .call("deletealbum", json!({ "albumguid": guid }))
+ .await?;
+ if v.as_str()
+ .is_some_and(|s| s.trim().eq_ignore_ascii_case("ok"))
+ || v.is_object()
+ {
+ Ok(())
+ } else {
+ Err(Error::Protocol(format!("Shared Albums answered {v}")))
+ }
+ }
+}
+
+fn album_of(a: &Value) -> Option<SharedAlbum> {
+ let attr = &a["attributes"];
+ let on = |k: &str| attr[k].as_str() == Some("1");
+ Some(SharedAlbum {
+ guid: a["albumguid"].as_str()?.to_string(),
+ name: attr["name"].as_str().unwrap_or("Shared Album").to_string(),
+ created_at: attr["creationDate"].as_i64().map(|ms| ms / 1000),
+ owned: a["sharingtype"].as_str() == Some("owned"),
+ public: on("ispublic"),
+ contributions: on("allowcontributions"),
+ })
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use wiremock::matchers::{body_string_contains, header, method, path};
+ use wiremock::{Mock, MockServer, ResponseTemplate};
+
+ fn params() -> Vec<(String, String)> {
+ vec![
+ ("dsid".into(), "42".into()),
+ ("clientId".into(), "c".into()),
+ ]
+ }
+
+ #[tokio::test]
+ async fn lists_makes_and_deletes_as_icloud_com_does() {
+ let server = MockServer::start().await;
+ Mock::given(method("POST"))
+ .and(path("/42/sharedstreams/webgetalbumslist"))
+ .and(header("content-type", "text/plain;charset=UTF-8"))
+ .respond_with(ResponseTemplate::new(200).set_body_json(json!({ "albums": [
+ { "albumguid": "A", "sharingtype": "owned", "attributes": { "name": "Trip", "creationDate": 2000000, "allowcontributions": "1", "ispublic": "0" } },
+ { "albumguid": "B", "sharingtype": "subscribed", "attributes": { "name": "Family", "creationDate": 3000000, "ispublic": "1" } }
+ ] })))
+ .mount(&server)
+ .await;
+ Mock::given(method("POST"))
+ .and(path("/42/sharedstreams/createalbum"))
+ .and(body_string_contains("\"name\":\"Beach\""))
+ .respond_with(|req: &wiremock::Request| {
+ let body: Value = serde_json::from_slice(&req.body).unwrap();
+ ResponseTemplate::new(200)
+ .set_body_json(json!({ "albumguid": body["albumguid"], "albumctag": "x" }))
+ })
+ .mount(&server)
+ .await;
+ Mock::given(method("POST"))
+ .and(path("/42/sharedstreams/deletealbum"))
+ .and(body_string_contains("\"albumguid\":\"A\""))
+ .respond_with(ResponseTemplate::new(200).set_body_string("OK"))
+ .mount(&server)
+ .await;
+ let http = reqwest::Client::new();
+ let p = params();
+ let s = SharedStreams {
+ http: &http,
+ root: &server.uri(),
+ params: &p,
+ };
+ let list = s.list().await.unwrap();
+ assert_eq!(
+ list.iter().map(|a| a.name.as_str()).collect::<Vec<_>>(),
+ vec!["Family", "Trip"],
+ "newest first"
+ );
+ assert!(list[1].owned && list[1].contributions && !list[1].public);
+ assert!(!list[0].owned && list[0].public);
+ assert_eq!(list[1].created_at, Some(2000));
+ let guid = s.create("Beach").await.unwrap();
+ assert!(guid.len() == 36 && guid == guid.to_uppercase());
+ s.delete("A").await.unwrap();
+ }
+}
diff --git a/probe/examples/shared_albums_module_live.rs b/probe/examples/shared_albums_module_live.rs
new file mode 100644
index 0000000..ade0b3e
--- /dev/null
+++ b/probe/examples/shared_albums_module_live.rs
@@ -0,0 +1,35 @@
+//! Live, a throwaway only: Quince's own shared-albums client — a shared album made, found in the
+//! list, deleted, and the list read again to see it gone. No one is invited.
+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("sharedstreams")
+ .ok_or_else(|| anyhow!("no sharedstreams"))?;
+ let params = client.service_params();
+ let http = client.http().clone();
+ let s = quince_icloud::shared_albums::SharedStreams {
+ http: &http,
+ root: &root,
+ params: &params,
+ };
+ let before = s.list().await?;
+ println!("before: {} shared albums", before.len());
+ let guid = s.create("Quince module probe").await?;
+ let listed = s.list().await?.into_iter().find(|a| a.guid == guid);
+ println!("made and listed: {listed:?}");
+ anyhow::ensure!(listed
+ .as_ref()
+ .is_some_and(|a| a.owned && a.contributions && a.name == "Quince module probe"));
+ s.delete(&guid).await?;
+ let gone = !s.list().await?.iter().any(|a| a.guid == guid);
+ println!("deleted, gone from the list: {gone}");
+ anyhow::ensure!(gone);
+ Ok(())
+}
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 7291e98..85fe60c 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -3877,6 +3877,9 @@ fn main() {
photos::photo_play,
photos::photos_set_flag,
photos::photos_burst,
+ photos::photos_shared_albums,
+ photos::photos_shared_create,
+ photos::photos_shared_delete,
photos::photos_prepare,
video::video_base,
window_tint,
diff --git a/src-tauri/src/photos.rs b/src-tauri/src/photos.rs
index 8a412f8..7e3d00a 100644
--- a/src-tauri/src/photos.rs
+++ b/src-tauri/src/photos.rs
@@ -573,6 +573,61 @@ pub async fn photos_list(view: View, data: State<'_, Data>) -> UiResult<Vec<Phot
data.0.lock().await.photos(view).map_err(|e| e.to_string())
}
+/// The Shared Albums service for the signed-in account: its client, address and params.
+async fn shared_streams(
+ auth: &State<'_, Auth>,
+) -> Result<(reqwest::Client, String, Vec<(String, String)>), String> {
+ let client = auth.client.lock().await;
+ let root = client
+ .session()
+ .service_url("sharedstreams")
+ .ok_or("Apple hasn't offered Shared Albums for this account.")?;
+ Ok((client.http().clone(), root, client.service_params()))
+}
+
+/// Every shared album the account has, made or joined, newest first — read from Apple each time
+/// (there are few, and a list kept here would go stale as people are invited and leave).
+#[tauri::command]
+pub async fn photos_shared_albums(
+ auth: State<'_, Auth>,
+) -> UiResult<Vec<quince_icloud::shared_albums::SharedAlbum>> {
+ let (http, root, params) = shared_streams(&auth).await?;
+ let s = quince_icloud::shared_albums::SharedStreams {
+ http: &http,
+ root: &root,
+ params: &params,
+ };
+ s.list().await.map_err(|e| e.to_string())
+}
+
+/// A new shared album, named; answers its id.
+#[tauri::command]
+pub async fn photos_shared_create(name: String, auth: State<'_, Auth>) -> UiResult<String> {
+ let name = name.trim();
+ if name.is_empty() {
+ return Err("A shared album needs a name.".into());
+ }
+ let (http, root, params) = shared_streams(&auth).await?;
+ let s = quince_icloud::shared_albums::SharedStreams {
+ http: &http,
+ root: &root,
+ params: &params,
+ };
+ s.create(name).await.map_err(|e| e.to_string())
+}
+
+/// A shared album deleted, for everyone it was shared with.
+#[tauri::command]
+pub async fn photos_shared_delete(guid: String, auth: State<'_, Auth>) -> UiResult<()> {
+ let (http, root, params) = shared_streams(&auth).await?;
+ let s = quince_icloud::shared_albums::SharedStreams {
+ http: &http,
+ root: &root,
+ params: &params,
+ };
+ s.delete(&guid).await.map_err(|e| e.to_string())
+}
+
/// Every photo of one burst, in the order they were shot — what "View all" shows.
#[tauri::command]
pub async fn photos_burst(burst: String, data: State<'_, Data>) -> UiResult<Vec<Photo>> {
diff --git a/src/components/AppIcon.tsx b/src/components/AppIcon.tsx
index 1ecbdee..9f02493 100644
--- a/src/components/AppIcon.tsx
+++ b/src/components/AppIcon.tsx
@@ -2,16 +2,41 @@ import { useId } from "react";
import { dateText } from "../lib/when";
/**
- * Each screen's mark in the sidebar, drawn after the app it stands in for — Reminders' three
- * coloured dots, Notes' yellow pad, Drive's blue folder, Calendar's day tile, Contacts' card —
- * so a row is found by its picture before its name is read.
+ * Each screen's mark in the sidebar, so a row is found by its picture before its name is read.
*
- * Drawn here, not Apple's artwork, which is Apple's to ship. Like icloud.com's launcher they
- * come in two finishes: a light tile, and in dark mode the deep graphite tile Apple's dark
- * icons sit on, with a soft top light and a hairline edge so they read as objects, not
- * flat stickers. Vector, so they are crisp at any scale on any desktop.
+ * Photos, Reminders, Notes, iCloud Drive and Contacts are Apple's own icons, light and dark,
+ * as icloud.com shows them — his choice (2026-10-20), for his own copy of Quince; they are
+ * Apple's artwork, not to be published with the code. Made 22 and 44 pixels with a Lanczos
+ * resample, never shrunk by the engine (WebKitGTK shrinks a large picture crudely). Calendar
+ * stays drawn here, as icloud.com draws it: its weekday and date are today's, which a fixed
+ * picture could not be. The rest, below, are vector marks in two finishes — a light tile, and
+ * the deep graphite tile Apple's dark icons sit on.
*/
+const pictures = import.meta.glob("../assets/app-icons/*.png", { eager: true, import: "default" }) as Record<string, string>;
+const picture = (name: string) => pictures[`../assets/app-icons/${name}.png`];
+const APPLE: Record<string, string> = { photos: "photos", reminders: "reminders", notes: "notes", drivews: "drive", contacts: "contacts" };
+
export function AppIcon({ app, size = 22 }: { app: string; size?: number }) {
+ const apple = APPLE[app];
+ if (apple) {
+ const one = (finish: "light" | "dark") => (
+ <img
+ className={`ai-${finish}`}
+ src={picture(`${apple}-${finish}@1x`)}
+ srcSet={`${picture(`${apple}-${finish}@1x`)} 1x, ${picture(`${apple}-${finish}@2x`)} 2x`}
+ width={size}
+ height={size}
+ alt=""
+ draggable={false}
+ />
+ );
+ return (
+ <span className={`app-icon app-icon-apple ai-${app}`} style={{ width: size, height: size, flex: "none" }} aria-hidden="true">
+ {one("light")}
+ {one("dark")}
+ </span>
+ );
+ }
const id = useId().replace(/:/g, "");
const today = new Date();
const s = { width: size, height: size, flex: "none" } as const;
@@ -117,20 +142,21 @@ export function AppIcon({ app, size = 22 }: { app: string; size?: number }) {
);
break;
case "photos":
- // Photos' flower: eight petals turning about the centre, each its own colour, where
- // they overlap the colours mix as the light petals of Apple's icon do.
+ // Photos' flower: eight petals turning about the centre, each its own colour — the
+ // colours read off Apple's own icon, clockwise from the top: orange, yellow, lime, green,
+ // blue, lavender, pink, coral — and where two overlap they darken together, multiplied,
+ // as Apple's do (orange over yellow a deep orange, yellow over lime an olive).
art = (
<g style={{ isolation: "isolate" }}>
- {["#ff9f0a", "#ffd60a", "#a4d65e", "#30c48d", "#3aa8f0", "#5e5ce6", "#bf5af2", "#ff375f"].map((c, k) => (
+ {["#ffa31c", "#ffcd00", "#90d300", "#00ce74", "#00a7ec", "#9981d8", "#fe6aab", "#ff5e64"].map((c, k) => (
<rect
key={c}
- x="11.55"
- y="3.1"
- width="4.3"
- height="8.6"
- rx="2.15"
+ x="9.15"
+ y="2.2"
+ width="5.7"
+ height="8.5"
+ rx="2.85"
fill={c}
- opacity="0.9"
style={{ mixBlendMode: "multiply" }}
transform={`rotate(${k * 45} 12 12)`}
/>
diff --git a/src/lib/fade.ts b/src/lib/fade.ts
new file mode 100644
index 0000000..bd6bd49
--- /dev/null
+++ b/src/lib/fade.ts
@@ -0,0 +1,52 @@
+/**
+ * A fade drawn by the page itself, one frame at a time.
+ *
+ * Every animation WebKitGTK handed to its compositor (CSS transitions and animations, the Web
+ * Animations API) glitched on his screen under Hyprland: frames where the element was drawn as
+ * if the animation had not started or had already ended. This one is never handed over — each
+ * frame the page sets the element's opacity itself and the engine simply paints it — so there
+ * is no hand-over to go wrong. Kept short, and only ever on opacity.
+ */
+const running = new WeakMap<HTMLElement, number>();
+
+export function fadeIn(el: HTMLElement | null, { from = 0, duration = 150 }: { from?: number; duration?: number } = {}) {
+ if (!el) return;
+ if (typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
+ el.style.opacity = "";
+ return;
+ }
+ cancelAnimationFrame(running.get(el) ?? 0);
+ const start = performance.now();
+ el.style.opacity = String(from);
+ const step = (now: number) => {
+ const t = Math.min(1, (now - start) / duration);
+ // Ease out: most of the change early, settling gently.
+ const k = 1 - (1 - t) * (1 - t);
+ if (t >= 1) {
+ el.style.opacity = "";
+ running.delete(el);
+ return;
+ }
+ el.style.opacity = String(from + (1 - from) * k);
+ running.set(el, requestAnimationFrame(step));
+ };
+ running.set(el, requestAnimationFrame(step));
+}
+
+/**
+ * Every sheet, as it is added anywhere in the app, fades in this way — set before the first frame
+ * is painted (a mutation observer runs before painting), so none shows whole for a frame first.
+ * The full-window dims behind them simply appear: a large surface is never animated.
+ */
+export function fadeSheetsIn() {
+ const sheets = ".modal-sheet, .px-sheet";
+ new MutationObserver((changes) => {
+ for (const change of changes) {
+ for (const node of change.addedNodes) {
+ if (!(node instanceof HTMLElement)) continue;
+ if (node.matches(sheets)) fadeIn(node, { duration: 140 });
+ node.querySelectorAll<HTMLElement>(sheets).forEach((el) => fadeIn(el, { duration: 140 }));
+ }
+ }
+ }).observe(document.body, { childList: true, subtree: true });
+}
diff --git a/src/lib/ipc.ts b/src/lib/ipc.ts
index 7a72a4c..b2c0fa7 100644
--- a/src/lib/ipc.ts
+++ b/src/lib/ipc.ts
@@ -102,6 +102,10 @@ export const api = {
/** What the window shows pictures at, so the app makes them before they are shown. */
photosPrepare: (shown: { cell: number; fit: boolean; stageW: number; stageH: number; dpr: number }) =>
invoke<void>("photos_prepare", { shown }),
+ /** Shared albums, made or joined, newest first — from Apple each time. */
+ photosSharedAlbums: () => invoke<SharedAlbum[]>("photos_shared_albums"),
+ photosSharedCreate: (name: string) => invoke<string>("photos_shared_create", { name }),
+ photosSharedDelete: (guid: string) => invoke<void>("photos_shared_delete", { guid }),
/** Every photo of one burst, in the order they were shot. */
photosBurst: (burst: string) => invoke<Photo[]>("photos_burst", { burst }),
/** Favorite, Delete (to Recently Deleted) or Recover; answers the photo as Apple now has it. */
@@ -597,6 +601,17 @@ export function fitSrc(id: string, long: number): string {
return convertFileSrc(`pic/${id}/fit${step}`, "quince");
}
+/** A shared album (Apple's sharedstreams service). */
+export type SharedAlbum = {
+ guid: string;
+ name: string;
+ createdAt: number | null;
+ /** Made by this account, as against one it was invited to. */
+ owned: boolean;
+ public: boolean;
+ contributions: boolean;
+};
+
export type PhotoAlbum = {
id: string;
name: string;
diff --git a/src/main.tsx b/src/main.tsx
index e677fe7..3349316 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -9,10 +9,12 @@ import "./styles/notes.css";
import "./styles/photos.css";
import { applyTheme, storedTheme } from "./lib/theme";
import { keepTinted } from "./lib/tint";
+import { fadeSheetsIn } from "./lib/fade";
// Before the first paint, so the window opens in the appearance chosen.
applyTheme(storedTheme());
keepTinted();
+fadeSheetsIn();
/*
* Every link goes the one way out: as a navigation, which the window refuses and hands to
diff --git a/src/screens/PhotosView.tsx b/src/screens/PhotosView.tsx
index d0554cf..43945b0 100644
--- a/src/screens/PhotosView.tsx
+++ b/src/screens/PhotosView.tsx
@@ -7,7 +7,7 @@ import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useStat
import { listen } from "@tauri-apps/api/event";
import { getCurrentWebview } from "@tauri-apps/api/webview";
import { open as openFileDialog } from "@tauri-apps/plugin-dialog";
-import { ChevronLeft, ChevronRight, CopyMinus, CopyPlus, Download, Clock, Heart, ImagePlus, Images, Info, Minus, Play, Plus, RotateCcw, Scan, Trash2, EyeOff, ArrowDownUp, MonitorPlay, Square, RectangleHorizontal, Star, Layers, Search as SearchIcon, Folder as FolderIcon, Aperture, Video, X, CalendarDays, Maximize2, Minimize2, type LucideIcon } from "lucide-react";
+import { ChevronLeft, ChevronRight, CopyMinus, CopyPlus, Download, Clock, Heart, ImagePlus, Images, Info, Minus, Play, Plus, RotateCcw, Scan, Trash2, EyeOff, ArrowDownUp, MonitorPlay, Square, RectangleHorizontal, Star, Layers, Search as SearchIcon, Folder as FolderIcon, Aperture, Video, X, CalendarDays, Maximize2, Minimize2, Users, type LucideIcon } from "lucide-react";
import {
api,
messageOf,
@@ -28,7 +28,9 @@ import { Slideshow } from "./photos/Slideshow";
import { useAsk } from "./photos/Ask";
import { VideoPlayer } from "./photos/VideoPlayer";
import { JumpTo, type MonthCover } from "./photos/JumpTo";
+import { SharedAlbums } from "./photos/SharedAlbums";
import { tintFrom } from "../lib/tint";
+import { fadeIn } from "../lib/fade";
import { DownloadOptions, type Want } from "./photos/DownloadOptions";
import { AdjustDate } from "./photos/AdjustDate";
@@ -131,8 +133,12 @@ const SHOWN = 54;
const GAP = 2;
const REACH = 30;
function Filmstrip({ photos, at, onPick }: { photos: Photo[]; at: number; onPick: (index: number) => void }) {
- const from = Math.max(0, at - REACH);
- const to = Math.min(photos.length - 1, at + REACH);
+ // Enough either side to fill the window's width and more, so a slip is always built (and its
+ // picture decoded) before it can be seen: built at the edge of the screen, slips came in
+ // blank and filled in as each step was taken.
+ const reach = Math.max(REACH, Math.ceil(window.innerWidth / (SLIP + GAP) / 2) + 12);
+ const from = Math.max(0, at - reach);
+ const to = Math.min(photos.length - 1, at + reach);
// Each slip has its place by its index in the whole library, so the slips built as the
// window moves along never jump; the strip is placed to put the shown one's centre in the middle.
const shift = -(at * (SLIP + GAP) + SHOWN / 2);
@@ -151,7 +157,9 @@ function Filmstrip({ photos, at, onPick }: { photos: Photo[]; at: number; onPick
onClick={() => i !== at && onPick(i)}
>
{/* At once, never lazily: a slip coming into the strip showed empty for a moment. */}
- <img src={fitSrc(p.id, (i === at ? SHOWN : SLIP * 2) * (window.devicePixelRatio || 1))} alt="" decoding="async" draggable={false} />
+ {/* One size for every slip, shown or not, so a step never asks for a new picture; decoded
+ before it is drawn (they are small), so none appears blank first. */}
+ <img src={fitSrc(p.id, SHOWN * 2 * (window.devicePixelRatio || 1))} alt="" decoding="sync" draggable={false} />
</button>,
);
}
@@ -424,6 +432,8 @@ export function PhotosView() {
const [albums, setAlbums] = useState<[PhotoAlbum, number, (string | null)?][]>([]);
/** The Albums page open: every album as a card with its cover, as icloud.com's. */
const [albumsPage, setAlbumsPage] = useState(false);
+ /** The Shared Albums page open (Sharing, in the sidebar). */
+ const [sharedPage, setSharedPage] = useState(false);
// Which of the sidebar's branches are open — Albums and Media Types — kept on this machine.
const [branches, setBranches] = useState<{ albums: boolean; media: boolean }>(() => {
try {
@@ -571,6 +581,25 @@ export function PhotosView() {
}, [photos, sort?.by, drawn]);
const shown = open !== null ? photos?.[open] ?? null : null;
+ /**
+ * The photo whose picture is on the stage. A step changes `shown` at once (its date, its
+ * place, its info) but the picture changes only once the next one is decoded — at once when
+ * it already is, as the photos either side are made to be — so a step never shows a blank or
+ * the soft thumbnail before the sharp picture: the flicker on every switch.
+ */
+ const [pictured, setPictured] = useState<Photo | null>(null);
+ useLayoutEffect(() => {
+ if (!shown) return setPictured(null);
+ if (shown.kind === "video" || decoded.has(viewSrc(shown))) return setPictured(shown);
+ let live = true;
+ const take = () => live && setPictured(shown);
+ void warm(shown).then(take);
+ const t = window.setTimeout(take, 250);
+ return () => {
+ live = false;
+ window.clearTimeout(t);
+ };
+ }, [shown?.id]); // eslint-disable-line react-hooks/exhaustive-deps
// The viewer follows the photo, not its place: when the list moves under it — its date
// changed, a sync reordered the library — it finds the photo again rather than showing
// whichever came to stand where it was.
@@ -716,26 +745,46 @@ export function PhotosView() {
const lensRef = useRef({ k: 1, x: 0, y: 0 });
const [zoomed, setZoomed] = useState(false);
const pan = useRef<HTMLDivElement | null>(null);
- const settle = useRef<number | undefined>(undefined);
const frame = useRef<number | null>(null);
+ // What is on the screen now, and a glide on its way to the lens.
+ const drawn_ = useRef({ k: 1, x: 0, y: 0 });
+ const gliding = useRef<number | null>(null);
+ /**
+ * The lens drawn by the page itself, once a frame: never a CSS transition, never will-change,
+ * never a 3D transform. Each of those hands the picture to WebKitGTK's compositor (a layer
+ * made as a zoom began and dropped as it ended), and on his screen that flickered — 88
+ * frames in one recording of zooming. A double-click's or a key's zoom glides over a moment,
+ * stepped from here; a pinch or a drag follows the hand directly.
+ */
+ const draw = (l: { k: number; x: number; y: number }) => {
+ drawn_.current = l;
+ const el = pan.current;
+ if (el) el.style.transform = l.k > 1 || l.x || l.y ? `translate(${l.x}px, ${l.y}px) scale(${l.k})` : "";
+ };
const paint = (next: { k: number; x: number; y: number }, glide = false) => {
lensRef.current = next;
setZoomed(next.k > 1);
+ if (gliding.current !== null) {
+ cancelAnimationFrame(gliding.current);
+ gliding.current = null;
+ }
+ const still = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
+ if (glide && !still) {
+ const from = drawn_.current;
+ const start = performance.now();
+ const step = (now: number) => {
+ const t = Math.min(1, (now - start) / 220);
+ const e = 1 - (1 - t) ** 3;
+ draw({ k: from.k + (next.k - from.k) * e, x: from.x + (next.x - from.x) * e, y: from.y + (next.y - from.y) * e });
+ gliding.current = t < 1 ? requestAnimationFrame(step) : null;
+ };
+ gliding.current = requestAnimationFrame(step);
+ return;
+ }
if (frame.current !== null) return;
frame.current = requestAnimationFrame(() => {
frame.current = null;
- const el = pan.current;
- if (!el) return;
- const { k, x, y } = lensRef.current;
- // Its own layer only while it moves — moved as one bitmap — and drawn afresh, sharp at
- // the new size, once it rests.
- el.style.willChange = "transform";
- el.style.transition = glide ? "transform 280ms var(--spring-smooth, ease-out)" : "none";
- el.style.transform = k > 1 ? `translate3d(${x}px, ${y}px, 0) scale(${k})` : "";
- window.clearTimeout(settle.current);
- settle.current = window.setTimeout(() => {
- if (pan.current) pan.current.style.willChange = "";
- }, glide ? 340 : 160);
+ draw(lensRef.current);
});
};
const viewBurst = async (p: Photo) => {
@@ -858,6 +907,14 @@ export function PhotosView() {
h: el.clientHeight - parseFloat(cs.paddingTop) - parseFloat(cs.paddingBottom),
};
if (shown && shown.kind !== "video") setStep(viewSrc(shown));
+ // Where the photo itself sits on the stage, for the marks laid on its corner (LIVE,
+ // BURST): read a frame later, once the picture has its box.
+ requestAnimationFrame(() => {
+ const p = el.querySelector<HTMLElement>(".px-pan, .px-video");
+ if (!p) return;
+ el.style.setProperty("--photo-x", `${p.offsetLeft}px`);
+ el.style.setProperty("--photo-y", `${p.offsetTop}px`);
+ });
};
measure();
const watch = new ResizeObserver(measure);
@@ -1758,9 +1815,17 @@ export function PhotosView() {
? (album?.id === shownAs.album.id ? album.name : shownAs.album.name)
: [...VIEWS, ...MEDIA, ...UTILITIES].find((v) => v.key === shownAs.view)?.label ?? "Photos";
const waitingFor = waiting ? Math.min(84, album ? (albums.find(([a]) => a.id === album.id)?.[1] ?? 21) : (counts[view] ?? 21)) : 0;
- // A view arrives at its top, not wherever the last one was scrolled to.
+ // A view arrives at its top, not wherever the last one was scrolled to — and settles in with a
+ // short fade (drawn frame by frame by the page, never the compositor's, which glitched on his
+ // screen), from part-shown so there is never an empty moment between the two.
+ const firstDraw = useRef(true);
useLayoutEffect(() => {
if (scroller.current) scroller.current.scrollTop = 0;
+ if (firstDraw.current) {
+ firstDraw.current = false;
+ return;
+ }
+ fadeIn(scroller.current, { from: 0.35, duration: 160 });
}, [drawn]);
const across = ACROSS[zoom];
// A cell's width in device pixels, for the size each tile's picture is made at; in steps of
@@ -1903,6 +1968,7 @@ export function PhotosView() {
onClick={() => {
setAlbum(a);
setAlbumsPage(false);
+ setSharedPage(false);
endSearch();
setOpen(null);
}}
@@ -1939,11 +2005,12 @@ export function PhotosView() {
<button
key={v.key}
className="px-source"
- aria-current={!album && !albumsPage && view === v.key}
+ aria-current={!album && !albumsPage && !sharedPage && view === v.key}
onClick={() => {
setView(v.key);
setAlbum(null);
setAlbumsPage(false);
+ setSharedPage(false);
endSearch();
setOpen(null);
}}
@@ -1972,6 +2039,7 @@ export function PhotosView() {
aria-current={albumsPage && folderPage === null}
onClick={() => {
setAlbumsPage(true);
+ setSharedPage(false);
setFolderPage(null);
endSearch();
setOpen(null);
@@ -2004,10 +2072,26 @@ export function PhotosView() {
</div>
)}
{UTILITIES.map(source)}
+ {/* Sharing, as icloud.com lists it: the shared albums this account has made or joined. */}
+ <p className="px-side-heading px-side-gap">Sharing</p>
+ <button
+ className="px-source"
+ aria-current={sharedPage}
+ onClick={() => {
+ setSharedPage(true);
+ setAlbumsPage(false);
+ endSearch();
+ setOpen(null);
+ }}
+ >
+ <Users className="px-glyph" size={16} strokeWidth={1.8} aria-hidden="true" />
+ <span className="px-label">Shared Albums</span>
+ </button>
</aside>
- <section className="px-main" aria-label={albumsPage ? "Albums" : title} data-page={albumsPage ? "albums" : undefined}>
- {albumsPage && (
+ <section className="px-main" aria-label={sharedPage ? "Shared Albums" : albumsPage ? "Albums" : title} data-page={albumsPage || sharedPage ? "albums" : undefined}>
+ {sharedPage && <SharedAlbums ask={ask} onError={(m) => setError(m)} />}
+ {albumsPage && !sharedPage && (
<div className="px-albums-page">
{(() => {
// This page's level: the top, or a folder's own albums and folders.
@@ -2058,6 +2142,7 @@ export function PhotosView() {
if (a.folder) return openFolder(a.id);
setAlbum(a);
setAlbumsPage(false);
+ setSharedPage(false);
}}
{...dropTarget(a)}
data-drop={dropOn === a.id || undefined}
@@ -2428,26 +2513,33 @@ export function PhotosView() {
>
{/* The picture made the size the stage draws it at — every pixel used, none
thrown away by the engine — over the thumbnail until it is decoded. */}
+ {/* The picture on the stage is `pictured`'s: the next one takes its place
+ only once decoded (see pictured). */}
+ {(() => {
+ const pic = pictured && pictured.kind !== "video" ? pictured : shown;
+ return (
<img
- key={shown.id}
+ key={pic.id}
className="px-shown"
- src={viewSrc(shown)}
+ src={viewSrc(pic)}
// What was asked for, kept whatever the fallback below does to `src`.
- data-picture={viewSrc(shown)}
- alt={shown.filename ?? ""}
+ data-picture={viewSrc(pic)}
+ alt={pic.filename ?? ""}
decoding="async"
draggable={false}
- style={fitted(shown)}
+ style={fitted(pic)}
// Never the engine's broken-picture box (a white frame, a question mark, the
// file's name): a picture that will not come falls back to the thumbnail,
// and past that shows nothing over the thumbnail already painted under it.
onError={(e) => {
const img = e.currentTarget;
- const thumb = pictureSrc(shown.id, "thumb");
+ const thumb = pictureSrc(pic.id, "thumb");
if (!img.src.includes("thumb")) img.src = thumb;
else img.dataset.failed = "";
}}
/>
+ );
+ })()}
{moving === shown.id && videoBase && (
// The moving part, laid exactly over the still, played once and gone.
<video
@@ -2470,7 +2562,10 @@ export function PhotosView() {
aria-hidden="true"
decoding="async"
draggable={false}
- onLoad={(e) => e.currentTarget.classList.add("is-in")}
+ onLoad={(e) => {
+ e.currentTarget.classList.add("is-in");
+ fadeIn(e.currentTarget, { duration: 160 });
+ }}
/>
)}
</div>
@@ -2478,7 +2573,7 @@ export function PhotosView() {
{/* What kind of photo it is, as Photos marks it at the stage's corner: a Live
Photo plays its moving part while the pointer rests on LIVE; a burst's BURST
goes through all of it. */}
- {shown.kind === "live" && videoBase && (
+ {shown.kind === "live" && videoBase && !zoomed && (
<button
className={`px-mark${moving === shown.id ? " is-on" : ""}`}
aria-label="Play Live Photo"
@@ -2494,7 +2589,7 @@ export function PhotosView() {
LIVE
</button>
)}
- {shown.burst && (shown.burstCount ?? 0) > 1 && !inBurst && (
+ {shown.burst && (shown.burstCount ?? 0) > 1 && !inBurst && !zoomed && (
<button className="px-mark" aria-label={`View all ${shown.burstCount} photos in this burst`} onClick={() => void viewBurst(shown)}>
<Layers size={13} aria-hidden="true" />
BURST
diff --git a/src/screens/photos/JumpTo.tsx b/src/screens/photos/JumpTo.tsx
index 349e92a..a047373 100644
--- a/src/screens/photos/JumpTo.tsx
+++ b/src/screens/photos/JumpTo.tsx
@@ -3,9 +3,10 @@
* year's months as tiles with a photo from each, in the calendar's order. A tile takes the grid
* to that month. Only months the library has photos in are offered.
*/
-import { useEffect, useMemo, useRef, useState } from "react";
+import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { fitSrc, type Photo } from "../../lib/ipc";
import { Portal } from "../../components/Portal";
+import { fadeIn } from "../../lib/fade";
export type MonthCover = { label: string; year: number; month: number; cover: Photo };
@@ -32,6 +33,9 @@ export function JumpTo({
const box = useRef<HTMLDivElement | null>(null);
const shown = months.filter((m) => m.year === year).sort((a, b) => a.month - b.month);
+ // Once, before its first frame is painted: run after it, the picker showed whole for a frame
+ // and then began its fade from nothing — a flash.
+ useLayoutEffect(() => fadeIn(box.current, { duration: 140 }), []);
useEffect(() => {
box.current?.focus({ preventScroll: true });
const down = (e: MouseEvent) => {
diff --git a/src/screens/photos/SharedAlbums.tsx b/src/screens/photos/SharedAlbums.tsx
new file mode 100644
index 0000000..fef1e92
--- /dev/null
+++ b/src/screens/photos/SharedAlbums.tsx
@@ -0,0 +1,154 @@
+/**
+ * Shared Albums, as icloud.com's Sharing section lists them: each a card — made by this account
+ * ("Shared by you") or joined ("Shared with you") — read from Apple's own service each time the
+ * page opens. A new one is named in a sheet and is on the page at once, then confirmed by Apple
+ * (or taken back, with Apple's reason); one of this account's is deleted from its menu, asked
+ * first, for everyone it was shared with.
+ */
+import { useEffect, useRef, useState } from "react";
+import { Plus, Users } from "lucide-react";
+import { api, type SharedAlbum } from "../../lib/ipc";
+import { Portal } from "../../components/Portal";
+import { RowMenu, type MenuEntry } from "../../components/RowMenu";
+import type { Question } from "./Ask";
+
+export function SharedAlbums({ ask, onError }: { ask: (q: Question) => Promise<boolean>; onError: (message: string) => void }) {
+ const [albums, setAlbums] = useState<SharedAlbum[] | null>(null);
+ const [naming, setNaming] = useState(false);
+ const [menu, setMenu] = useState<{ at: { x: number; y: number; alignRight: boolean }; entries: MenuEntry[] } | null>(null);
+
+ const read = () =>
+ api.photosSharedAlbums().then(setAlbums, (e) => {
+ setAlbums([]);
+ onError(String(e));
+ });
+ useEffect(() => {
+ void read();
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
+
+ const create = async (name: string) => {
+ setNaming(false);
+ const temp: SharedAlbum = { guid: `new:${Date.now()}`, name, createdAt: Math.floor(Date.now() / 1000), owned: true, public: false, contributions: true };
+ setAlbums((list) => [temp, ...(list ?? [])]);
+ try {
+ const guid = await api.photosSharedCreate(name);
+ setAlbums((list) => (list ?? []).map((a) => (a.guid === temp.guid ? { ...a, guid } : a)));
+ } catch (e) {
+ setAlbums((list) => (list ?? []).filter((a) => a.guid !== temp.guid));
+ onError(String(e));
+ }
+ };
+ const remove = async (a: SharedAlbum) => {
+ const sure = await ask({
+ title: `Delete the shared album “${a.name}”?`,
+ body: "It will be deleted from iCloud for everyone it is shared with, along with its photos and comments.",
+ action: "Delete",
+ danger: true,
+ symbol: "trash",
+ });
+ if (!sure) return;
+ const before = albums;
+ setAlbums((list) => (list ?? []).filter((x) => x.guid !== a.guid));
+ try {
+ await api.photosSharedDelete(a.guid);
+ } catch (e) {
+ setAlbums(before);
+ onError(String(e));
+ }
+ };
+
+ const n = albums?.length ?? 0;
+ return (
+ <div className="px-albums-page">
+ <header className="px-albums-head">
+ <div className="px-heading">
+ <h1>Shared Albums</h1>
+ <p className="px-span">{albums === null ? " " : n === 1 ? "1 Item" : `${n} Items`}</p>
+ </div>
+ <div className="px-capsule">
+ <button className="px-cap" aria-label="New Shared Album" title="New Shared Album" onClick={() => setNaming(true)}>
+ <Plus size={16} strokeWidth={2} aria-hidden="true" />
+ </button>
+ </div>
+ </header>
+ {albums !== null && n === 0 ? (
+ <div className="px-empty px-shared-empty">
+ <p>No shared albums yet. Make one to share photos with the people you choose.</p>
+ <button className="primary" onClick={() => setNaming(true)}>
+ New Shared Album
+ </button>
+ </div>
+ ) : (
+ <div className="px-cards" role="list" aria-busy={albums === null}>
+ {(albums ?? []).map((a) => (
+ <div
+ key={a.guid}
+ role="listitem"
+ className="px-card"
+ aria-label={a.name}
+ onContextMenu={(e) => {
+ e.preventDefault();
+ setMenu({
+ at: { x: e.clientX, y: e.clientY, alignRight: false },
+ entries: a.owned ? [{ label: "Delete Shared Album", danger: true, run: () => void remove(a) }] : [{ label: "Shared with you — only its owner can delete it" }],
+ });
+ }}
+ >
+ <span className="px-card-pic">
+ <Users size={34} strokeWidth={1.6} aria-hidden="true" />
+ </span>
+ <span className="px-card-name">{a.name}</span>
+ <span className="px-card-count">
+ {a.owned ? "Shared by you" : "Shared with you"}
+ {a.createdAt ? ` · ${new Date(a.createdAt * 1000).toLocaleDateString(undefined, { dateStyle: "medium" })}` : ""}
+ </span>
+ </div>
+ ))}
+ </div>
+ )}
+ {naming && <NameSheet onCancel={() => setNaming(false)} onCreate={(name) => void create(name)} />}
+ {menu && <RowMenu at={menu.at} entries={menu.entries} onClose={() => setMenu(null)} />}
+ </div>
+ );
+}
+
+/** The name for a new shared album, asked in a sheet: Return makes it, Escape leaves it. */
+function NameSheet({ onCancel, onCreate }: { onCancel: () => void; onCreate: (name: string) => void }) {
+ const [name, setName] = useState("");
+ const field = useRef<HTMLInputElement | null>(null);
+ useEffect(() => field.current?.focus(), []);
+ const go = () => name.trim() && onCreate(name.trim());
+ return (
+ <Portal>
+ <div className="modal-veil" onClick={onCancel}>
+ <form
+ className="modal-sheet px-ask"
+ role="dialog"
+ aria-label="New Shared Album"
+ onClick={(e) => e.stopPropagation()}
+ onSubmit={(e) => {
+ e.preventDefault();
+ go();
+ }}
+ onKeyDown={(e) => {
+ if (e.key === "Escape") {
+ e.stopPropagation();
+ onCancel();
+ }
+ }}
+ >
+ <h2>New Shared Album</h2>
+ <input ref={field} className="px-shared-name" placeholder="Album Name" aria-label="Album Name" value={name} onChange={(e) => setName(e.target.value)} />
+ <div className="px-ask-actions">
+ <button type="button" onClick={onCancel}>
+ Cancel
+ </button>
+ <button type="submit" className="is-act" disabled={!name.trim()}>
+ Create
+ </button>
+ </div>
+ </form>
+ </div>
+ </Portal>
+ );
+}
diff --git a/src/screens/photos/Slideshow.tsx b/src/screens/photos/Slideshow.tsx
index 02b25a9..8b6d699 100644
--- a/src/screens/photos/Slideshow.tsx
+++ b/src/screens/photos/Slideshow.tsx
@@ -9,9 +9,10 @@
* one leaving fades out as the next fades in — before, it stood whole behind the next for the
* length of the fade, its edges showing round a narrower photo, and then vanished at once.
*/
-import { useCallback, useEffect, useRef, useState } from "react";
+import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
import { ChevronLeft, ChevronRight, Pause, Play, X } from "lucide-react";
import { fitSrc, type Photo } from "../../lib/ipc";
+import { fadeIn } from "../../lib/fade";
const HOLD = 4000;
const FADE = 900;
@@ -46,7 +47,6 @@ export function Slideshow({ photos, start, onClose }: { photos: Photo[]; start:
const [leaving, setLeaving] = useState<number | null>(null);
const [playing, setPlaying] = useState(true);
const [awake, setAwake] = useState(true);
- const still = typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
const shown = useRef(first);
// To another photo, once its picture is decoded.
@@ -112,12 +112,19 @@ export function Slideshow({ photos, start, onClose }: { photos: Photo[]; start:
};
}, []); // eslint-disable-line react-hooks/exhaustive-deps
+ // The arriving photo dissolves in over the one leaving, frame by frame from the page, set before
+ // its first frame is painted.
+ const arriving = useRef<HTMLImageElement | null>(null);
+ useLayoutEffect(() => {
+ if (leaving !== null) fadeIn(arriving.current, { duration: FADE });
+ }, [at]); // eslint-disable-line react-hooks/exhaustive-deps
+
const photo = list[at];
if (!photo) return null;
const old = leaving !== null ? list[leaving] : null;
return (
<div
- className={`px-show${awake ? " is-awake" : ""}${still ? " is-still" : ""}`}
+ className={`px-show${awake ? " is-awake" : ""}`}
role="dialog"
aria-label="Slideshow"
onMouseMove={wake}
@@ -126,7 +133,8 @@ export function Slideshow({ photos, start, onClose }: { photos: Photo[]; start:
{old && <img key={`l${old.id}-${leaving}`} className="px-slide is-leaving" src={screenSrc(old)} alt="" aria-hidden="true" />}
<img
key={`a${photo.id}-${at}`}
- className={`px-slide${playing ? "" : " is-paused"}`}
+ ref={arriving}
+ className="px-slide"
src={screenSrc(photo)}
alt={photo.filename ?? "Photo"}
/>
diff --git a/src/styles/app.css b/src/styles/app.css
index 7ef05b3..864bab7 100644
--- a/src/styles/app.css
+++ b/src/styles/app.css
@@ -421,6 +421,16 @@
}
.nav-item > svg { border-radius: 5.4px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(0, 0, 0, 0.2); }
+/* Apple's own icons come as a light and a dark picture; the theme shows one. */
+.app-icon-apple { display: inline-grid; }
+.app-icon-apple > img { grid-area: 1 / 1; width: 100%; height: 100%; display: block; }
+.app-icon-apple > .ai-dark { display: none; }
+@media (prefers-color-scheme: dark) {
+ :root:not([data-theme="light"]) .app-icon-apple > .ai-light { display: none; }
+ :root:not([data-theme="light"]) .app-icon-apple > .ai-dark { display: block; }
+}
+:root[data-theme="dark"] .app-icon-apple > .ai-light { display: none; }
+:root[data-theme="dark"] .app-icon-apple > .ai-dark { display: block; }
/* The icon tiles: white in light mode; Apple's graphite in dark, as icloud.com draws them. */
.app-icon .ai-tile-top { stop-color: #ffffff; }
.app-icon .ai-tile-bottom { stop-color: #ececf0; }
@@ -617,17 +627,15 @@
/* ---- the one orchestrated moment: sign-in dissolving into the library ---------- */
.enter-sheet { animation: sheet-in 420ms var(--ease) both; }
-.enter-library { animation: library-in 620ms var(--ease-spring) both; }
+/* The library simply appears: a whole-window animation, held at its last frame forever by
+ "both", kept the entire app inside an animated layer of WebKitGTK's — and every animation
+ handed to the compositor glitched on his screen. */
@keyframes sheet-in {
from { opacity: 0; transform: translateY(8px) scale(0.985); }
to { opacity: 1; transform: none; }
}
-@keyframes library-in {
- from { opacity: 0; transform: scale(0.972); }
- to { opacity: 1; transform: none; }
-}
/* ---- calendar: month grid ------------------------------------------------------
Apple's Calendar is a month grid, not a list. Weekday header, six rows of seven, the day
@@ -1507,13 +1515,9 @@
/* A dim, not a blur: macOS dims the window behind a sheet, and a blur of the whole
window under glass was glass on glass — and in WebKitGTK the costliest frame there is. */
background: rgba(0, 0, 0, 0.2);
- animation: modal-veil-in 200ms var(--ease) both;
+ /* At once: a full-window dim is never animated (the sheet on it fades in; see fadeSheetsIn). */
}
-@keyframes modal-veil-in {
- from { opacity: 0; }
- to { opacity: 1; }
-}
.modal-sheet {
width: min(440px, 92vw);
diff --git a/src/styles/photos.css b/src/styles/photos.css
index 0e60295..6d3e7bc 100644
--- a/src/styles/photos.css
+++ b/src/styles/photos.css
@@ -347,8 +347,9 @@
max-width: none;
max-height: none;
object-fit: contain;
+ /* Hidden until it has loaded, then faded in by the page frame by frame (fadeIn) — a CSS
+ transition here was the compositor's, and flickered as a zoom brought it in. */
opacity: 0;
- transition: opacity 180ms ease;
pointer-events: none;
}
.px-sharp.is-in { opacity: 1; }
@@ -458,17 +459,12 @@
width: 100%;
height: 100%;
object-fit: contain;
- transform-origin: 50% 45%;
- animation: px-arrive 900ms ease-out both, px-drift 4900ms linear both;
-}
-/* The one leaving dissolves away from where its drift ended, over the next fading in. */
-.px-slide.is-leaving { animation: px-leave 900ms ease-in-out both; transform: scale(1.06); z-index: 1; pointer-events: none; }
-@keyframes px-leave { from { opacity: 1; } to { opacity: 0; } }
-.px-show.is-still .px-slide.is-leaving { animation: none; opacity: 0; }
-.px-slide.is-paused { animation-play-state: paused; }
-@keyframes px-arrive { from { opacity: 0; } to { opacity: 1; } }
-@keyframes px-drift { from { transform: scale(1); } to { transform: scale(1.06); } }
-.px-show.is-still .px-slide { animation: none; }
+ /* No CSS animation: the arriving photo fades in over the leaving one frame by frame from the
+ page (fadeIn), the leaving one still beneath it. The slow zoom across each photo was a
+ long compositor animation on a full-screen picture — the kind that glitched on his screen. */
+ z-index: 1;
+}
+.px-slide.is-leaving { z-index: 0; pointer-events: none; }
.px-show-bar {
position: absolute;
z-index: 2;
@@ -767,7 +763,6 @@
display: grid;
place-items: center;
background: rgba(0, 0, 0, 0.42);
- animation: px-fade 160ms ease-out both;
}
.px-sheet {
position: relative;
@@ -777,11 +772,8 @@
background: var(--sheet);
box-shadow: var(--glass-float);
color: var(--text);
- animation: px-rise 260ms var(--spring-smooth) both;
+ /* Fades in from the page, frame by frame (fadeSheetsIn), never a compositor animation. */
}
-@keyframes px-fade { from { opacity: 0; } }
-@keyframes px-rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
-@media (prefers-reduced-motion: reduce) { .px-sheet-scrim, .px-sheet { animation: none; } }
.px-sheet h2 { margin: 6px 0 12px; text-align: center; font-size: var(--t-15, 15px); font-weight: 700; }
.px-sheet-x {
position: absolute;
@@ -999,11 +991,13 @@
.px-scroll[data-behind] { visibility: hidden; }
/* What kind of photo it is, at the stage's corner, as Photos marks it: LIVE, BURST. */
+/* On the photo's own top-left corner, as Photos lays them (--photo-x/y, measured), not the
+ stage's — and not shown over a photo zoomed in. */
.px-mark {
position: absolute;
z-index: 3;
- top: 62px;
- left: 64px;
+ top: calc(var(--photo-y, 62px) + 10px);
+ left: calc(var(--photo-x, 64px) + 10px);
display: inline-flex;
align-items: center;
gap: 5px;
@@ -1020,7 +1014,7 @@
}
.px-mark:hover, .px-mark.is-on { background: rgba(28, 28, 30, 0.82); }
.px-mark-count { font-weight: 500; opacity: 0.7; letter-spacing: 0; }
-.px-mark.is-burst { letter-spacing: 0; font-weight: 600; padding-right: 4px; }
+.px-mark.is-burst { letter-spacing: 0; font-weight: 600; padding-right: 4px; top: 62px; left: 64px; }
.px-mark-done {
margin-left: 6px;
height: 18px;
@@ -1047,10 +1041,9 @@
box-shadow: var(--glass-float);
overflow: hidden;
outline: none;
- animation: px-jump-in 160ms cubic-bezier(0.32, 0.72, 0, 1) both;
+ /* Fades in frame by frame from the page (fadeIn), never a CSS animation: animated by the
+ engine's compositor it glitched on his screen as it opened. */
}
-@keyframes px-jump-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
-@media (prefers-reduced-motion: reduce) { .px-jump { animation: none; } }
.px-jump-years { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-right: 1px solid var(--separator); overflow-y: auto; }
.px-jump-year {
height: 30px;
@@ -1093,3 +1086,21 @@
/* A picture that could not be had at all draws nothing — never the engine's broken box (a
white frame, a question mark, the file's name); what is under it shows. */
img[data-failed] { content: url("data:image/gif;base64,R0lGODlhAQABAAAAACw="); }
+
+/* Shared Albums: nothing shared yet, and the name for a new one. */
+.px-shared-empty { display: grid; justify-items: start; gap: 12px; }
+.px-shared-empty p { margin: 0; }
+.px-shared-name {
+ width: 100%;
+ height: 34px;
+ margin: 4px 0 2px;
+ padding: 0 10px;
+ border: 0;
+ border-radius: 8px;
+ font: inherit;
+ font-size: var(--t-15, 15px);
+ color: var(--text);
+ background: var(--field, color-mix(in srgb, var(--text) 8%, transparent));
+ box-shadow: inset 0 0 0 1px var(--field-edge, var(--separator));
+}
+.px-shared-name:focus { outline: none; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-ring); }