diff --git a/AppleNugs/Core/Models.swift b/AppleNugs/Core/Models.swift index b2d4dc2..e73fb1b 100644 --- a/AppleNugs/Core/Models.swift +++ b/AppleNugs/Core/Models.swift @@ -154,7 +154,7 @@ enum AudioFormat: String { } /// Whether the format is compressed without loss — the single source of - /// truth for the lossless badge tint and the cassette's lossless tick. + /// truth for the price sticker (the lossless badge). /// /// Deliberately an exhaustive switch rather than a `Set` literal or a /// `default: false`: adding a case to `AudioFormat` should be a compile diff --git a/AppleNugs/Theme/Components/NowPlayingMetaText.swift b/AppleNugs/Theme/Components/NowPlayingMetaText.swift index 36005f6..523f508 100644 --- a/AppleNugs/Theme/Components/NowPlayingMetaText.swift +++ b/AppleNugs/Theme/Components/NowPlayingMetaText.swift @@ -5,12 +5,12 @@ import SwiftUI /// /// Renders **exactly one** `Text(AttributedString)` — no wrapper stack, no /// `contentShape`, no frame of its own — so it is a drop-in for the plain -/// `Text` it replaces at all sixteen render sites. Callers keep their entire +/// `Text` it replaces at every render site. Callers keep their entire /// modifier chain (`.font`, `.tracking`, `.lineLimit`, `.truncationMode`, /// `.multilineTextAlignment`); those are View modifiers and propagate to the /// descendant Text, so metrics and truncation are unchanged. That matters: -/// several of these surfaces have no slack at all (the cassette's 25:16 ratio, -/// the pill's text budget, the faceplate's fixed-width ticker). +/// several of these surfaces have no slack at all (the pill's text budget above +/// all). /// /// **Invisible at rest.** Each link run is given the surrounding foreground /// color explicitly, which SwiftUI honors over its own link tint — verified by @@ -29,9 +29,10 @@ struct NowPlayingMetaText: View { var mode: NowPlayingMetaLine.Mode = .joined var casing: NowPlayingMetaLine.Casing = .asIs /// The glyph color. Callers that paint from a theme token can leave this - /// nil and set `.foregroundStyle` as they always have; the cassette passes - /// its local paper `ink` here because the run color has to be set on the - /// attributed string, not inherited, for the link runs to match. + /// nil and set `.foregroundStyle` as they always have; a caller painting + /// from a local color passes it here instead, because the run color has to + /// be set on the attributed string, not inherited, for the link runs to + /// match. var tint: Color? /// Rendered when there is no track. Absorbs the ticker surfaces' idle copy. var idle: String? @@ -60,9 +61,8 @@ struct NowPlayingMetaText: View { if segments.isEmpty, (idle ?? "").isEmpty { // Nothing to say — render NOTHING, not an empty Text, which would // still claim a line's height. Most of the sites this replaces were - // `if let` and depended on that: the cassette's 25:16 ratio budget - // has ~19pt of slack and has already been yielded twice by a label - // growing a line. + // `if let` and depended on that: a phantom empty line moves every + // layout that budgets its height (the pill above all). EmptyView() } else { Text(attributed) diff --git a/AppleNugs/Views/HapticButton.swift b/AppleNugs/Views/HapticButton.swift index 394f21a..897684a 100644 --- a/AppleNugs/Views/HapticButton.swift +++ b/AppleNugs/Views/HapticButton.swift @@ -2,7 +2,7 @@ import SwiftUI /// The transport's tactile vocabulary. Three feelings, used everywhere, so a /// tap means the same thing whichever surface it lands on — the docked bar, -/// the full-screen player, the faceplate, the Click Wheel. +/// the full-screen player, the pill and its expanded panel. extension SensoryFeedback { /// Play/pause: the one press that commits to something. static let transportToggle = SensoryFeedback.impact(weight: .medium, intensity: 0.9) diff --git a/AppleNugs/Views/HomeColumns.swift b/AppleNugs/Views/HomeColumns.swift index c0a971d..031d3dd 100644 --- a/AppleNugs/Views/HomeColumns.swift +++ b/AppleNugs/Views/HomeColumns.swift @@ -6,9 +6,10 @@ import Foundation /// `AppleNugsTests` bundle (the `PillLayout` trick). /// /// Home is one column on a phone. On a wide canvas — the iPhone Duo's inner -/// display (~870pt of Home content flat, ~629pt upright), or a landscape -/// iPhone — one column stretches the hero into a long strip of bare card -/// stock and leaves little else above the fold. There, Home splits instead: +/// display (~870pt of Home content flat, ~629pt upright; regular iPhones are +/// portrait-locked by `OrientationGate`, so they never get here) — one column +/// stretches the hero into a long strip of bare card stock and leaves little +/// else above the fold. There, Home splits instead: /// the hero keeps its designed upright blister pack in a leading column, and /// favorites, the nice list and the crate stack beside it. /// diff --git a/AppleNugs/Views/NowPlaying/NowPlayingFitWidth.swift b/AppleNugs/Views/NowPlaying/NowPlayingFitWidth.swift index 3b49756..214384e 100644 --- a/AppleNugs/Views/NowPlaying/NowPlayingFitWidth.swift +++ b/AppleNugs/Views/NowPlaying/NowPlayingFitWidth.swift @@ -9,8 +9,8 @@ extension View { /// column such as the ~300pt player column beside the queue on iPhone Duo's /// upright inner display. /// - /// Click Wheel's `controlPad` pattern, with the natural size MEASURED rather - /// than hard-coded (SF Symbol advances aren't known up front): the row is + /// `NowPlayingFit.scale` + `scaleEffect` + a matching frame, with the natural + /// size MEASURED rather than hard-coded (SF Symbol advances aren't known up front): the row is /// measured at its ideal size before `scaleEffect`, which changes only the /// drawing, so the measurement doesn't depend on the scale; the available /// width is measured on the full-width container, whose width is the diff --git a/AppleNugs/iOS/NowPlayingArrangement.swift b/AppleNugs/iOS/NowPlayingArrangement.swift index bd7839e..4f00ba2 100644 --- a/AppleNugs/iOS/NowPlayingArrangement.swift +++ b/AppleNugs/iOS/NowPlayingArrangement.swift @@ -32,9 +32,8 @@ import SwiftUI /// whose ScrollView keeps its own vertical scrolling) moves the whole /// arrangement down 1:1 and closes it past a threshold, otherwise springs it /// back — policy in `NowPlayingDismissDrag`. It is a plain `.gesture`, so any -/// child gesture that recognizes wins: the scrub and volume sliders, every -/// button, and The Receiver's volume ladder (`DragGesture(minimumDistance: 0)`, -/// which recognizes on touch-down). The cover is presented with a clear +/// child gesture that recognizes wins: the scrub and volume sliders and every +/// button. The cover is presented with a clear /// presentation background so the app shows through as the player slides; /// at rest every player and the panel paint their own opaque, safe-area- /// ignoring backgrounds, and the `palette.base` backing below covers any seam diff --git a/AppleNugs/iOS/NowPlayingPill/PillLayout.swift b/AppleNugs/iOS/NowPlayingPill/PillLayout.swift index de873d6..a3a4b31 100644 --- a/AppleNugs/iOS/NowPlayingPill/PillLayout.swift +++ b/AppleNugs/iOS/NowPlayingPill/PillLayout.swift @@ -100,8 +100,8 @@ enum PillLayout { /// The narrowest text column that also carries the show after the artist /// ("Goose · 11/11/26 The Truth, Nashville, TN"). Regular iPhones (~104pt /// with the chevron) and the Duo's folded outer display stay artist-only; - /// the Duo's inner display flat (~560pt) and a landscape iPhone have room - /// to spare. (Upright, the Duo's tab bar is horizontal again and the pill + /// the Duo's inner display flat (~560pt) has room to spare. (Phones are + /// portrait-locked, so no regular iPhone gets here. Upright, the Duo's tab bar is horizontal again and the pill /// is ~400pt: artist only.) static let minShowLineWidth: CGFloat = 220 diff --git a/AppleNugs/iOS/NowPlayingPill/PillLeadingSlot.swift b/AppleNugs/iOS/NowPlayingPill/PillLeadingSlot.swift index a893677..5f15cd1 100644 --- a/AppleNugs/iOS/NowPlayingPill/PillLeadingSlot.swift +++ b/AppleNugs/iOS/NowPlayingPill/PillLeadingSlot.swift @@ -2,13 +2,9 @@ import SwiftUI /// The pill's 32pt leading slot: the cover, wrapped in the progress ring. /// -/// This was five themed faces (Tape Room's reel, the Receiver's VU, Click -/// Wheel's disc, Shoebox's J-card spine, and a plain chip for Soundboard). -/// The ring changed that calculus — a ring wants one consistent shape to -/// encircle, and three of those faces are themselves circles, so the slot -/// would have carried two concentric rings. Theme identity lives on in the -/// full-screen player, the palette, the typography, the copy, and the macOS -/// miniplayer. +/// One uniform `ArtChip`, clipped to a circle: a ring wants one consistent +/// shape to encircle, and the circle keeps the ring's 1pt gap at every angle +/// (a rounded square's corners would put the arc on the cover). /// /// Nothing in THIS view observes `player.currentTime`; the ring is a separate /// leaf so the 4Hz playback tick stops there. See `PillProgressRing`. diff --git a/CLAUDE.md b/CLAUDE.md index d1516d9..f4bd774 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,455 +1,229 @@ # Yeti (formerly AppleNugs) — guide for Claude -Native **macOS + iOS SwiftUI** player for nugs.net, shipped to users as **Yeti — an unofficial player for nugs.net** (named for the Goose song). Public repo `tsvb/applenugs` (repo, bundle ids, Xcode project/target names and the `.app` file name still say AppleNugs on purpose — see "Yeti — compliance pass" below). Unofficial: talks nugs.net's private API with the user's own subscription, identifies itself honestly as Yeti. Developer ID / direct-download distribution, not App Store (5.2.2). Latest release on `main`: **v1.5**. +Native **macOS + iOS SwiftUI** player for nugs.net, shipped as **Yeti — an unofficial player for nugs.net** +(named for the Goose song). Public repo `tsvb/applenugs`; the repo, bundle ids, Xcode project/target names +and the `.app` file name still say AppleNugs on purpose (see Conventions → compliance). Unofficial: talks +nugs.net's private API with the user's own subscription and identifies itself honestly as Yeti. Developer ID / +direct-download distribution, not the App Store (guideline 5.2.2). Latest release: **v1.5** (build 6), which +predates the Yeti design — everything since is on `main`, unreleased. **Tim is the only user**: no migrations +or release notes for design changes, but keep his own data safe. ## Read first -- **Claude Code auto-memory:** this project's memory index at `~/.claude/projects//memory/MEMORY.md` (loaded automatically at session start) holds the deep, current project context — parity program, distribution/release runbook, iOS port, theme system, player backlog, gotchas. Skim the notes relevant to your task before acting. - -## Workflow (how every feature here is built) -`superpowers:brainstorming` → spec in `docs/superpowers/specs/` → `superpowers:writing-plans` → `superpowers:subagent-driven-development` (fresh implementer per task + per-task spec/quality review + whole-branch review). Don't skip the design/spec step, even for "simple" changes. +- **Auto-memory:** `~/.claude/projects//memory/MEMORY.md` (loaded at session start) holds the + deep context — distribution runbook and secrets-adjacent values (team ID, notary profile, device UDIDs), + the Duo, the pill, the catalog APIs, gotchas. Skim the notes relevant to your task before acting. +- **Tim prefers the system's own chrome and layout** over custom UI — recommend the system mechanism first + (the `feedback-system-guidelines-first` memory). + +## Workflow +- How features are built: brainstorm → spec in `docs/superpowers/specs/` → plan → implement with review. + Don't skip the design/spec step for anything with a design choice in it. `docs/superpowers/` is + **gitignored** (local only, dies with the worktree) — durable decisions go in this file or memory. +- **Landing recipe:** branch from `origin/main`, push, open a PR, wait for CI (the `xcode-27` runner), then + `git push origin :main` — **fast-forward only**, never a merge or rebase, so commit hashes stay valid. + GitHub marks the PR merged by itself. Delete the branch after. Pushing/landing is Tim's call. +- **CI sometimes doesn't start for a PR** (seen on #12, #13). Then `gh workflow run CI --ref ` + (the workflow has `workflow_dispatch`), watch it, check its `headSha` is the branch tip, and land. +- Install on Tim's devices to verify before landing anything visual — he judges on hardware. ## Environment & build -- Work in the git **worktree** you were started in; **don't `cd` to the main checkout** (the repo-root clone). Merge to `main` via a fast-forward from the main checkout using `git -C`, then push (releases/pushes are the maintainer's call). -- `xcodegen generate` after any `project.yml` edit (`AppleNugs.xcodeproj/` is **gitignored**). Regenerate before building/opening. -- Schemes: `AppleNugs` (macOS, `-destination 'platform=macOS'`), `AppleNugs-iOS` (`-destination 'generic/platform=iOS Simulator'` or a device id), `AppleNugsTests` (host-free unit tests, **330** as of stage e4, 2026-11-07 — CI runs them on every push, so take the count from the suite rather than from this line). -- **Always build/verify with a fresh `-derivedDataPath`** — incremental builds can report a false "clean". Project must stay warning-free under `SWIFT_STRICT_CONCURRENCY=complete` on **both** schemes. SourceKit "No such module 'UIKit'" on iOS-only files = per-target index noise; `xcodebuild` is authoritative. -- `docs/superpowers/` is **gitignored** (specs, plans, reports — local only, and therefore NOT a safe place for handoff state: a worktree removal deletes it. Durable session state belongs in this file plus the auto-memory index). -- Visual verify without a login: launch with `-UITEST -UITestSeedQueue` (bypasses login, seeds a now-playing queue). Yeti is the only design (no theme switcher, no `-UITestTheme`). Dashboard = `sidebar.right` toolbar button / ⌥⌘I. -- iOS device install: `DEVELOPMENT_TEAM=$APPLENUGS_TEAM_ID` (the paid team — value in the local `applenugs-distribution` memory, not in the repo) + `-allowProvisioningUpdates`; **the iPhone must be UNLOCKED** or the developer disk image won't mount. Notary profile name and Developer ID team: see the local `applenugs-distribution` memory. Full release runbook: `DISTRIBUTION.md` + the `applenugs-distribution` memory. +- Work in the git **worktree** you were started in; don't `cd` to the main checkout (`/Users/tim/applenugs`). + `git -C /Users/tim/applenugs pull --ff-only` updates it when Tim asks. +- `xcodegen generate` after any `project.yml` edit (`AppleNugs.xcodeproj/` is gitignored). Regenerate before + building. `APPLENUGS_TEAM_ID= xcodegen generate` for device builds (team ID in memory, not the repo). +- **Toolchain:** Xcode **27.1+** is required — the iOS app compiles iOS 27.1 SDK symbols (`ArrangementView`) + behind `#available`, which an older SDK can't compile at all. CI pins `Xcode_27.1.app` and asserts it; + locally `xcode-select` points at Xcode 27.2. Deployment floors: macOS 14.0, iOS 26.1 (for + `tabViewBottomAccessory(isEnabled:)`; see `project.yml`). +- Schemes: `AppleNugs` (macOS, `-destination 'platform=macOS'`), `AppleNugs-iOS` + (`'generic/platform=iOS Simulator'` or `'platform=iOS,id='`), `AppleNugsTests` (host-free unit tests + — pure Foundation files compiled straight into the bundle via `project.yml`, no `@testable`; take the count + from the suite, not from docs). +- **Always verify with a fresh `-derivedDataPath`** (incremental builds can report a false clean), and keep + **both** schemes warning-free under `SWIFT_STRICT_CONCURRENCY=complete`. SourceKit "No such module 'UIKit'" + on iOS-only files is index noise; `xcodebuild` is authoritative. **Delete DerivedData after** — disk is tight. +- **Seeded launch, no login:** `-UITEST -UITestSeedQueue` (stub catalog with FAKE ids, a parked queue). It + never writes the resume queue or listening stats, and it skips artist-photo lookups (fake ids would show + strangers' photos). Listening-stat READS stay live, so a seeded run shows real nice-list data. +- **iOS device install** (Tim's iPhone Duo; UDID in memory): Developer Mode on, phone UNLOCKED, build against + the specific device with `-allowProvisioningUpdates -allowProvisioningDeviceRegistration` (a generic build + never registers a new phone → `0xe8008012`), then `xcrun devicectl device install app --device `. + Trust `devicectl list devices` over `xctrace`. A running VPN on the Mac hangs every `devicectl` call. +- **Mac local install** must be **Developer ID-signed** (ad-hoc + hardened runtime can't load Sparkle) — + recipe in the `applenugs-local-install-signing` memory. Every built `.app` registers `applenugs://`; after + installing, `lsregister -u` the build-folder copy and `lsregister -f /Applications/AppleNugs.app`. +- **Duo simulator:** needs its own runtime (iOS 27.1 `24A94425`). Xcode 27 has no Simulator.app — open + `/Applications/Xcode.app/Contents/Applications/DeviceHub.app`; folding/rotating are on-screen controls only, + so poses need Tim. `simctl io screenshot --display=1` (outer) / `--display=3` (inner); a black inner + shot means the device is folded, whatever pose was described — check both displays. ## Conventions worth knowing -- **Design system: Yeti is the only design** (macOS + iOS, dark only; the five old themes, their picker, - transport/miniplayer variants, art-color pipeline, wash and grain were deleted 2026-11-07, stages d–e). - ONE token struct, `Theme` (`AppleNugs/Theme/Theme.swift`, the only place literal hex lives): `palette` - (semantic roles — `base`/`raised`/`hairline`, `textPrimary`/`textSecondary`/`textIdle`, `accent` = foil, - kept for things that move with time, `playState` = sale yellow, `cardStock`, `stickerInk`, the sticker - stock stops, `segmentThumb`, `videoErrorBackdrop`, the bubble's plastic), `type` (size-taking font - closures) and `copy` (the app's voice). Its single value `Theme.yeti` is the `\.theme` environment - default, so views just read `@Environment(\.theme)`; `ThemedRoot` (`.themed(_:)`) sets the snow root tint - (`palette.textPrimary` — system controls never paint an accent fill; foil is applied explicitly only where - time moves), the base background, the body font and `.dark`. The Yeti parts live in - `AppleNugs/Theme/Components/`: `BlisterPack` (card stock + bubble, `PackArt`, `BlisterGlass`), the - stickers (`StickerStock`, `PlaySticker`, `PriceSticker`, `RowSticker`, `LabelSticker`), `FoilSweep` - (reads no time), `YetiButtonStyles` (+ the macOS foil focus outline), `YetiSegmentedControl`, - `EmptyPackMessage`, `MonogramTile`. Design pages: `docs/design/yeti-theme/` (`yeti-theme.html` token - sheet, `yeti-surfaces.html`, `yeti-decisions.html`) and `docs/design/yeti-icon/`. The app icon is - `AppleNugs/AppIcon.icon` (Icon Composer), regenerated by `scripts/render-app-icon.py`. -- **macOS vs iOS:** `AppleNugs/macOS/` and `AppleNugs/iOS/` are per-platform (excluded from the other target); everything else is shared. Keep the untouched platform building. -- **Dashboard inspector perf:** `DashboardPanel` is a `ScrollView`+`VStack` (NOT a `List` — macOS-26 `NSTableView` reentrancy). The ~4Hz playback tick (`currentTime`) is isolated in **leaf views** so the panel body / queue `ForEach` don't re-diff every frame. **Only leaf views may read `currentTime`** — never hoist the read into a host or variant body. The current readers are `MiniPlayerScrubTrack`, `BufferedRow` (the Signal section, both platforms), the iOS-only `ElapsedTimeLine`, `PanelScrubRow` (in `ExpandedPlayerPanel`), `PillProgressRing`, and the shared `ResumeProgressRule` (`Views/HomeResumeHero.swift`; the Mac `YetiResumeCard` + the iPhone `YetiHomeHero`, a constant 3pt rule). Follow this pattern for any live-updating inspector content, and add to this list rather than treating it as closed. **A leaf must also render CONSTANT-HEIGHT content** — a leaf that collapses to `EmptyView` when its value is unknown changes size, and a child size change invalidates the parent's layout, which is both a visible jump and the very re-layout the isolation exists to prevent. `BufferedRow` used to do exactly that; it now always renders a row with a `SignalReadout.unknown` placeholder. -- **The inspector's Signal section holds a constant row set** (`SignalReadout`, pure + unit-tested). `startCurrent()` nils `nowPick`/`specs` on every track change, so gating rows on them collapsed the section from six rows to two — jumping the whole queue below it — and hid it entirely on a launch-restored queue. Gate on `player.current`, never on `nowPick`/`specs`; let unknown values degrade to `"—"` (dimmed via `foregroundStyle` ONLY — a font or weight change moves the row height and brings the bug back one row at a time). `"--:--"` stays reserved for clocks. -- **`DashboardPanel.swift` is SHARED, not macOS code.** It lives in `AppleNugs/Views/`, and iOS presents the same panel as a sheet from `NowPlayingScreen` (and beside it in `NowPlayingArrangement`). Anything under `AppleNugs/macOS/` called from it MUST sit behind `#if os(macOS)` or the iOS build breaks — the macOS build won't catch it. -- **Dashboard miniplayer** (`AppleNugs/macOS/MiniPlayer/`, macOS only): `DashboardMiniPlayer` shows the idle line or `MiniPlayerStandard` (the blister-pack miniplayer — the only variant); shared leaves in `MiniPlayerParts.swift`. The inspector column is pinned `min: 340, ideal: 340, max: 380` because a real 44-char venue string clips below 340. -- **Now-playing metadata is clickable** (`NowPlayingMetaText` + the pure `NowPlayingMetaLine`). The artist and the show are separate `.link` runs inside ONE `Text(AttributedString)` — never an HStack of Buttons, because several render sites join the two fields into one string and have no layout slack (the pill's text budget above all; the deleted cassette and faceplate variants were the original tight cases). Taps arrive as `x-applenugs-meta://` URLs and are intercepted by `.nowPlayingMetaLinks(app:ui:)`, installed at all THREE scene roots (`RootView`, `IOSRootView`, and the macOS Now Playing `Window` — a separate scene with its own environment). **The interceptor MUST return `.systemAction` for foreign URLs** or `VideoDetailView.benefitNotes`' real donation links break. Links are invisible at rest (each run carries the surrounding color explicitly — SwiftUI honors it over its own link tint, verified by pixel-comparing an offscreen render) and reveal a dotted underline on hover, macOS only. Build attributes with the `AttributeScopes.…Attribute.self` subscript, NOT the `run.foregroundColor =` dynamic-member form, which forms a key path over a non-Sendable type and warns under strict concurrency. -- **Navigating from a modal surface uses `UIState.navigate(to:)`, not `open(_:)`.** It bumps a tick that every presentation owner observes via `dismissesOnNavigation(_:ui:)`. Needed because on iOS the dashboard is a sheet inside a sheet AND a sheet inside a fullScreenCover, so a tap there unwinds two layers and `@Environment(\.dismiss)` reaches only the innermost. `navigate(to:)` deliberately does NOT touch `sidebarSelection` — its `didSet` resets `navPath` and would wipe the push. Deep links route through it too. -- **`NowPlayingMetaText` carries a `tappableText` flag** (and `showsLinks` for the offline Downloads sheet, which has no stack to push onto). Every render site (10 since stage e) is a real tap link, the pill and both Home heroes included (`AlbumDetailView`'s artist link reuses the `x-applenugs-meta://` route) — Tim asked for that explicitly after they initially shipped as long-press/VoiceOver-only. If a mis-tap problem ever shows up on the pill or a Home hero (each has its whole body as a competing tap target), `tappableText: false` is the dial, not a rewrite. -- **`PlaybackStateStore` no longer writes under `-UITEST`** (both `save` and `clear`, each behind `#if DEBUG` because `AppModel.isUITestRun` is itself DEBUG-only and is now `nonisolated` so the nonisolated store can read it). This retires the long-standing seeded-launch hazard: a `-UITestSeedQueue` run that touched the transport used to persist stub tracks over the real resume queue, and "Clear" deleted it outright. Reads are deliberately still live. -- **iPhone Duo layout rules.** (1) **Now-playing art must yield height** — never a rigid tile: the - bubble is square and takes what the proposal leaves after the nameplate (capped by `maxBubbleSide`, - 320pt on the now-playing card), and with no cover `PackArt`'s `GeometryReader` sizes the `MonogramTile` - to that box, exactly like real artwork; a fixed tile overflows short canvases (the Duo's landscape inner - display, and portrait iPhones by ~15pt). - (2) **The pill sheds controls by measured WIDTH** (`PillLayout.controls(slot:width:hasLeadingSlot:trailingReserve:)`, - 90pt text floor), because on the Duo's outer display a vertical tab bar leaves a ~290pt accessory that - still reports `.expanded`. **The Duo's pill is Apple's `tabViewBottomAccessory`, exactly like every other - iPhone, vertical tab bar or not** (`NowPlayingAccessory` in `IOSRootView`): the system's scroll edge effect - handles content under the bars (the tab stacks set `.scrollEdgeEffectStyle(.soft, for: .bottom)` — with a - vertical bar `.automatic` drew none and content ran crisp under the pill; iPhones render unchanged), and on the folded Duo the pill does not tuck away on scroll — accepted. - No custom overlay, shelf or duck, and no fork on `\.toolbarVerticalEdge` (Tim, 2026-11-07: follow the - system; the `feedback-system-guidelines-first` memory). (3) The iOS full-screen cover hosts `NowPlayingArrangement`; the pure - `NowPlayingColumns` policy picks compact → player alone, regular + wider-than-tall → iOS 27.1 - `ArrangementView` (player + `DashboardPanel(showsNowPlaying: false)`), regular + upright → an explicit - HStack with a 220–260pt queue column (ArrangementView's horizontal split refuses tall canvases). It - also owns **swipe-down to close** (pure `NowPlayingDismissDrag`; a plain `.gesture` on the PLAYER only, - so sliders and buttons win; the moving layer must carry its own `safeAreaPadding` - because offset content stops painting its safe-area backgrounds). Players read - `\.nowPlayingQueueBeside` and swap their queue button for a same-size hidden placeholder. Scaling a - fixed-geometry cluster uses `NowPlayingFit.scale` + `scaleEffect` + a matching `.frame` — - `scaleEffect` alone keeps the old footprint. (4) **Wide Home splits into two columns, by measured - width** (2026-11-16, branch `duo-wide-home`): at ≥ 560pt of Home content with a track loaded - (`HomeColumns`, iOS only), the hero keeps its UPRIGHT blister pack in a 280–320pt leading column and - favorites / nice list / crate stack beside it. A sideways hero card was built first and REJECTED by - Tim ("still too wide… a little lazy") — don't bring it back (its branch is deleted). - The pill's second line becomes "artist · show" at a ≥ 220pt text column (`PillLayout.showsShowLine`; - Duo flat and landscape iPhones — the upright Duo pill is ~400pt, artist only). Verified on Tim's Duo. -- **Audio/video arbiter: only one plays, the last one DELIBERATELY started wins** (2026-11-08 fix for - audio and video playing over each other). `VideoPlayerService` calls `PlayerService.pauseForExternalAudio()` - on EVERY claim, even one it thinks it already holds; that silences the engine unconditionally and reads - "was playing" from `isPlaying || player.rate != 0`, not the flag alone. While `suspendedForVideo`, - `PlayerService.startPlayback()` REFUSES to start, so an automatic start (a stream resolve or retry landing - after the video took over) can't play underneath. Deliberate audio starts — `startAt` (play/enqueue/jump/ - next/previous; `itemDidEnd`'s auto-advance passes `deliberate: false`), `resume`, `togglePlayPause`, the gapless `next()` — call `takePlaybackFromVideo()` first, - which fires the `yieldExternalOwner` hook → `VideoPlayerService.yieldToAudio()` (pause the video, hand - back with `resume: false`). Any new audio entry point that means "the listener pressed play" must call - `takePlaybackFromVideo()`; one that doesn't will be silently swallowed while a video owns playback. -- Catalog dates are UTC-midnight instants — use `CrateSection.catalogCalendar`, not `Calendar.current` (see the `applenugs-catalog-dates-are-utc` memory). -- **Listening stats are artists-only rolling aggregates with NO event log** (landed 2026-11-07; the Home - "nice list" the Yeti design builds on). `ListeningStats` (the table), `ListeningCredit` (accumulator + - threshold policy, play = min(50%, 240s) LISTENED, not playhead) and `LedgerSummary` (totals, ranking, - copy) are pure Foundation and compiled into `AppleNugsTests`; the `@Observable` `ListeningStatsStore` - writes `listening.json`. Four rules, all of which fail silently if broken. (1) **`PlayerService` owns - the accumulator, not the store** — its credit properties are `@ObservationIgnored` and - `store.credit(...)` is called ONLY at commit boundaries (track change, 30s, pause, background, - terminate), never per tick; a per-tick entry point would make Home re-diff four times a second. - (2) **`HomeView` gates the ledger on `listening.hasAnyPlay`, never on `stats`** — reading the table - from Home's body subscribes the greeting, hero, favorites strip and crate grid to every commit. - (3) **`save()` refuses to write while `loadFailed` is latched**: a file that didn't decode is the only - copy of that history, so it is salvaged per-element and left on disk; `reset()` clears the latch on - purpose. The `-UITEST` guard covers WRITES only — **a screenshot run renders real listening data on - Home.** (4) **Backgrounded iOS has no tick, so credit is SETTLED, not ticked** (`ListeningCredit.span`: - playhead delta capped at wall-clock time since the last sample). `PlayerService.settleListening` runs - at every commit, on the existing 60s background wake, before the tick returns on foregrounding, at a - track's end (at `duration` — a gapless head has already moved on), before a gapless `next()`, and - before a seek, which then rebases the baseline. Settles read `creditPosition`, which is **nil — never the - stale `currentTime`** — when the player's head isn't our item, and a nil sample leaves the baseline alone - (falling back once re-credited a whole closing track at a background queue end). Paused → playing - re-anchors the baseline without crediting (`rebaseListening`). Don't add a wake or a background tick for stats. - Scope cuts are deliberate — don't "restore" them: artists only (no shows/tracks/venues/months), - all-time only, Home only (no sidebar row or tab), typographic ledger (cards/tiles rejected), audio only - (the store seam is neutral so `VideoPlayerService` could become a second caller). Reset lives in the - account menu behind a `.confirmationDialog` (verified presenting from the macOS toolbar `Menu`). - -## START HERE — state as of 2026-11-08 (handoff for a new session) - -**LANDED ON `main` 2026-11-08** (fast-forward of `yeti-design`, Tim's call): everything below, plus three -fixes Tim found living with it on his Duo — audio and video no longer play over each other (`8ed1f93`, -`f77d049`; see Conventions → arbiter), and the bubble's halo clears the hang slot (`ef97eb2`; the card's top -padding is DERIVED from the slot + clearance + halo — don't copy the sheet's 30–34pt tops back). Both fixes -are on Tim's Duo; he confirmed the hang slot ("looks great"), the audio/video fix is awaiting his check. - -**YETI IS THE ONLY DESIGN — stages (d) and (e) BUILT (2026-11-07, branch `yeti-design`, 330 tests, -gate green at e4).** (d) `f1503dc` Yeti-only + the macOS foil focus outline; then the app icon (`8969457`, -"The bubble") and the Duo pill back on the system accessory (`a114586`); (e) e1 `653769c` transport + -miniplayer variants deleted, e2 `cb040e4` art-color pipeline + wash + grain deleted, e3 `8bf351d` every -caps branch collapsed to Yeti's side, e4 (the commit after it) `Theme` stripped to ONE token struct — -`ThemeID`, `ThemeManager`, `Capabilities`, `TransportSignature` and the five theme literals gone, the -off-palette hex folded into `Palette` (see Conventions → Design system). iOS sim screenshots were -pixel-identical stage to stage (bar the clock and Home's random crate row). **Next:** (1) ~~the whole-branch -review~~ done; (2) a visual pass on the iPhone sim, the Duo sim (both -displays) and the Mac (seeded launch) against the three design pages; (3) a device install on Tim's Duo; -(4) the hardware-only checks listed below ("Unverified, needs hardware") plus Mac keyboard focus showing -the foil outline (not the system ring) on our own controls — Keyboard navigation ON, Tab to Login's "Sign in with nugs.net", Album's "Play all", Follow: if BOTH rings show, `.focusEffectDisabled()` inside the Yeti ButtonStyles doesn't reach the Button, so add `.macFocusEffectDisabled()` at the `.yetiPrimary`/`.yetiSecondary` call sites (the four `.plain` sites already have it). Also glance at the Mac `EntryTile` icon, drawn in foil (pre-existing; foil is meant only where time moves). Review of `9c879d9..HEAD` (2026-11-07): no must-fix; its one should-fix (soft edge effect not reaching pushed screens on the folded Duo) is applied. Spec: `docs/superpowers/specs/2026-11-07-yeti-only-design.md` (local). - -*History — stage (c), kept for its decisions and its unverified list:* Yeti was built as a selectable sixth theme covering every surface (spec/plan local: `docs/superpowers/specs|plans/2026-11-07-yeti-theme-six*`). -Commits `9792b1b`..`8cec8e9`: tokens/caps/rootTint → stickers → BlisterPack + FoilSweep → now-playing card → -panel/dashboard/Mac mini/transport bar → Home (+ iPhone hero) → browse → video → front door + app-wide copy → -polish (`25c1f9b`) → two review-fix commits. A Debug build of tasks 1–8 is on Tim's real Duo; he said "this looks -great". Gate script + sim screenshot script live in the session scratchpad (gone with it): rebuild them from the -plan's "Shared rules" if needed. **Next, in order:** (1) the Duo pill SHELF (`docs/design/yeti-theme/yeti-pill-shelf.html`, -awaiting Tim's OK on the motion) — design guard: ignore scroll deltas while the shelf animates, or a fold at the -bottom of a page reads as a scroll up and bounces the pill back — Tim APPROVED the motion ("the pink swipe looks -really good… it's fun"), BUILT (`17f0f12`, `3ccfb93`) — then **REVERSED the same day**: on his Duo the system's vertical tab rail crossed the shelf's lip, and Tim chose **FULLY SYSTEM** ("I would rather follow the system guidelines than run anything that needs like custom stuff"): the Duo uses Apple's `tabViewBottomAccessory` like every iPhone, the system's scroll edge effect handles content under it, and the custom overlay, duck, shelf, `PillDuck*` and `-UITestPillTucked` are removed. Accepted trade: on the folded Duo the pill no longer tucks away on scroll. Don't rebuild a custom pill overlay/shelf/rail; see the `feedback-system-guidelines-first` memory. (`yeti-pill-shelf.html`, `yeti-rail.html` are history.) (2) stage (d) — DONE `f1503dc` Yeti-only + Mac foil focus, (3) stage (e) delete the five themes — -spec `docs/superpowers/specs/2026-11-07-yeti-only-design.md` (local), approved: Yeti on launch with NO migration -(Tim: "no one's really using this app… it's only on my phone" — he is the only user; never design for other -users' saved state here), foil focus on our own controls only, the art-color pipeline deleted, ONE `Theme` token -struct kept. (4) A new app icon — Tim chose the BLISTER PACK direction; concepts in `docs/design/yeti-icon/`; **Tim picked -concept 2, "The bubble"** (the bubble filling the tile, holding the yellow playing sticker with its four stepping -bars, one thin foil glint on the rim) as-is — "that's the right choice", no tweaks. The whole-branch review listed the collapse hazards for (d)/(e) (ALL RESOLVED in e1–e4): ~8 `tintIfSet(plainVoice ? x : nil)` -sites, ~20 per-view `plainVoice`/`stickers` computed properties, `.stickers`-before-`.equalizerRows` precedence -checks (DashboardPanel queue slot, `titleBlock`, CrateHeader), `card ? X : 0` paddings in `NowPlayingScreen` (was `StandardNowPlayingScreen`), -two resume cards (`HomeView.resumeCard` + `YetiResumeCard`), duplicate helpers `yetiShowAction` (AlbumDetailView) ≡ -`videoSave` (VideoDetailView), dead `MiniPlayerTransportTriad.Style.sticker` path, off-palette hex (`YetiSegmentedControl` -thumb 0x2A355A, `VideoErrorMessage` backdrop 0x05070D), `IdleCopy`'s defaulted fields. **Unverified, needs hardware:** -iPhone Home hero tap arbitration (meta link vs card `.onTapGesture`), `ExpandedPlayerPanel` fitting 250pt, FoilSweep on a -real track change, price sticker across a track change, back label after `toolbar(removing: .title)` on the artist page, -Mac Playback ▸ Clear Queue `NSAlert` in each window state, VoiceOver on the hero/segmented control/login. Known nits left: -`SearchView.sentenceCased` turns "DJ SETS" into "Dj sets"; `YetiSegmentedControl` isn't one arrow-key control on macOS. - -**Where the code is.** Worktree `.claude/worktrees/iphone-duo` (stay in it; don't cd to the main checkout). -- **`main` == `origin/main` == `e6ab835`** — everything above is LANDED: the iPhone Duo work (PR #5) and the - pill duck (since REMOVED — the Duo uses the system accessory, see Conventions) + Yeti compliance/rename/encrypted downloads/perf + the theme design (PR #6, merged 2026-11-07, - CI green on `xcode-27`, fast-forward — every hash in this file is on `main`). 307 tests. -- **Listening stats LANDED on top (2026-11-07)** — `listening-stats` rebuilt on this base as - `listening-stats-rebased` (Tim's feature commit replayed as-is, plus a fix crediting background - listening — see the Conventions bullet), fast-forwarded onto `main`. **338 tests.** The old - `listening-stats` branch in the main checkout is superseded and can be deleted (Tim's call — it's - checked out there, so it can't be touched from this worktree). -- **`yeti-design`** (no upstream) — the branch for the single-design refactor (step 3 below); fast-forward - it to the new `main` before starting. -- Local `main` ref is synced to `e6ab835` (fast-forwarded from inside the worktree with - `git branch -f main origin/main` — the worktree shares the repo's refs, and `main` isn't checked out - anywhere; `git -C …` / network fetches from Tim's remote-control `!` shell fail). Remote branches `iphone-duo` and - `yeti` are merged and can be deleted on GitHub (Tim's call). -- **Listening stats, still unverified on screen** (a green build can't see these): ~~the ledger - POPULATED~~ — SEEN on Tim's Duo 2026-11-16 ("2 hours listened · 1 artist", in Home's right column); - **locked-screen credit on the Duo** (play a - show locked for 5+ min, unlock, the artist's time should include it; `debugBackgroundTicks` must stay 0); - the iOS reset dialog and that Reset empties the ledger; row tap → `ArtistDetailView` (an unresolvable - name should be inert text); long name vs the `19 plays · 31h` block at the narrowest Mac window; Dynamic - Type / VoiceOver; a duration-less stream earning its play at 4 min, not before. Accepted, not defects: - the `Artists` total counts artists with seconds but no play yet; hours truncate; `firstPlayedAt` / - `lastPlayedAt` are stored but unused. The ledger will be restyled by the Yeti design anyway. - -**Landing recipe (used for PR #5 and #6):** push the branch, open a PR (CI runs on the `xcode-27` runner), -then `git push origin :main` — fast-forward only, never a merge/rebase, so hashes here stay valid. -Pushing is Tim's call. - -**Next steps, in Tim's order of interest:** -1. (done 2026-11-07 — both branches landed via PR #6.) -2. **Finish verifying Yeti on hardware:** logout wipes downloads; the **Mac** build (old plaintext downloads - there must migrate to sealed `.yeti`; Reveal in Finder is gone). Mac local installs must be Developer - ID-signed (see the local-install-signing memory). -3. **DECISION (Tim, 2026-11-07): Yeti becomes the ONLY design, on macOS and iOS — the five themes go** - (reverses the Aug-2026 "keep all themes" call). Staged plan proposed: (a) land the branches; (b) design pass - for surfaces the mockup doesn't cover (video, search, downloads, login/connection-failed, Duo two-column + - pill-duck overlay [history: overlay since removed, system accessory], Mac Now Playing window, sheets, toasts); (c) add Yeti as theme #6 through the existing - token system and verify on device; (d) make it the only theme (remove pickers, force dark); (e) delete the - five themes, transport variants, art-color pipeline, wash/grain, ThemeID/ThemeManager (~2,300 lines); keep - ONE token struct as the design system. The Home "nice list" ledger is `ListeningLedger` (landed - 2026-11-07). Spec it before building. Source design: `docs/design/yeti-theme/yeti-theme.html` - (+ `.png`, and the three concepts it beat). It carries a token sheet that maps 1:1 onto `Theme` fields and a - "Wiring it in" list (ThemeID `.yeti`, EqualizerBars branch, play-sticker sites, FoilSweep, BlisterBubble — - HISTORY: ThemeID and EqualizerBars are deleted now). **STATUS: stages (c), (d) and (e) are all BUILT — see - the top of START HERE.** The rest of this item is the record of how it was decided. - Never quote the song's lyrics in the app or docs (copyrighted) — paraphrase only. - **Decisions taken at kickoff (Tim, 2026-11-07, session on `yeti-design`):** (b) the design pass comes FIRST, - before any Swift (Tim chose it over building theme #6 for the mocked surfaces straight away); the FULL - play sticker ships (Home hero, iPhone now playing, Mac mini triad — not the price-sticker fallback); the - copy "It's on its way" / "Here it comes" / "Says so on the box" / "Coming up next" / "The nice list" is - cleared as paraphrase, not lyrics; the macOS custom foil focus outline is DEFERRED to stage (d), when - Yeti is the only theme. The superpowers skills were not installed in that session, so the - brainstorm → spec → plan steps are being done by hand. Design-pass output: - `docs/design/yeti-theme/yeti-surfaces.html` + `.png`, beside `yeti-theme.html` (UNCOMMITTED until Tim - says so). **Tim's rulings (2026-11-07, via `yeti-decisions.html`), all final:** (1) iPhone Home gets a - hero = the Mac's resume card ported (what's playing; absent when nothing is loaded) — NOT a "newest from - artists you follow" card, which the first sheet's label implied and which doesn't exist; (2) the Artists - list stays names only, no per-artist show counts (the catalog list is name + id only; a fan-out would - break polite networking); (3) the now-playing counter stays "Track 3 of 24" (sentence case); set-aware - "Set 2, track 3 of 6" is a later follow-up; (4) the Mac Home resume card is a FLAT cover on card stock — - the Mac's bubble belongs to the dashboard miniplayer (and the Now Playing window, drawn as a second bubble - on purpose). Proposals all accepted: "Sign out" app-wide (Title Case "Sign Out" in menus; replaces "Log - Out"); all three clear-queue paths confirm with "Playback stops and the whole queue empties." - (`PlayerService.clear()` empties the whole queue AND stops playback); the app's real tabs and sidebar - stay; Signal keeps its six constant rows (restyle only); system traffic lights stay. Every new copy line - on `yeti-surfaces.html` is cleared as not-lyrics. `yeti-decisions.html` is the walkthrough Tim answered - (needs a real browser — the Claude browser pane renders local files with scripts disabled). - **Tim, after living with theme #6 on his Duo (2026-11-07): "this looks great, make this the default - experience"** = Yeti becomes the ONLY design (stage d, then e) — confirmed over "Yeti default, keep the - picker". Also (HISTORY — built, then REVERSED 2026-11-07 for the system accessory; see Conventions): the Duo's own pill overlay (vertical tab bar) crowds busy content, so the pill gets its - OWN SHELF — content stops above it instead of running under it, and when the pill ducks the shelf - folds shut with a Yeti-style motion and content eases into the freed space (chosen over moving the - pill to the top, or keeping it floating over a fade). Design that motion as a mockup before building. - **Stage (c) spec:** `docs/superpowers/specs/2026-11-07-yeti-theme-six-design.md` (local-only; awaiting - Tim's review as of 2026-11-07). Its load-bearing decisions (the caps gating is HISTORY — the caps and - `theme.id` are deleted; the rest still holds): gating by four caps (`.blisterPack`, `.stickers`, - `.foilSweep`, `.plainVoice`), never `theme.id`; the ROOT TINT is snow (`palette.textPrimary`, set by - `ThemedRoot`), and foil is applied explicitly only where time moves (scrubs, ring, sweep, - caret, download/resume progress) — otherwise every prominent control turns into a pink fill; the price - sticker's PRESENCE keys on `player.current`, its text on the pick (unknown pick → "Lossless", known - non-lossless → hidden) so it never blinks at a track change; `EqualizerBars` sites are decided one by - one (queue → 16pt row sticker, setlist → new 20pt site, title + crate header → nothing); "Listen - offline" keeps today's downloads-exist gate. The page is assembled from `yeti-theme.html`'s CSS + drawings by a - splice script; to edit it, edit the HTML directly. -4. **Nightstand / tent** (Tim chose all three: propped-open player with clock + night dimming, tent-pose - landscape player that auto-opens, StandBy Now Playing widget). Start with a DEBUG pose probe (hinge - status/angle, division regions, display) Tim screenshots in each pose. See the NEXT block below. -5. Small follow-ups: regenerate the README banner SVGs (`scripts/generate-banner.swift` still writes - "APPLENUGS") and re-shoot `docs/images`; decide the `.app`/`PRODUCT_NAME` rename (DISTRIBUTION.md lays out - the Sparkle trade-off); goosealmanac's deep-link doc should mention `yeti://`; `VideoPlayerService` still - pushes Now Playing every 0.5 s during video; consider asking nugs.net for an official OAuth client (the - one thing honesty can't fix unilaterally). - -**Session gotchas:** the claude-artifacts publishing tools stopped working mid-session on 2026-11-07 (restart -fixes it). The worktree-isolation shell guard rejects compound commands with variables/loops and `git -C` -outside the worktree — use plain commands or a `zsh` script in the scratchpad. Disk on this Mac runs tight -(~10 GB free): always delete DerivedData after a gate. Local-only specs for all of the above live in -`docs/superpowers/specs/2026-11-0{5,6}-*.md` (gitignored — they die with the worktree; the decisions are -copied into this file). - -## Pick up here — state as of 2026-08-18 - -*HISTORY. Written while five themes existed: the Soundboard/Tape Room/Shoebox/The Receiver/Click Wheel -names below refer to deleted themes and players; the measurements, recipes and rules still hold.* - -### iPhone Duo layout — MERGED to `main` (`805d766`, PR #5, 2026-11-06); CI green on `xcode-27` - -**Landed:** pushed as `iphone-duo`, PR #5's CI passed (first run on the `xcode-27` runner, 2m24s — the -label resolves and Xcode 27.1 builds both schemes + tests), and `origin/main` was FAST-FORWARDED to -`805d766` (`git push origin worktree-iphone-duo:main`; GitHub then marked the PR merged) — no merge or -rebase commit, so every hash below is on `main`. `listening-stats` is still unmerged and based on the OLD -`main`; it now needs a rebase onto `805d766`, resolving this CLAUDE.md section against its own. - -### Yeti — compliance pass (2026-11-06/07), branch `yeti` stacked on `pill-duck`, NOT pushed - -The app is now **Yeti** ("an unofficial player for nugs.net", named for the Goose song) and follows nugs.net's -Terms (https://www.nugs.net/terms.html) where it matters. Spec (local): `docs/superpowers/specs/2026-11-06-yeti-compliance-design.md`. -Commits: `f7378f7` personal IDs out of CLAUDE.md · `a9dd016` `NugsIdentity` seam + DEBUG Network Probe · -`cc8d54a` honest identity / tier 7 / browser-only sign-in / polite networking · `993ce03` Yeti rename + -disclaimers · `2db580f` encrypted downloads. **302 tests.** Rules that fail silently if broken: -- **Identity is honest everywhere:** `NugsIdentity.current` = `Yeti/ (unofficial; +github; )`, NO - Referer. The old Android UA strings exist ONLY as the DEBUG probe's control (`legacyAndroidForProbe`) — never - reintroduce them in production. Live probe (Tim's Duo, 2026-11-07) proved nugs accepts the honest UA on - subscriptions, api.aspx, subPlayer (all tiers), the CDN, and id.nugs.net refresh. The OAuth client ID + - `nugsnet://oauth2/callback` are still the official app's — unavoidable without a nugs-issued client (NOTICE says so). -- **Streams: tier 7 (ALAC 16) first, other tiers ONE AT A TIME** (`StreamTierPlan`); never re-parallelize. - Tier map: 1 FLAC16, 4 MQA24, 7 ALAC16, 10 MQA24. Token bucket 4 req/s (burst 8) on API/resolver calls. -- **Browser sign-in only** — the ROPC password screen is gone; don't bring it back. -- **Downloads are sealed `.yeti` files** (64 KiB AES-GCM chunks, per-install Keychain key `download-key`, - `yeti-local://` + `SealedAssetLoader`). Never write or keep plaintext; logout deletes all downloads + the key; - offline play needs `downloads.lastVerifiedAt` ≤ 30 days, renewed ONLY by a fresh subscription answer - (re-fetched on each token refresh). No Reveal in Finder / export. -- **Display-only rename:** bundle ids `com.timvbs.applenugs*`, `Application Support/AppleNugs/`, Keychain - service, Sparkle feed + EdDSA key, the repo, and `PRODUCT_NAME` (`AppleNugs.app`) are DELIBERATELY unchanged; - `yeti://` added, `applenugs://` kept (goosealmanac). Follow-ups: regenerate the banner SVGs - (`scripts/generate-banner.swift`), re-shoot `docs/images`, decide the `.app` rename, update goosealmanac's - deep-link doc. -- **Verified on Tim's Duo:** honest identity (signed in, plays), Yeti name, encrypted download → seek + gapless - ("even better than streaming"); **performance** (`8c3c0d7`): locked-screen playback of a downloaded show - peaked at **60.9 MB for the whole app** (3.24 GB jetsam headroom), **0 background ticks**. The key is - `isEntireLengthAvailableOnDemand = true` in `SealedAssetLoader` — without it AVFoundation buffers the whole - file (134 MB per FLAC track); a test fails if it's removed. The 0.25 s player tick is removed in the - background (once-a-minute resume save only) — don't reintroduce periodic background work. - Unverified: logout wipe, the Mac migration. - -**NEXT (queued, specced locally):** (1) the pill ducks out of the way on scroll on the Duo — **BUILT -`ed6770d` and VERIFIED by Tim on the real Duo 2026-11-06 ("nailed it"), 197 tests; not yet pushed** — branch -`pill-duck` in the same worktree; spec `docs/superpowers/specs/2026-11-05-pill-duck-on-scroll-design.md`; -probe verdict: the system accessory can't be animated (toggling `isEnabled` pops/crossfades AND reflows the -content 38–56pt), so where `\.toolbarVerticalEdge != nil` (iOS 27.1+) the pill becomes our own glass overlay -with a constant bottom content margin. **[HISTORY — REVERSED 2026-11-07: the overlay, its duck and the later -shelf are removed; the Duo uses the system `tabViewBottomAccessory` like every iPhone. See Conventions.]** -(2) nightstand/tent — spec -`docs/superpowers/specs/2026-11-05-duo-nightstand-tent-design.md`: propped-open player (art + title + -clock above the fold, dims at night), tent-pose landscape player (auto-opens; app otherwise stays portrait), -and an interactive StandBy Now Playing widget (first widget extension + App Group). No posture enum exists — -`onHingeChange` gives only status (closed/partiallyOpen/fullyOpen) + angle. - -Worktree `.claude/worktrees/iphone-duo`, based on `origin/main` `c0de287` — deliberately NOT on the -unmerged `listening-stats` branch. -Spec/plan/probe evidence are local-only under `docs/superpowers/` (`specs/2026-11-05-iphone-duo-layout-design.md`, -`plans/2026-11-05-iphone-duo-layout.md`, `duo-artifacts/`). The decisions they hold, so they survive the worktree: - -- **Scope (Tim):** compatibility fixes + a two-column inner-display now-playing (player primary, `DashboardPanel` - queue secondary via iOS 27.1 `ArrangementView`, `.split.axes(.horizontal)`). NOT sidebar-instead-of-tabs, - two-column browse, multi-window, outer-display landscape, `ReservedRegion`, hinge effects, or any macOS change. -- **iOS floor stays 26.1**; every 27.1 API behind `if #available(iOS 27.1, *)`. **CI moves to Xcode ≥ 27.1** - with a loud `xcodebuild -version` assertion (26.6 can't compile 27.1 symbols even behind `#available`). -- **Upright inner display:** first "player alone"; Tim REVERSED it after the real-Duo pass — the queue column sits beside the player upright too. -- **Phase 0 probe of the UNCHANGED app (Duo simulator, 27.2 SDK), verdicts:** outer display — tab bar goes - VERTICAL on the trailing edge; the pill survives at the bottom but ~290pt wide while still `.expanded`, so - all five controls leave the title at "Aw…" (`PillLayout` sheds controls by placement only — defect). - Inner display — **landscape when unfolded flat (2853×2007 px ≈ 951×669pt)**, NOT the quoted 626×890; - pill fine; **the full-screen player overflows vertically in Soundboard/Tape Room/Shoebox/Click Wheel** - (header + bottom row off-screen — no queue, no dismiss button). Only The Receiver fits. Caveat: all - probe shots show the MONOGRAM (rigid `MonogramTile(size: 280)`); real artwork is unprobed. -- **BUILT (2026-11-05)** — gate green at `4f88075` (later `805d766`, 175 tests): both schemes warning-free, - `AppleNugsTests` **149**. Commits: CI → `xcode-27` runner pinned to `Xcode_27.1.app` with a version - assertion (`016a991`, **never run — first push verifies the label**); pill sheds controls by measured - width (`25086ad`); placeholder monogram scales so the Standard player fits (`8ea1533` — this ALSO fixed a - pre-existing ~15pt overflow on portrait iPhones whenever a track had no art); Click Wheel fits - (`e577df3`, pure `NowPlayingFit`); groundwork (`3e7ee68`); `NowPlayingArrangement` (`722a46c`); review - fixes (`4f88075`: playback error kept in the queue column, secondary counted not flagged). -- **Measured in the split (Duo sim, unfolded flat):** an even 50/50 of the safe area, two 433.5×635pt - columns, each COMPACT — so the 520pt readable-width cap only fires when the player is alone on regular - width (upright inner display). Art in the split ≈84–112pt (smallest: Click Wheel, Tape Room). -- **VERIFIED on the Duo simulator at `4f88075` (Tim folding in Device Hub, no relaunch between shots):** - fold with the cover open → player alone on the outer display with its queue button BACK, state kept — - **the arrangement REMOVES the secondary when it can't split** (the assumption behind - `nowPlayingQueueBeside`; keep the counter); unfold → split and hidden button restored; folded tab root - → pill reads "Away From th…" with prev/play/next + chevron (was "Aw…"). -- **Installed on Tim's REAL Duo 2026-11-05** (`iPhone19,4`, iOS 27.2; UDID in the local `applenugs-iphone-duo` memory). - Device-install recipe that worked, in order: Developer Mode ON (Settings → Privacy & Security; the - phone restarts, and CoreDevice shows it `unavailable` for a minute after — wait, don't re-pair); - build against the SPECIFIC device — `-destination 'platform=iOS,id=' -allowProvisioningUpdates - -allowProvisioningDeviceRegistration` — because a `generic/platform=iOS` build never registers a new - phone and the install then fails with `0xe8008012 … profile cannot be installed on this device`; and a - pending Program License Agreement blocks device registration outright ("PLA Update available") until - Tim accepts it at developer.apple.com/account. `xctrace` kept listing the phone "offline" while - `devicectl list devices` correctly showed it `available (paired)` — trust `devicectl` for this. -- **Real-Duo pass (Tim, 2026-11-05):** ✓ split with real art + ALAC; ✓ upright (then player-alone); - ✓ pill panel; ✓ Split View beside another app (player alone at half width); ✗ swipe-down never worked - on any iPhone → **added** (`e51c771`). Tim then asked for the **queue column upright too** → `fd2aa01` - (sim upright 669×951pt → 409 + 260pt columns; every player verified at a forced 300pt column; also fixed - Click Wheel's pad never shrinking below 330pt — a max-only frame reports max(child, proposal)). 173 tests. -- **Still unverified:** swipe-down on hardware (esp. drags that START on a slider thumb or a button); - upright columns on the real Duo (its status strip is on the trailing edge, so ~535pt → 300 + 235); - rotating upright↔flat with the cover open (rebuilds the player — documented trade-off); book pose; - the queue sheet on the inner display; CI's first run. -- **Simulator facts:** the Duo needs its OWN runtime, iOS 27.1 `24A94425` (Duo-only; the general 27.2 - runtime can't create a Duo). Xcode 27 has no Simulator.app — Device Hub; folding/rotating are on-screen - controls only (no `simctl` posture command), so pose changes need Tim. `simctl io … screenshot` needs - `--display=1` (outer) or `--display=3` (inner). The iOS 26.2 runtime was deleted 2026-11-05 to free disk. - -**v1.5 (build 6) is RELEASED** (bump `943f573`, appcast `305b64f`): the clickable now-playing -metadata (`22aab49` artist/show line, `cfe9957` pill + Home hero) and the inspector Signal -constant-shape fix (`9c5e8d3`). The Sparkle 1.4→1.5 loop was not re-validated in-session; -the pipeline is the same validated Path B as v1.3/v1.4 below. - -**`DeepLinkMatch.normalize` now carries the SITE's venue rule** (`59efbd1`, pushed, CI green -at 131 tests): apostrophes (ASCII + U+2019) deleted outright, every other non-alphanumeric -run collapsed to one space — so "Slim's" matches a hint of "Slims" and "St-Denis" keeps -matching "St Denis". The rule ALSO feeds `bestTrackIndex` (an improvement there: "Hót-Tea!" -→ "hot tea"). Decision + evidence live in goosealmanac's -`docs/superpowers/specs/2026-08-18-nugs-web-links-design.md`; don't "simplify" it back to -delete-all-punctuation — that was the old, weaker rule. - -**Cross-repo, same day (matters to this app's deep-link story):** goosealmanac shipped -exact nugs.net web links (nightly catalog import → `shows.nugs_container_id`; -`play.nugs.net/release/` fallbacks; an "Open on nugs.net" chip) and a `/listen-links` -page documenting the whole button family including `applenugs://` — merged as PR #12 -(`ee4ec13`), live in production, first import verified (476 of 855 shows resolved, -2026-08-18). The deep-link contract doc (`docs/integrations/applenugs-deeplink.md` there) -was corrected: its web-fallback section, and the fictional "presents the matches" picker — -**this app has no picker; `DeepLinkRouter` takes the first same-date match when no usable -venue hint is given.** If a picker ever gets built, update that doc and the site's -`/listen-links` copy. Residue: Tim verified the app-less -fallback on 2026-08-18 — a machine without AppleNugs forwards to nugs.net after the ~1.2s -race, as designed. Still owed: signed-in spot-check of `play.nugs.net/release/46887|46884|46883`. - -### Earlier state (2026-08-10 → 2026-08-17) — HISTORY; still-true details below - -Written when there were five themes and an art-driven accent. Since the Yeti-only refactor (2026-11-07) the -pill ring is tinted `palette.accent` (static foil), there is no `\.artColor`/`effectiveAccent(art:)`, and the -faceplate/click-wheel/cassette surfaces named below are deleted. The pill's structure, the circle clip and -the accessory facts still hold. - -**The iOS now-playing pill is SHIPPED — merged and pushed.** `main` == `origin/main` == `11dae49`, tree clean, no worktrees, no stale branches. The 10-task plan (`docs/superpowers/plans/2026-08-10-ios-nowplaying-pill.md`, spec `docs/superpowers/specs/2026-08-10-ios-nowplaying-pill-design.md`, both gitignored/local-only) replaced the iOS full-width bottom transport bar with a Liquid Glass pill hosted in `tabViewBottomAccessory`. Both defects the iOS parity review diagnosed are structurally gone: the pill lives on the `TabView`, so it rides above pushed detail screens for free, and the toast's hardcoded `.padding(.bottom, 78)` is replaced by a plain `8` anchored to the NavigationStack. - -**The pill's progress ring is MERGED and PUSHED** (2026-08-11; `main` == `origin/main` == `7d2c318`, tree clean, branch deleted). Reviewed clean; **device verification is PARTIAL — see below.** Spec `docs/superpowers/specs/2026-08-10-pill-progress-ring-design.md`, plan `docs/superpowers/plans/2026-08-10-pill-progress-ring.md` (both gitignored/local-only). `PillSeekEdge` is deleted entirely (drag, 20pt hit strip, hairline) — scrubbing belongs to the expanded panel and the full-screen player, both of which have real sliders. In its place `PillProgressRing` draws a 2pt arc around the 32pt leading slot, tinted `theme.effectiveAccent(art:)` (today `palette.accent`), empty when `duration <= 0` (a full ring on a no-duration stream would read as "finished" — same defect `11dae49` fixed on the sliders). **`PillLeadingSlot` collapsed from five themed variants to one uniform `ArtChip`**; **no themes were removed** (considered and explicitly rejected) — theme identity stays in the full-screen player, palette, type and the Mac miniplayer. `PillLayout.seekEdgeHeight` / `seekHitHeight` / `controlsTrailingInset` and their three tests are gone; `ringLineWidth`/`ringGap`/`artChipSize(slot:)`/`progressFraction(currentTime:duration:)` replace them. Gate at HEAD: both schemes `** BUILD SUCCEEDED **` warning-free, `AppleNugsTests` `** TEST SUCCEEDED **` at **98 tests**. - -**One design decision worth not re-deriving: the art chip is clipped to a CIRCLE.** `artChipSize` yields 26pt as an *inscribed-circle diameter*, but `ArtChip` renders a rounded square whose corners reach r≈16.9 against the ring's inner edge at r=14 — so a square chip put the accent arc on top of the cover across roughly half its circumference, worst on the art-driven themes where the arc *is* the cover's dominant color. `.clipShape(Circle())` (applied before the 32pt `.frame`, so it clips the 26pt chip) holds the 1pt `ringGap` at every angle. The rejected alternatives were a ~20pt square (clears the ring but wastes the slot) and a rounded-rect track (non-uniform angular speed). - -**Device verification — what's CONFIRMED on a real iPhone 16 Pro (iOS 27.0, real logged-in session, 2026-08-11):** the circular art chip renders clean with **no keyline slivers** at 12/3/6/9 — that computed-remnant worry is closed, `ArtChip` needs no `shape` parameter; the **background track ring renders** with its gap holding all the way around (no arc-on-artwork, which was the whole point of the circle clip); chevron → `ExpandedPlayerPanel` still reaches scrub row, five controls, favorite star, ALAC badge, AirPlay and Queue. `\.artColor` is reaching the app generally — the tab tint picked up the cover's magenta, not the amber fallback. - -**[Partly moot since stage e2: no art-driven accent exists, so the `\.artColor` propagation question is closed; the arc's advance, the empty ring on a no-duration stream and the other items below are still unconfirmed on hardware.]** **Still UNCONFIRMED, and the one that matters:** the **accent arc itself**. Every screenshot so far was taken seconds into a 25-minute track, where the fraction is ~0.013 → an arc of about 4.6°, i.e. a pixel and a half. **The test is: scrub to ~50%, then look at the pill.** Half the ring in the cover's accent = the arc advances AND `effectiveAccent(art:)` resolves inside the tab accessory (which nothing had ever read there before). Half the ring in amber = `\.artColor` is not propagating into `tabViewBottomAccessory` and needs fixing. Also still owed: ring **empty, not full**, on a no-duration stream (livestream/webcast — the one case with a real defect behind it); legibility at `.inline`; the ~0.25s stepping (the trim has no `.animation` by design — add one if it stutters); gestures (the pill now has NO drag gesture at all, so a vertical swipe should go straight to the tab bar's scroll-to-minimize); and the offline Downloads sheet mount. - -**Known accepted cost:** VoiceOver loses the pill's at-a-glance position *value* — the deleted seek edge exposed "Playback position" + a formatted `accessibilityValue`, and the ring is `accessibilityHidden`. Nothing became unreachable (both accessibility actions are applied unconditionally on the `onExpand != nil` path, including at `.inline`, and both destinations have real sliders), but the announcement is genuinely gone. - -**iOS deployment floor is 26.1** (raised from 17.0 — `tabViewBottomAccessory(isEnabled:)`, the overload that reclaims the slot when nothing is playing, is 26.1+; the plain `content:` overload is 26.0 but can't free the 48pt slot. See the comment in `project.yml`). `TransportBar`'s iOS `compactBar`/`MiniProgressStrip`/`compactNowPlayingBlock` are deleted; `TransportBar` renders `EmptyView` on iOS. `TransportBar.format(seconds:)` and `NowPlayingFavorite` stay — used on both platforms. - -**What the pill is:** a glass capsule in `AppleNugs/iOS/NowPlayingPill/` (`PillLayout` is pure policy, SwiftUI-free, compiled into `AppleNugsTests` directly): a 32pt leading slot (one uniform `ArtChip`, circle-clipped, wrapped in `PillProgressRing`), title + artist, five transport controls, and a trailing chevron. No seek affordance — see the ring note above. Tap opens the full-screen `NowPlayingScreen`; the chevron opens `ExpandedPlayerPanel` (art, title, venue, favorite star, scrub row, five controls, AirPlay, format badge, Queue → `DashboardPanel`). At `.inline` it degrades to title-only + play/pause + next per `PillLayout`'s pure degradation table. The offline Downloads sheet mounts the pill by hand with `onExpand: nil` (sheets can't host a tab accessory) — the one legitimate duplicate. - -**Three hard-won facts, don't re-derive them.** (1) **`tabViewBottomAccessory` measures 360×48pt expanded, 284×48pt inline; the height is system-owned with no API knob** — see the `applenugs-ios-tab-accessory-geometry` memory. (2) **A `.sheet` attached INSIDE the accessory runs its content's body but never appears** — the accessory is a system-hosted container, not a presentation context; the shell presents the panel and the pill takes an injected `onExpand`. (3) **The drag-up gesture loses to the tab bar's own scroll-to-minimize handling** — that's why there's a chevron. Also: `TabBarMinimizeBehavior` has only `.automatic/.onScrollDown/.onScrollUp/.never` — there is no "always minimized", so a permanently one-row bottom is not reachable without abandoning the accessory. - -**Verified on a real iPhone 16 Pro (iOS 27.0), with a real logged-in session:** the pill survives a push to `ArtistDetailView` (the core fix); tap opens the full-screen player; the transport buttons keep their own taps (the container tap does NOT steal them — measured both ways); the chevron opens the panel and its Queue button reaches `DashboardPanel`; the panel is legible with real art and an art-driven accent; drag-to-seek on the pill's edge worked (that affordance has since been **replaced by the progress ring** — see above, so this line is history, not current behaviour); and **the `.inline` collapse works and looks good** — tab bar shrinks to the Home button with the pill folded in beside it. All five themes (since deleted) verified at the tab root in the simulator. Gate: both schemes `** BUILD SUCCEEDED **` warning-free under `SWIFT_STRICT_CONCURRENCY=complete` bar the known `appintentsmetadataprocessor` one; `AppleNugsTests` `** TEST SUCCEEDED **` at **94 tests**. - -**Still unverified, honestly:** the offline Downloads sheet's pill (needs a real `.connectionFailed` state), VoiceOver behaviour anywhere in the pill, Dynamic Type at accessibility sizes against the panel's fixed `.height(250)` detent, and the keyboard-up triple-stacked-chrome risk carried over from the parity review. Evidence ledger + screenshots + all task briefs/reports/review diffs: `docs/superpowers/pill-artifacts/` (gitignored, local-only). - -**`11dae49` fixed a cross-cutting scrub bug:** `sliderMax = max(duration, 1)` meant a stream reporting no duration pinned the thumb hard right, reading as "finished". Fixed on four iOS surfaces (`NowPlayingScreen`, `ClickWheelScreen`, `TouchFaceplate`, `ExpandedPlayerPanel`), and **the two macOS surfaces are now fixed too** — `FaceplateTransport` and `TransportBar.seekBlock` (`be51ccf`, merged to main). **Since stage e1 deleted `ClickWheelScreen`, `TouchFaceplate` and `FaceplateTransport`, three scrub surfaces remain, all carrying the guard: `NowPlayingScreen`, `ExpandedPlayerPanel`, `TransportBar.seekBlock`**; grep `player.duration > 0 ? min(player.currentTime, sliderMax) : 0` to confirm the count is still three, and give any new slider the same guard. (The Mac miniplayer's `MiniPlayerScrubTrack` is a custom track, not a `Slider`.) - -**TOOLCHAIN — check it, don't assume it.** **As of 2026-11-05 `xcode-select` points at Xcode 27.2** (`/Applications/Xcode.app`, iOS SDK 27.2, Swift 6.4.2); unchanged `origin/main` builds both schemes warning-free on it. The 26.6 note that follows is history. As of 2026-08-17 `xcode-select` points at the **stable** `/Applications/Xcode.app/Contents/Developer` (Xcode 26.6, build 17F113), which is also what CI now uses, so local and CI agree. The durable fact behind the old warning still holds: **CoreDevice's developer disk image comes from the *selected* Xcode, not from `DEVELOPER_DIR`**, so installing to Tim's iPhone while it runs a newer iOS than the stable SDK supports means selecting the beta first — and switching back before any release work, since the notarized DMG and Sparkle build from the same `project.yml`: - -```sh -xcode-select -p # check first -sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer # device install -sudo xcode-select -s /Applications/Xcode.app/Contents/Developer # back for releases -``` - -**Device-install recipe that actually worked** (`APPLENUGS_TEAM_ID= xcodegen generate`, then `xcodebuild -destination 'generic/platform=iOS' -allowProvisioningUpdates`, then `xcrun devicectl device install app`): `devicectl list devices` showed a **stale identifier stuck at `connecting` forever** and every call against it hung. `xcrun xctrace list devices` reveals the **real** UDID (`00008140-…`) and the device's iOS version. The actual unblocker was **untrust + retrust on the phone**, which rebuilt the pairing record; a connected VPN turned out NOT to be the problem. - -**v1.4 (build 5) is RELEASED and live (2026-08-13).** Payload for Mac users is exactly one thing: `be51ccf`, the duration-less scrub fix ported to `FaceplateTransport` and `TransportBar.seekBlock`. (The pill/ring work is in the same tag but is iOS-only, and iOS is personal-install — a v1.4 was **held** on 2026-08-11 precisely because there was no macOS payload yet.) Pipeline ran clean end to end: bump `49f69d6` → `xcodegen` → `verify-sparkle-config.sh` green → archive → export → app notarize **Accepted** + staple + `spctl` (`accepted, source=Notarized Developer ID`, `flags=0x10000(runtime)`) → DMG → codesign DMG → notarize **Accepted** + staple + `spctl -t open` → push bump BEFORE `gh release create v1.4` → `AppleNugs-1.4.dmg` uploaded (4,043,765 bytes, state=uploaded) → `sparkle-appcast.sh` → appcast `048ea45` pushed. Raw feed served build 5 immediately, enclosure `length` byte-matching the asset, download URL `HTTP 200`. **The Sparkle loop WAS then exercised for real and works** (2026-08-13, same session): the installed v1.3 offered 1.4 ("AppleNugs 1.4 is now available\u2014you have 1.3"), downloaded, installed and relaunched on 1.4 \u2014 third end-to-end validation of the update path after v1.0\u2192v1.1 and v1.2\u2192v1.3. **And the payload itself is verified on the shipped build:** with a real duration-less track ("So Ready", elapsed 3:56, remaining `--:--`), the transport thumb sat pinned hard right on 1.3 and rests at 0 on 1.4 \u2014 same track, same session, before/after in one pass. `be51ccf` is confirmed working in production, not just building. - -**Two release-pipeline gotchas that cost time on v1.4 — don't rediscover them.** (1) **`ExportOptions-DeveloperID.plist` in the repo is a TEMPLATE with a literal `TEAMID` placeholder**, so `-exportArchive` fails with the very misleading `No signing certificate "Developer ID Application" found` even though `security find-identity` lists the cert fine. Generate a resolved copy into gitignored `build/` (`sed 's|TEAMID|$APPLENUGS_TEAM_ID|'`) and point `-exportOptionsPlist` at that; leave the template alone. (2) **`rm -rf build` before archiving also deletes Sparkle's `generate_appcast`**, and `sparkle-appcast.sh` then dies with "generate_appcast not found at build/sparkle-tools/bin". SPM restores it during the archive at `build/SourcePackages/artifacts/sparkle/Sparkle/bin` — pass it via the script's `SPARKLE_TOOLS` env override rather than hunting (a bare `find /` for it takes >5 minutes). - -**v1.3 (build 4) is RELEASED and live (2026-08-10).** Same validated Path-B pipeline, clean end to end: bump `c862d0c` → `xcodegen` → `verify-sparkle-config.sh` green → Developer ID archive → export → app notarize **Accepted** + staple + `spctl` → `hdiutil` DMG → codesign DMG → notarize **Accepted** + staple + `spctl -t open` → push bump BEFORE `gh release create v1.3` → `AppleNugs-1.3.dmg` uploaded (asset 200) → `sparkle-appcast.sh` → appcast `82f228d` pushed; the raw feed served build 4 immediately, enclosure `length` matching the asset byte-for-byte. **The Sparkle loop was then exercised for real and works:** the installed v1.2 offered 1.3 ("AppleNugs 1.3 is now available—you have 1.2"), downloaded, installed, and relaunched on 1.3 — signature, feed, and build-number comparison all validated in the actual client, not just via `curl`. - -**Contents of v1.3 — the macOS video full-screen toggle** ([PR #3](https://github.com/tsvb/applenugs/pull/3), merged `454c49c`+`e39222d`). `AVPlayerView.showsFullScreenToggleButton` defaults to NO and was never set, so the Mac video surface had no full-screen affordance at all. Second commit defers the end-of-playback arbiter hand-back while full screen — otherwise a video finishing there resumes the audio queue behind a window the viewer can't see past. **AVKit gives macOS no programmatic full-screen control**: no enter method, no exit method, no state property, only the four `AVPlayerViewDelegate` notifications — so there is no macOS equivalent of iOS's `exitsFullScreenWhenPlaybackEnds`, and app-drawn chrome would need the unrelated `NSView.enterFullScreenMode` path. Don't re-litigate this without re-reading the header. - -**Verification on v1.3, and what's still open.** Tim confirmed the full-screen button works and playback keeps running across the transition — first on the signed pre-release build, then again on the installed 1.3 after updating — so the `onDisappear`-teardown risk did NOT materialize. Two things were never exercised and remain unproven: **layout/LIVE-badge restore on exit**, and **the end-in-full-screen audio case** (video finishes full screen with the audio queue previously playing → nothing should start underneath, and audio should resume on exit). That deferral logic also has **no unit test** — `VideoPlayerService` pulls in `PlayerService`/`NugsClient`/`VideoProgressStore` and `AppleNugsTests` is host-free. Note the harness limitation recorded in the `applenugs-swiftui-hypothesis-testing` memory: **AVKit renders its floating controls out-of-process**, so subview walks, AX walks, and `cacheDisplay` PNGs are all blind to them — don't burn time re-deriving that. - -**Previously — the miniplayer visual-verification campaign (2026-08-01) is CLOSED** (HISTORY: the cassette, faceplate and click-wheel miniplayers it covered were deleted in stage e1; the offscreen harness recipe still applies). All 15 checklist items got verdicts (evidence ledger: `docs/superpowers/miniplayer-artifacts/reports/verification-campaign-report.md`; contact sheet beside it; renders in `../renders/`). It was run three ways: an offscreen `swiftc`+`NSHostingView` harness extended to **PNG capture** via `NSWindow.cacheDisplay` (41 renders — needs no login or Screen Recording, and reaches states the live app can't), a seeded live walkthrough, and a real-playback session on a Developer ID-signed local build with the real session (real art, VU sway, drag-to-seek, 4Hz, stability, CPU all verified live). **One real defect found and fixed (`ef33039`):** ReelHub's splines were textPrimary-on-textPrimary, so reel rotation was invisible at any speed — exactly the class of bug the campaign existed to catch. A short human-residue checklist for Tim (VoiceOver, focus rings, divider/drag feel, window floor) is the last section of the ledger. - -**The iOS parity review's now-playing-bar findings are RESOLVED by the pill work above, on this branch.** Original brief: `docs/superpowers/specs/2026-08-01-ios-parity-review-brief.md` (screenshots in `docs/superpowers/ios-parity-artifacts/`) diagnosed **two real defects + one risk** in the old full-width bar: the toast's hardcoded `.padding(.bottom, 78)` drew it ON the bar; the bar vanished on every pushed detail screen (the `safeAreaInset` wrapped the NavigationStack root, not the stack); and keyboard-up likely triple-stacked chrome (was unverified then — needs taps, and is **still unverified now**, not exercised by this pass either). The pill's `tabViewBottomAccessory` placement fixes the first two structurally (see "This worktree" above) and also answers the review's design question — ~138-144pt of flush bottom chrome against iOS 26's floating tab capsule — by replacing the flush bar with a floating capsule instead of trying to slim the old shape down. The keyboard-up interaction remains the one open item from that review this branch didn't specifically re-check. - -**Also parked:** `docs/superpowers/miniplayer-artifacts/` holds the spec, plan, all task reports, the SDD ledger, and the brainstorm mockups (gitignored, local only). Known follow-ups with no owner: shuffle and repeat (which should first collapse the partial transport-control implementations — see the player-backlog memory). (The faceplate's knurled play button is deleted, and the `PlaybackStateStore` `-UITEST` guard has shipped — see Conventions.) -**When verifying UI here:** launching the app is fine, but always quit it afterward, don't grind on stuck GUI automation, and never enter credentials at a Keychain prompt — see the `applenugs-no-gui-automation` memory. Screenshot capture works when the Claude app has Screen Recording; synthetic split-divider drags and AX window-width resizes remain unreliable. **Magnet's invisible overlay swallows synthetic clicks** — quit it for the session (relaunch after). For live runs: build Developer ID-signed (ad-hoc crashes on Sparkle AND prompts for the Keychain), launch the built app by explicit path, and back up `nowplaying.json` first (Tim must copy it — the container is TCC-blocked for the shell; Finder driven via `open -R` + allowlisted copy/paste works too). For pure layout questions the `swiftc` + `NSHostingView` harness is usually the better tool — and it can render PNGs now (recipe in the verification ledger; remember `.themed()` does NOT set the `\.theme` environment key, and use `cacheDisplay`, not `ImageRenderer`). +### Design system +- **Yeti is the only design** (macOS + iOS, dark only). The five old themes, their picker, the transport and + miniplayer variants, the art-color pipeline, wash and grain were deleted 2026-11-07. ONE token struct, + `Theme` (`AppleNugs/Theme/Theme.swift`, the only place literal hex lives): `palette` (semantic roles — + `base`/`raised`/`hairline`, `textPrimary`/`textSecondary`/`textIdle`, `accent` = foil, `playState` = sale + yellow, `cardStock`, `stickerInk`, the sticker stock stops, `segmentThumb`, `videoErrorBackdrop`, the + bubble's plastic), `type` (size-taking font closures) and `copy` (the app's voice). `Theme.yeti` is the + `\.theme` default; `ThemedRoot` (`.themed(_:)`) sets the snow root tint, base background, body font and + `.dark`. +- **Foil means time.** The root tint is snow (`palette.textPrimary`), so system controls never paint an + accent fill; foil is applied explicitly only where time moves (scrubs, the pill ring, the sweep, the caret, + download/resume progress). +- **Components** live in `AppleNugs/Theme/Components/`: `BlisterPack` (card stock + bubble, `PackArt`, + `BlisterGlass`; the card's top padding is DERIVED from the hang slot + clearance + halo — don't copy the + sheet's 30–34pt tops back), the stickers (`StickerStock`, `PlaySticker`, `PriceSticker`, `RowSticker`, + `LabelSticker`), `FoilSweep` (reads no time), `YetiButtonStyles` (+ the macOS foil focus outline), + `YetiSegmentedControl`, `EmptyPackMessage`, `MonogramTile`, `ArtistPortrait`, `ArtistTile`. +- **Artists are circles, shows are squares.** Every artist surface uses the artist's photo in a circle + (`ArtistPortrait`): Home's crate (iOS tiles via `ArtistTile`; Mac rows), the Artists list, the artist page + header, the Favorites page. Photos come from the v1 catalog (`Catalog.artistAvatars`; `?ids=` in batches of + 100, or the full 718-artist walk for the Artists list, cached per session on `AppModel`); the monogram is + the loading/miss fallback. Show covers stay square. +- **Design pages:** `docs/design/yeti-theme/` (`yeti-theme.html` token sheet, `yeti-surfaces.html`, + `yeti-decisions.html` — Tim's rulings); superseded mockups are in its `archive/`. App icon: + `AppleNugs/AppIcon.icon` (Icon Composer; concepts in `docs/design/yeti-icon/`, rendered by + `scripts/render-app-icon.py`). The README banner is generated by `scripts/generate-banner.swift`. +- **Never quote the Goose song's lyrics** in the app or docs (copyrighted) — paraphrase only. The app's + copy lines ("It's on its way", "Says so on the box", "The nice list"…) are cleared as paraphrase. +- Tim's standing rulings: the Artists list shows no per-artist show counts (a fan-out would break polite + networking); the now-playing counter reads "Track 3 of 24"; the Mac Home resume card is a FLAT cover (the + Mac's bubble belongs to the dashboard miniplayer and the Now Playing window); "Sign out" app-wide; all + clear-queue paths confirm. + +### Platforms and layout +- **macOS vs iOS:** `AppleNugs/macOS/` and `AppleNugs/iOS/` are per-platform (excluded from the other + target); everything else is shared. Keep the untouched platform building. +- **`DashboardPanel.swift` is SHARED**, not macOS code: iOS presents it as a sheet from `NowPlayingScreen` + and beside it in `NowPlayingArrangement`. Anything under `AppleNugs/macOS/` it calls MUST sit behind + `#if os(macOS)` — the macOS build won't catch the iOS break. +- **Leaf views own the ~4Hz tick.** `DashboardPanel` is a `ScrollView`+`VStack` (NOT a `List` — macOS-26 + `NSTableView` reentrancy). Only leaf views may read `currentTime`: `MiniPlayerScrubTrack`, `BufferedRow`, + the iOS `ElapsedTimeLine`, `PanelScrubRow` (in `ExpandedPlayerPanel`), `PillProgressRing`, and + `ResumeProgressRule` (both Home heroes). Add to this list rather than hoisting a read into a host body. + **A leaf must render CONSTANT-HEIGHT content** — collapsing to `EmptyView` when a value is unknown + re-lays-out the parent (a visible jump, and the very re-layout the isolation exists to prevent). +- **The inspector's Signal section holds a constant row set** (`SignalReadout`, pure + tested). Gate on + `player.current`, never on `nowPick`/`specs` (`startCurrent()` nils them every track change). Unknown + values degrade to `"—"`, dimmed via `foregroundStyle` ONLY (a font/weight change moves the row height); + `"--:--"` is reserved for clocks. +- **Dashboard miniplayer** (`AppleNugs/macOS/MiniPlayer/`, macOS only): `DashboardMiniPlayer` shows the idle + line or `MiniPlayerStandard` (the blister-pack miniplayer); shared leaves in `MiniPlayerParts.swift`. The + inspector column is pinned `min: 340, ideal: 340, max: 380` because a real 44-char venue clips below 340. +- **Duration-less streams:** a stream that reports no duration must not pin a scrub thumb hard right + ("finished"). Every slider carries `duration > 0 ? min(currentTime, sliderMax) : 0` (three sites: + `TransportBar`, `NowPlayingScreen`, `ExpandedPlayerPanel`); the pill ring is empty, not full + (`PillLayout.progressFraction`). A new scrub surface needs the same guard. +- **iPhone Duo layout rules** — all switched on MEASURED width, never size class. Phones are portrait-locked + (`OrientationGate`, open only during full-screen video), so no regular iPhone reaches the wide layouts; the + Duo's unfolded inner display is wide in portrait (~951×669pt flat, ~669×951pt upright). + (1) **Art must yield height** — never a rigid tile: the bubble takes what the nameplate leaves (capped by + `maxBubbleSide`), and with no cover `PackArt` sizes the `MonogramTile` to that box. + (2) **The pill is Apple's `tabViewBottomAccessory`, on the Duo too** (no custom overlay, shelf or duck — + built, then reversed by Tim; don't rebuild). It sheds controls by measured width + (`PillLayout.controls(slot:width:…)`, 90pt text floor — the folded Duo's vertical tab bar leaves a ~290pt + accessory that still reports `.expanded`), and its second line becomes "artist · show" at a ≥ 220pt text + column (`PillLayout.showsShowLine`: the flat Duo; the upright Duo's pill is ~400pt, artist only). + (3) The full-screen cover hosts `NowPlayingArrangement`; pure `NowPlayingColumns` picks compact → player + alone, regular + wider-than-tall → iOS 27.1 `ArrangementView` (player + `DashboardPanel(showsNowPlaying: + false)`), regular + upright → an explicit HStack with a 220–260pt queue column. The arrangement REMOVES the + secondary when it can't split, so players read `\.nowPlayingQueueBeside` and swap their queue button for a + same-size hidden placeholder. It owns **swipe-down to close** (pure `NowPlayingDismissDrag`, a plain + `.gesture` on the PLAYER only so sliders and buttons win; the moving layer carries its own + `safeAreaPadding`). Scaling a fixed cluster = `NowPlayingFit.scale` + `scaleEffect` + a matching `.frame`. + (4) **Wide Home splits into two columns** (`HomeColumns`, iOS only): ≥ 560pt of content with a track + loaded → the hero keeps its UPRIGHT blister pack in a 280–320pt leading column, favorites / nice list / + crate beside it. A sideways hero card was built and REJECTED ("still too wide… a little lazy") — Tim wants + wide canvases to gain content, not stretched components. +- **The pill's hard-won facts:** `tabViewBottomAccessory` is 360×48pt expanded, 284×48pt inline, height + system-owned; a `.sheet` attached INSIDE the accessory never appears (the shell presents the panel and the + pill takes an injected `onExpand`); a drag-up loses to the tab bar's scroll-to-minimize (hence the + chevron). The art chip is clipped to a CIRCLE so the progress ring's 1pt gap holds at every angle. + +### Navigation and metadata +- **Now-playing metadata is clickable** (`NowPlayingMetaText` + pure `NowPlayingMetaLine`): artist and show + are separate `.link` runs inside ONE `Text(AttributedString)` — never an HStack of Buttons (several sites + have no layout slack, the pill above all). Taps arrive as `x-applenugs-meta://` URLs, intercepted by + `.nowPlayingMetaLinks(app:ui:)` at all THREE scene roots (`RootView`, `IOSRootView`, the macOS Now Playing + `Window`). **The interceptor MUST return `.systemAction` for foreign URLs** or the video page's donation + links break. Links are invisible at rest (each run carries the surrounding color) and get a dotted + underline on hover, macOS only. Build attributes with the `AttributeScopes.…Attribute.self` subscript — + the dynamic-member form warns under strict concurrency. `tappableText: false` is the dial if a mis-tap + problem appears on the pill or a Home hero; `showsLinks: false` for the offline Downloads sheet. +- **Navigating from a modal surface uses `UIState.navigate(to:)`, not `open(_:)`** — it bumps a tick every + presentation owner observes (`dismissesOnNavigation(_:ui:)`), because on iOS the dashboard can be a sheet + inside a sheet. It deliberately doesn't touch `sidebarSelection` (whose `didSet` resets `navPath`). Deep + links route through it too. +- **Deep links** (`applenugs://`, `yeti://`; goosealmanac depends on `applenugs://`): `DeepLinkMatch.normalize` + carries the SITE's venue rule — apostrophes (ASCII + U+2019) deleted, every other non-alphanumeric run + collapsed to one space ("Slim's" ↔ "Slims", "St-Denis" ↔ "St Denis"). Don't simplify it. There is no + picker: `DeepLinkRouter` takes the first same-date match when no usable venue hint is given. +- Catalog dates are UTC-midnight instants — use `CrateSection.catalogCalendar`, never `Calendar.current`. + +### Playback, data and compliance +- **Audio/video arbiter: only one plays; the last one DELIBERATELY started wins.** `VideoPlayerService` calls + `PlayerService.pauseForExternalAudio()` on EVERY claim. While `suspendedForVideo`, `startPlayback()` + refuses, so an automatic start can't play underneath. Deliberate audio starts (`startAt` with + `deliberate: true`, `resume`, `togglePlayPause`, the gapless `next()`) call `takePlaybackFromVideo()` + first. Any new "the listener pressed play" entry point must too, or it's silently swallowed during video. +- **A restored queue loads its cover at launch** (`restorePersistedState` → `loadArtwork`), so the paused + hero, pill and lock screen show art without pressing play. `PlaybackStateStore` never writes under + `-UITEST` (reads stay live). +- **Listening stats are artists-only rolling aggregates with NO event log.** `ListeningStats`, + `ListeningCredit` (play = min(50%, 240s) LISTENED) and `LedgerSummary` are pure + tested; the + `@Observable` `ListeningStatsStore` writes `listening.json`. Rules that fail silently: (1) `PlayerService` + owns the accumulator (`@ObservationIgnored`) and credits only at commit boundaries (track change, 30s, + pause, background, terminate), never per tick. (2) `HomeView` gates the ledger on `listening.hasAnyPlay`, + never on `stats`. (3) `save()` refuses to write while `loadFailed` is latched (that file is the only copy). + (4) Backgrounded iOS has no tick, so credit is SETTLED (`ListeningCredit.span`), reading `creditPosition` + — nil, never the stale `currentTime`, when the head isn't our item; paused → playing re-anchors without + crediting. Don't add a wake or background tick for stats. Deliberate scope cuts: artists only, all-time + only, Home only, typographic ledger, audio only. Reset lives in the account menu. +- **Compliance (nugs.net Terms):** identity is honest everywhere — `NugsIdentity.current` = + `Yeti/ (unofficial; +github; )`, no Referer; the old Android UA strings exist ONLY as the DEBUG + Network Probe's control. Streams try tier 7 (ALAC 16) first and other tiers ONE AT A TIME + (`StreamTierPlan`) — never re-parallelize; tier map 1 FLAC16, 4 MQA24, 7 ALAC16, 10 MQA24. API/resolver + calls go through a 4 req/s token bucket (burst 8). **Browser sign-in only** (no password screen). The + OAuth client ID is the official app's — unavoidable without a nugs-issued client (NOTICE says so). +- **Downloads are sealed `.yeti` files** (64 KiB AES-GCM chunks, a per-install Keychain key, `yeti-local://` + + `SealedAssetLoader`). Never write or keep plaintext; logout deletes all downloads and the key; offline + play needs a subscription check within 30 days. No Reveal in Finder or export. Keep + `isEntireLengthAvailableOnDemand = true` in `SealedAssetLoader` (without it AVFoundation buffers whole + files; a test guards it), and keep the player tick off in the background. +- **Display-only rename:** bundle ids `com.timvbs.applenugs*`, `Application Support/AppleNugs/`, the Keychain + service, the Sparkle feed + EdDSA key, the repo and `PRODUCT_NAME` (`AppleNugs.app`) are deliberately + unchanged (DISTRIBUTION.md lays out the `.app` rename trade-off). + +### Verifying UI +- Launching the app is fine, but quit it afterward, don't grind on stuck GUI automation, and never enter + credentials at a Keychain prompt. Magnet's overlay swallows synthetic clicks. +- For pure layout questions on the Mac, the `swiftc` + `NSHostingView` harness (offscreen PNGs via + `cacheDisplay`) beats the live app — see the `applenugs-swiftui-hypothesis-testing` memory. + +## Releases +`DISTRIBUTION.md` is the runbook (Path B: Developer ID → notarize → DMG → GitHub release → Sparkle appcast), +with the details and gotchas in the `applenugs-distribution` memory (the `ExportOptions` `TEAMID` template, +where `generate_appcast` lives after `rm -rf build`). Push the version bump BEFORE `gh release create`. +**Tim's `/Applications/AppleNugs.app` is a local Developer ID build of `main`**, not the v1.5 release, though +it still reads 1.5 (6) — bump `MARKETING_VERSION`/`CURRENT_PROJECT_VERSION` before any real release. The +v1.5 release is backed up at `~/AppleNugs-1.5-build6-backup.zip`. + +## State — as of 2026-11-16 +- `main` carries the whole Yeti design (PR #8), the Duo two-column Home + pill show line (#9), the restored + queue's cover art (#10), crate tiles (#11), artist photos on the crate (#12), the Artists list (#13), the + Mac (#14), the artist page (#15) and Favorites (#16). Tim's Duo and Mac run this build. +- **Next on Tim's list:** the Duo nightstand/tent work (Tim chose all three: a propped-open player with + clock + night dimming, a tent-pose landscape player that auto-opens, a StandBy Now Playing widget — start + with a DEBUG pose probe; `onHingeChange` gives only status + angle, there is no posture enum; spec local in + `docs/superpowers/specs/`). Not yet scheduled: a release of everything since v1.5 (Path B, after the + version bump) — Tim's call. +- **Small follow-ups:** Home's Favorites strip still shows followed artists as text chips (could be photo + circles); decide the `.app`/`PRODUCT_NAME` rename; goosealmanac's deep-link doc should mention `yeti://`; + `VideoPlayerService` pushes Now Playing every 0.5s during video; ask nugs.net for an official OAuth client; + shuffle and repeat (collapse the partial transport-control implementations first — player-backlog memory). +- **Unverified, needs hardware:** locked-screen listening credit on the Duo (play locked 5+ min; the + artist's time should include it); the nice list's reset dialog on iOS; swipe-down to close starting on a + slider thumb; the offline Downloads sheet's pill; VoiceOver on the pill, hero, segmented control and login; + Dynamic Type against the expanded panel's 250pt detent; the Mac's plaintext-download migration and the + logout wipe; Mac keyboard focus showing the foil outline (not the system ring) on our own controls. diff --git a/DISTRIBUTION.md b/DISTRIBUTION.md index 737d088..9021124 100644 --- a/DISTRIBUTION.md +++ b/DISTRIBUTION.md @@ -96,7 +96,8 @@ with your team.) ## Prerequisites (both paths) - **Apple Developer Program** membership ($99/yr). -- **Xcode 16+** signed into your Apple ID (Settings → Accounts). +- **Xcode 27.1+** signed into your Apple ID (Settings → Accounts). 27.1 is the + floor because the iOS app compiles iOS 27.1 SDK symbols; CI asserts it. - Bundle ID `com.timvbs.applenugs` registered to your team. (Automatic signing registers it for you the first time you archive; or pre-register it at developer.apple.com → Identifiers.) diff --git a/docs/design/yeti-theme/archive/README.md b/docs/design/yeti-theme/archive/README.md new file mode 100644 index 0000000..c9f4a09 --- /dev/null +++ b/docs/design/yeti-theme/archive/README.md @@ -0,0 +1,9 @@ +# Archive + +History, not the current design. The current sheets are one folder up: `yeti-theme.html` (tokens), +`yeti-surfaces.html` (every surface) and `yeti-decisions.html` (Tim's rulings). + +- `concept-a.html`, `concept-b.html`, `concept-c.html` — the three directions the Yeti blister-pack concept + beat. +- `yeti-pill-shelf.html`, `yeti-rail.html` — a custom pill shelf for the folded iPhone Duo, built and then + reversed (2026-11-07) in favor of Apple's own `tabViewBottomAccessory`. diff --git a/docs/design/yeti-theme/concept-a.html b/docs/design/yeti-theme/archive/concept-a.html similarity index 100% rename from docs/design/yeti-theme/concept-a.html rename to docs/design/yeti-theme/archive/concept-a.html diff --git a/docs/design/yeti-theme/concept-b.html b/docs/design/yeti-theme/archive/concept-b.html similarity index 100% rename from docs/design/yeti-theme/concept-b.html rename to docs/design/yeti-theme/archive/concept-b.html diff --git a/docs/design/yeti-theme/concept-c.html b/docs/design/yeti-theme/archive/concept-c.html similarity index 100% rename from docs/design/yeti-theme/concept-c.html rename to docs/design/yeti-theme/archive/concept-c.html diff --git a/docs/design/yeti-theme/yeti-pill-shelf.html b/docs/design/yeti-theme/archive/yeti-pill-shelf.html similarity index 100% rename from docs/design/yeti-theme/yeti-pill-shelf.html rename to docs/design/yeti-theme/archive/yeti-pill-shelf.html diff --git a/docs/design/yeti-theme/yeti-rail.html b/docs/design/yeti-theme/archive/yeti-rail.html similarity index 100% rename from docs/design/yeti-theme/yeti-rail.html rename to docs/design/yeti-theme/archive/yeti-rail.html diff --git a/docs/images/banner-dark.svg b/docs/images/banner-dark.svg index c9384cc..ae31aa9 100644 --- a/docs/images/banner-dark.svg +++ b/docs/images/banner-dark.svg @@ -1 +1,21 @@ -AppleNugs +Yeti — an unofficial player for nugs.net + + + + + + + + + + + + + + + + + + + + diff --git a/docs/images/banner-light.svg b/docs/images/banner-light.svg index 527632b..09a7a00 100644 --- a/docs/images/banner-light.svg +++ b/docs/images/banner-light.svg @@ -1 +1,21 @@ -AppleNugs +Yeti — an unofficial player for nugs.net + + + + + + + + + + + + + + + + + + + + diff --git a/docs/images/social-preview.png b/docs/images/social-preview.png index 7850fe3..e2f25e7 100644 Binary files a/docs/images/social-preview.png and b/docs/images/social-preview.png differ diff --git a/scripts/generate-banner.swift b/scripts/generate-banner.swift index 4ced71d..5348ad4 100644 --- a/scripts/generate-banner.swift +++ b/scripts/generate-banner.swift @@ -1,419 +1,279 @@ #!/usr/bin/env swift // -// generate-banner.swift — draws the README banner and the repo social-preview card. +// generate-banner.swift — draws the README banner and the repo social-preview card +// in the Yeti design: a night-blue blister card hung on a peg, the bubble app icon, +// the "Yeti" wordmark in SF Pro Rounded Heavy (the app's own hero face), a foil +// progress rule (foil means time), and a sale-yellow "Lossless" price sticker. // // Output: // docs/images/banner-dark.svg 1676x420 (4:1), for prefers-color-scheme: dark // docs/images/banner-light.svg 1676x420 (4:1), the fallback // docs/images/social-preview.png 1280x640 (2:1), uploaded by hand in repo settings +// (rendered with rsvg-convert: `brew install librsvg`) // // Why the lettering is outlined rather than set in : // GitHub serves repository files from raw.githubusercontent.com under // content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox -// An SVG referenced by therefore cannot fetch a font — not a web font, not -// even a base64 @font-face, because default-src 'none' is the fallback for font-src. -// A element would silently fall back to a system font and the faceplate would -// collapse. So every glyph here is converted to a path via CoreText, and the script -// aborts if the OS substitutes a font for one we asked for. +// so an SVG referenced by cannot fetch a font, not even a base64 @font-face. +// A element would silently fall back to some system font. Every glyph here is +// converted to a path via CoreText, and the script aborts if the OS substitutes a +// font for the rounded face we asked for. +// +// The icon is the app icon's master art (docs/design/yeti-icon/yeti-icon-master.svg), +// embedded with its ids prefixed so they can't collide with the banner's own. +// +// Colors are the `Theme.yeti` palette (AppleNugs/Theme/Theme.swift) — keep them in step. // // Run: swift scripts/generate-banner.swift // -import Foundation +import AppKit import CoreText -import CoreGraphics -import ImageIO -import UniformTypeIdentifiers - -// MARK: - Geometry - -let W = 1676.0, H = 420.0 // banner canvas, 4:1; renders at 838pt in GitHub's column -let plateInset = 8.0 -let cornerRadius = 22.0 - -// VU window -let winX = 52.0, winY = 52.0, winW = 944.0, winH = 316.0 - -// The needle pivot sits far below the canvas, which is how wide, shallow-arc meters -// on cassette decks actually work — the needle enters from the bottom of the window -// and no pivot is visible. The needle is clipped to the window. -let pivot = CGPoint(x: 524, y: 720) -let rScale = 560.0 // radius of the scale arc -let rTickIn = 532.0 // major tick inner radius -let rTickInMinor = 544.0 -let rBand = 572.0 // the zone band sits just outside the ticks -let rNumeral = 508.0 // numeral centres -let rNeedleTip = 546.0 - -// Right-hand panel -let panelX = 1046.0 - -/// Scale marks: (label, angle in degrees from vertical, positive = clockwise). -/// Compressed at the quiet end and open at the loud end, the way a real VU face reads. -let marks: [(String, Double)] = [ - ("-20", -40), ("-10", -22.5), ("-7", -14), ("-5", -8), - ("-3", -1), ("-1", 7.5), ("0", 15), ("+1", 24), ("+3", 40), -] -let zeroAngle = 15.0 -// Sits in the gap between the -7 and -5 marks. Parking it exactly on a labelled -// mark puts the needle through the numeral and neither one survives. -let needleAngle = -11.0 -let maskHeight = 26.0 // bottom mask the needle disappears behind -let scaleStart = -40.0, scaleEnd = 40.0 - -func pt(_ angleDeg: Double, _ r: Double, from c: CGPoint = pivot) -> CGPoint { - let a = angleDeg * .pi / 180 - return CGPoint(x: c.x + r * sin(a), y: c.y - r * cos(a)) -} +import Foundation -// MARK: - Palette - -struct Palette { - let plateHi, plateLo: String // plate gradient, top to bottom - let edgeHi, edgeLo: String // machined top highlight / bottom shadow - let brush: String // brushed-texture stroke colour - let brushHi, brushLo: Double // its opacities - let bezel, bezelHi: String // window surround - let field, fieldShade: String // meter card and its recess shading - let ink, inkSoft: String // scale marks, numerals, needle — on the cream card - let plateMark: String // marks drawn straight onto the plate, with no card behind - let band: String // the pre-0 portion of the zone band - let red: String // the over-0 portion, and the peak tick - let wordmark: String - let lcd: String - let caption: String - let screwHi, screwLo, screwSlot: String - let led: String - - static let dark = Palette( - plateHi: "#1F1A16", plateLo: "#14110E", - edgeHi: "#3A332B", edgeLo: "#0A0806", - brush: "#FFFFFF", brushHi: 0.035, brushLo: 0.018, - bezel: "#0B0A08", bezelHi: "#332C25", - field: "#EDE4D3", fieldShade: "#B9AE99", - ink: "#241C12", inkSoft: "#6E6357", - plateMark: "#A89B8B", - band: "#241C12", red: "#FF4D2E", - wordmark: "#E8A13A", lcd: "#5FB6A6", caption: "#A89B8B", - screwHi: "#4A4238", screwLo: "#17140F", screwSlot: "#0A0806", - led: "#E8A13A") - - // Not an inversion. The same unit in a lighter anodised finish, with darker ink, - // so it reads as hardware sitting on GitHub's white rather than a hole in the page. - static let light = Palette( - plateHi: "#E6E0D4", plateLo: "#CBC3B4", - edgeHi: "#F7F3EA", edgeLo: "#A09786", - brush: "#000000", brushHi: 0.030, brushLo: 0.015, - bezel: "#4A4237", bezelHi: "#EFEAE0", - field: "#F8F2E6", fieldShade: "#C9BEA7", - ink: "#241C12", inkSoft: "#6E6357", - plateMark: "#241C12", - band: "#241C12", red: "#C8341A", - wordmark: "#A15C0B", lcd: "#1F6F62", caption: "#5C5347", - screwHi: "#F2EEE5", screwLo: "#9C9382", screwSlot: "#6E6558", - led: "#C8721A") -} +// MARK: - Palette (Theme.yeti) + +let base = "#0F1424", raised = "#18203A", hairline = "#2E3A5C", cardStock = "#1B2443" +let snow = "#E9EEF7", slush = "#9FABCE", idle = "#8590B0", foil = "#FF8FC4" +let sale = "#F2E27A", saleHighlight = "#FBF1A6", saleEdge = "#E3D267", stickerInk = "#0F1424" // MARK: - Glyph outlines -/// Positioned glyph outlines for a string, in CoreGraphics (y-up) space with the -/// baseline at y = 0. Aborts rather than let the OS substitute a different face. -func glyphOutlines(_ text: String, font fontName: String, size: Double, - tracking: Double = 0) -> (paths: [CGPath], width: Double) { - let font = CTFontCreateWithName(fontName as CFString, size, nil) - let actual = CTFontCopyPostScriptName(font) as String - guard actual.caseInsensitiveCompare(fontName) == .orderedSame else { - FileHandle.standardError.write( - "font substituted: asked for \(fontName), got \(actual) — refusing to outline the wrong face\n" - .data(using: .utf8)!) - exit(3) +/// SF Pro Rounded at `weight`, or abort: a substituted face would ship a banner in +/// the wrong typeface without anyone noticing. +func rounded(_ size: Double, _ weight: NSFont.Weight) -> CTFont { + let plain = NSFont.systemFont(ofSize: size, weight: weight) + guard let desc = plain.fontDescriptor.withDesign(.rounded), + let font = NSFont(descriptor: desc, size: size) else { + fatalError("SF Pro Rounded is unavailable on this Mac") } - var attrs: [NSAttributedString.Key: Any] = [ - NSAttributedString.Key(kCTFontAttributeName as String): font - ] - if tracking != 0 { - attrs[NSAttributedString.Key(kCTKernAttributeName as String)] = tracking + let name = CTFontCopyPostScriptName(font as CTFont) as String + guard name.lowercased().contains("rounded") else { + fatalError("asked for SF Pro Rounded, got \(name)") } - let line = CTLineCreateWithAttributedString( - NSAttributedString(string: text, attributes: attrs)) + return font as CTFont +} + +struct Outline { + let d: String // SVG path data, origin at the text's left baseline + let width: Double // typographic advance +} - var paths: [CGPath] = [] +/// `text` as one SVG path, baseline at y = 0, extending right from x = 0. +func outline(_ text: String, _ font: CTFont, tracking: Double = 0) -> Outline { + let attrs: [NSAttributedString.Key: Any] = [ + NSAttributedString.Key(kCTFontAttributeName as String): font, + NSAttributedString.Key(kCTKernAttributeName as String): tracking, + ] + let line = CTLineCreateWithAttributedString(NSAttributedString(string: text, attributes: attrs)) + let path = CGMutablePath() for run in CTLineGetGlyphRuns(line) as! [CTRun] { - let n = CTRunGetGlyphCount(run) - guard n > 0 else { continue } - var glyphs = [CGGlyph](repeating: 0, count: n) - var pos = [CGPoint](repeating: .zero, count: n) - CTRunGetGlyphs(run, CFRangeMake(0, 0), &glyphs) - CTRunGetPositions(run, CFRangeMake(0, 0), &pos) - let runFont = (CTRunGetAttributes(run) as NSDictionary)[kCTFontAttributeName as String] as! CTFont - for i in 0.. String { - let r = (v * 100).rounded() / 100 - return r == r.rounded() ? String(Int(r)) : String(format: "%g", r) +func fmt(_ v: CGFloat) -> String { + let r = (Double(v) * 100).rounded() / 100 + return r == r.rounded() ? String(Int(r)) : String(r) } -/// SVG path data for a string, flipped into SVG's y-down space, baseline at y = 0. -func svgTextPath(_ text: String, font: String, size: Double, tracking: Double = 0) - -> (d: String, width: Double) { - let (paths, width) = glyphOutlines(text, font: font, size: size, tracking: tracking) +func svgPath(_ path: CGPath) -> String { var d = "" - for p in paths { - var flip = CGAffineTransform(scaleX: 1, y: -1) - guard let f = p.copy(using: &flip) else { continue } - f.applyWithBlock { e in - let q = e.pointee.points - switch e.pointee.type { - case .moveToPoint: d += "M\(num(q[0].x)) \(num(q[0].y))" - case .addLineToPoint: d += "L\(num(q[0].x)) \(num(q[0].y))" - case .addQuadCurveToPoint:d += "Q\(num(q[0].x)) \(num(q[0].y)) \(num(q[1].x)) \(num(q[1].y))" - case .addCurveToPoint: d += "C\(num(q[0].x)) \(num(q[0].y)) \(num(q[1].x)) \(num(q[1].y)) \(num(q[2].x)) \(num(q[2].y))" - case .closeSubpath: d += "Z" - @unknown default: break - } + path.applyWithBlock { el in + let p = el.pointee.points + switch el.pointee.type { + case .moveToPoint: d += "M\(fmt(p[0].x)) \(fmt(p[0].y))" + case .addLineToPoint: d += "L\(fmt(p[0].x)) \(fmt(p[0].y))" + case .addQuadCurveToPoint: d += "Q\(fmt(p[0].x)) \(fmt(p[0].y)) \(fmt(p[1].x)) \(fmt(p[1].y))" + case .addCurveToPoint: + d += "C\(fmt(p[0].x)) \(fmt(p[0].y)) \(fmt(p[1].x)) \(fmt(p[1].y)) \(fmt(p[2].x)) \(fmt(p[2].y))" + case .closeSubpath: d += "Z" + @unknown default: break } } - return (d, width) + return d } -// Typefaces. Condensed grotesque for the wordmark and scale, mono for the readout. -let fWordmark = "AvenirNextCondensed-Heavy" -let fScale = "AvenirNextCondensed-Bold" -let fMono = "Menlo-Bold" +// MARK: - The icon -// MARK: - SVG +let root = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) +let iconURL = root.appendingPathComponent("docs/design/yeti-icon/yeti-icon-master.svg") +guard let iconSource = try? String(contentsOf: iconURL, encoding: .utf8) else { + fatalError("run from the repo root: missing \(iconURL.path)") +} -func arcPath(from a1: Double, to a2: Double, r: Double) -> String { - let p1 = pt(a1, r), p2 = pt(a2, r) - let large = abs(a2 - a1) > 180 ? 1 : 0 - let sweep = a2 > a1 ? 1 : 0 // SVG y-down: increasing angle is a clockwise sweep - return "M\(num(p1.x)) \(num(p1.y))A\(num(r)) \(num(r)) 0 \(large) \(sweep) \(num(p2.x)) \(num(p2.y))" +/// The icon's inner markup with every id (and every reference to one) prefixed. +func iconMarkup(prefix: String) -> (viewBox: String, inner: String) { + guard let open = iconSource.range(of: ">"), + let close = iconSource.range(of: "", options: .backwards), + let vb = iconSource.range(of: #"viewBox="([^"]+)""#, options: .regularExpression) + else { fatalError("unexpected icon SVG shape") } + let viewBox = String(iconSource[vb]).replacingOccurrences(of: "viewBox=", with: "") + .trimmingCharacters(in: CharacterSet(charactersIn: "\"")) + var inner = String(iconSource[open.upperBound.. String { - var s = "" - s += #""# - s += "AppleNugs" - - // ---- defs - s += "" - s += #""# - // Brushed finish: a tiled pattern rather than several hundred individual strokes, - // which keeps the file in the low tens of kilobytes. - s += #""# - s += #""# - s += #""# - s += #""# - s += #""# - s += "" - - // ---- plate - s += #""# - s += #""# - // machined edges - s += #""# - s += #""# - s += #""# - - // ---- window recess - s += #""# - s += #""# - s += #""# - - // ---- meter face, clipped to the window - s += #""# - - // zone band: ink up to 0, red past it - s += #""# - s += #""# - - // minor ticks between the labelled marks - for i in 0..<(marks.count - 1) { - let a0 = marks[i].1, a1 = marks[i + 1].1 - let mid = (a0 + a1) / 2 - let o = pt(mid, rScale), inn = pt(mid, rTickInMinor) - let col = mid > zeroAngle ? p.red : p.ink - s += #""# - } - // major ticks + upright numerals - for (label, angle) in marks { - let o = pt(angle, rScale), inn = pt(angle, rTickIn) - let col = angle >= zeroAngle ? p.red : p.ink - s += #""# - - let (d, w) = svgTextPath(label, font: fScale, size: 30) - let c = pt(angle, rNumeral) - s += #""# - } +// MARK: - Drawing - // needle - let tip = pt(needleAngle, rNeedleTip) - let tail = pt(needleAngle, 300) - let a = needleAngle * .pi / 180 - let nx = cos(a), ny = sin(a) // perpendicular to the needle - let halfTail = 5.0, halfTip = 1.6 - s += #""# - - // Bottom mask. A real meter hides the needle's pivot behind one; without it the - // needle just stops dead at the window edge and reads as a stray diagonal line. - s += #""# - s += #""# - - // "VU", and the recess shading over the top of everything - let (vuD, vuW) = svgTextPath("VU", font: fScale, size: 34, tracking: 3) - s += #""# - s += #""# - s += "" - - // ---- right panel: wordmark, readout, caption - let (wmD, wmW) = svgTextPath("APPLENUGS", font: fWordmark, size: 112, tracking: 1.5) - s += #""# - - // hairline under the wordmark, ending where the wordmark does - s += #""# - - let (lcdD, _) = svgTextPath("ALAC 24/96 · LOSSLESS", font: fMono, size: 27) - s += #""# - - let (capD, _) = svgTextPath("NATIVE CLIENT FOR NUGS.NET · UNOFFICIAL", font: fScale, size: 25, tracking: 1.2) - s += #""# - - // power LED, level with the readout - s += #""# - s += #""# - - // ---- corner screws - for (sx, sy) in [(26.0, 26.0), (W - 26, 26.0), (26.0, H - 26), (W - 26, H - 26)] { - s += #""# - s += #""# - s += #""# - } +enum Variant { case dark, light } - s += "\n" - return s +struct Canvas { + let w: Double, h: Double + /// Inset of the card from the canvas edge (room for the light variant's shadow). + let inset: Double + let iconSide: Double + let wordmarkSize: Double + let taglineSize: Double } -// MARK: - Social preview card (1280x640, drawn directly to a bitmap) - -func drawSocial(_ p: Palette, to url: URL) { - let w = 1280, h = 640 - let cs = CGColorSpace(name: CGColorSpace.sRGB)! - guard let ctx = CGContext(data: nil, width: w, height: h, bitsPerComponent: 8, - bytesPerRow: 0, space: cs, - bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue) else { - fatalError("could not create bitmap context") - } - func color(_ hex: String, _ alpha: Double = 1) -> CGColor { - var s = hex; s.removeFirst() - let v = UInt32(s, radix: 16)! - return CGColor(srgbRed: CGFloat((v >> 16) & 0xFF) / 255, - green: CGFloat((v >> 8) & 0xFF) / 255, - blue: CGFloat(v & 0xFF) / 255, alpha: CGFloat(alpha)) - } - // y-up context; draw in a flipped frame so the layout maths matches the SVG - ctx.translateBy(x: 0, y: CGFloat(h)) - ctx.scaleBy(x: 1, y: -1) - - // plate - let grad = CGGradient(colorsSpace: cs, - colors: [color(p.plateHi), color(p.plateLo)] as CFArray, - locations: [0, 1])! - ctx.saveGState() - ctx.addRect(CGRect(x: 0, y: 0, width: CGFloat(w), height: CGFloat(h))) - ctx.clip() - ctx.drawLinearGradient(grad, start: .zero, end: CGPoint(x: 0, y: CGFloat(h)), options: []) - ctx.restoreGState() - - // brushed texture - ctx.setLineWidth(1) - for x in stride(from: 0, to: Double(w), by: 7) { - ctx.setStrokeColor(color(p.brush, p.brushHi)) - ctx.move(to: CGPoint(x: x, y: 0)); ctx.addLine(to: CGPoint(x: x, y: Double(h))); ctx.strokePath() - ctx.setStrokeColor(color(p.brush, p.brushLo)) - ctx.move(to: CGPoint(x: x + 3, y: 0)); ctx.addLine(to: CGPoint(x: x + 3, y: Double(h))); ctx.strokePath() +let bannerCanvas = Canvas(w: 1676, h: 420, inset: 10, iconSide: 288, wordmarkSize: 168, taglineSize: 40) +let socialCanvas = Canvas(w: 1280, h: 640, inset: 0, iconSide: 300, wordmarkSize: 176, taglineSize: 42) + +func drawing(_ c: Canvas, _ variant: Variant, social: Bool = false) -> String { + let card = (x: c.inset, y: c.inset, w: c.w - 2 * c.inset, h: c.h - 2 * c.inset) + let radius = social ? 0.0 : 28.0 + + // Layout: banner = icon left, words right; social = icon left, words right, taller. + let iconX = card.x + (social ? 96 : 72) + let iconY = card.y + (card.h - c.iconSide) / 2 + (social ? 10 : 8) + let textX = iconX + c.iconSide + (social ? 64 : 76) + + let wordFont = rounded(c.wordmarkSize, .heavy) + let tagFont = rounded(c.taglineSize, .medium) + let smallFont = rounded(c.taglineSize * 0.62, .semibold) + let word = outline("Yeti", wordFont, tracking: -2) + let tagline = outline("an unofficial player for nugs.net", tagFont) + let platforms = outline("MAC · IPHONE · IPHONE DUO", smallFont, tracking: 3) + + let wordBaseline = iconY + c.iconSide * 0.50 + let tagBaseline = wordBaseline + c.taglineSize * 1.55 + let ruleY = tagBaseline + c.taglineSize * 0.95 + let ruleW = max(tagline.width, 420) + let platformsBaseline = ruleY + c.taglineSize * 1.45 + + // The sale-yellow price sticker on the card's top-right, tilted like it was slapped on. + let stickerR = social ? 86.0 : 74.0 + let stickerC = (x: card.x + card.w - (social ? 150 : 130), y: card.y + (social ? 150 : card.h / 2 - 6)) + let stickerFont = rounded(stickerR * 0.36, .heavy) + let stickerWord = outline("Lossless", stickerFont) + let stickerSub = outline("24/96", rounded(stickerR * 0.27, .bold)) + + let icon = iconMarkup(prefix: "icon-") + let iconRadius = c.iconSide * 0.225 + + var s = """ + Yeti — an unofficial player for nugs.net + + + + + + + + + """ + + // The card. Light pages get a soft shadow; dark pages a frost keyline. + let cardAttrs = variant == .light ? #" filter="url(#cardshadow)""# : "" + s += """ + + + """ + if variant == .dark && !social { + s += """ + + """ } - /// Fill a string's outlines with the baseline at (x, y) in the flipped frame. - func text(_ str: String, _ font: String, _ size: Double, _ hex: String, - at x: Double, _ y: Double, tracking: Double = 0, - centered: Bool = false) -> Double { - let (paths, width) = glyphOutlines(str, font: font, size: size, tracking: tracking) - let ox = centered ? x - width / 2 : x - ctx.saveGState() - ctx.setFillColor(color(hex)) - ctx.translateBy(x: CGFloat(ox), y: CGFloat(y)) - ctx.scaleBy(x: 1, y: -1) // glyphs are y-up; the frame is flipped - for path in paths { ctx.addPath(path) } - ctx.fillPath() - ctx.restoreGState() - return width - } + // The hang slot punched through the top of the card. + let slotW = social ? 110.0 : 96.0, slotH = social ? 26.0 : 22.0 + let slotX = card.x + (card.w - slotW) / 2, slotY = card.y + (social ? 26 : 18) + s += """ + + + """ + + // The icon, lifted off the card. + s += """ + \(icon.inner) + + """ + + // Words: the wordmark in snow, the tagline in slush, the platforms in idle. + s += """ + + + """ + + // The foil rule: time moving, about two-fifths through the set. + s += """ + + + + + """ + + // The price sticker. + s += """ + + + + + + + """ - // The card must identify itself: X strips the title, and Slack and Discord - // shrink it to roughly 380px wide, so the name and the pitch live in the art. - let wmW = text("APPLENUGS", fWordmark, 168, p.wordmark, at: Double(w) / 2, 300, tracking: 2, centered: true) - - ctx.setStrokeColor(color(p.wordmark, 0.35)) - ctx.setLineWidth(3) - ctx.move(to: CGPoint(x: Double(w) / 2 - wmW / 2, y: 330)) - ctx.addLine(to: CGPoint(x: Double(w) / 2 + wmW / 2, y: 330)) - ctx.strokePath() - - _ = text("A NATIVE MAC AND IPHONE CLIENT FOR NUGS.NET", fScale, 42, - p.caption, at: Double(w) / 2, 396, tracking: 1.5, centered: true) - _ = text("GAPLESS · LOSSLESS · OFFLINE · FIVE FRONT PANELS", fMono, 27, - p.lcd, at: Double(w) / 2, 462, centered: true) - _ = text("UNOFFICIAL", fScale, 24, p.inkSoft, at: Double(w) / 2, 546, - tracking: 4, centered: true) - - // A slim VU band across the top so the card is recognisably the same object as - // the banner. These marks sit straight on the plate with no cream card behind - // them, so they take plateMark — drawing them in `ink` put near-black on - // near-black and the band vanished entirely. - let bandY = 150.0 - ctx.setLineCap(.round) - ctx.setLineWidth(8) - ctx.setStrokeColor(color(p.plateMark, 0.85)) - ctx.move(to: CGPoint(x: 300, y: bandY)); ctx.addLine(to: CGPoint(x: 830, y: bandY)); ctx.strokePath() - ctx.setStrokeColor(color(p.red)) - ctx.move(to: CGPoint(x: 830, y: bandY)); ctx.addLine(to: CGPoint(x: 980, y: bandY)); ctx.strokePath() - ctx.setLineWidth(3) - ctx.setStrokeColor(color(p.plateMark, 0.7)) - for i in 0...10 { - let x = 300 + Double(i) * 68 - ctx.move(to: CGPoint(x: x, y: bandY - 20)); ctx.addLine(to: CGPoint(x: x, y: bandY - 6)); ctx.strokePath() - } - - guard let image = ctx.makeImage(), - let dest = CGImageDestinationCreateWithURL(url as CFURL, UTType.png.identifier as CFString, 1, nil) - else { fatalError("could not encode PNG") } - CGImageDestinationAddImage(dest, image, nil) - guard CGImageDestinationFinalize(dest) else { fatalError("could not write \(url.path)") } + s += "\n" + return s } -// MARK: - Write +// MARK: - Output -let root = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) let outDir = root.appendingPathComponent("docs/images") -try! FileManager.default.createDirectory(at: outDir, withIntermediateDirectories: true) - -for (name, palette) in [("banner-dark.svg", Palette.dark), ("banner-light.svg", Palette.light)] { +func write(_ svg: String, _ name: String) -> URL { let url = outDir.appendingPathComponent(name) - try! svg(palette, variant: name).write(to: url, atomically: true, encoding: .utf8) - let bytes = (try! Data(contentsOf: url)).count - print("wrote \(url.lastPathComponent) (\(bytes) bytes)") + try! svg.write(to: url, atomically: true, encoding: .utf8) + print("wrote \(name) (\(svg.utf8.count) bytes)") + return url } -let socialURL = outDir.appendingPathComponent("social-preview.png") -drawSocial(.dark, to: socialURL) -let socialBytes = (try! Data(contentsOf: socialURL)).count -print("wrote social-preview.png (\(socialBytes) bytes, limit 1048576)") -if socialBytes > 1_000_000 { print("WARNING: social preview is close to GitHub's 1MB limit") } +_ = write(drawing(bannerCanvas, .dark), "banner-dark.svg") +_ = write(drawing(bannerCanvas, .light), "banner-light.svg") + +// The social card: rasterized from an SVG of its own, then the SVG is removed. +let socialSVG = write(drawing(socialCanvas, .dark, social: true), "social-preview.svg") +let socialPNG = outDir.appendingPathComponent("social-preview.png") +let rsvg = Process() +rsvg.executableURL = URL(fileURLWithPath: "/usr/bin/env") +rsvg.arguments = ["rsvg-convert", "-w", "1280", "-h", "640", "-o", socialPNG.path, socialSVG.path] +do { + try rsvg.run() + rsvg.waitUntilExit() + if rsvg.terminationStatus == 0 { + let bytes = (try? Data(contentsOf: socialPNG).count) ?? 0 + print("wrote social-preview.png (\(bytes) bytes, GitHub's limit is 1 MB)") + } else { + print("rsvg-convert failed; social-preview.png not updated") + } +} catch { + print("rsvg-convert not found (brew install librsvg); social-preview.png not updated") +} +try? FileManager.default.removeItem(at: socialSVG)