Skip to content

Refine tvOS startup paint and top menu focus - #89

Merged
Quick104 merged 5 commits into
mainfrom
tvos-july-11-fixes
Jul 13, 2026
Merged

Quick104 merged 5 commits into
mainfrom
tvos-july-11-fixes

Conversation

@zZebrahz

@zZebrahz zZebrahz commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Player HUD: remaining-time label now matches the elapsed-time opacity (was dimmed to 70%).
  • Startup paint: everything visible on Home's first frame after the splash is now preloaded during the splash (non-blocking — the splash never waits on loads):
    • deeper tvOS artwork warmup (28 URLs incl. first row logo + backdrops) and a synchronous warmed-image branch in CachedAsyncImage so cards never flash black;
    • marquee seeded from the first row's first item (no focus-wait/debounce on cold entry), logo painted from cache, first backdrop + sampled tint wash snap in on frame one (subsequent swaps keep the §4.2 240 ms crossfade);
    • profiles prefetched on cold launch and TVMainTabView seeds libraries/currentProfile from the prefetch cache, so all type tabs and the avatar are in the bar's first frame instead of popping in late.
  • Nav bar layout: search icon moved into the centered tab cluster, left of Home, balanced by an invisible trailing twin so the tabs stay screen-centered.
  • Focus ownership on pop (per docs/tvos-focus.md "choose the next owner explicitly"):
    • popping back to root re-asserts bar suppression, so the engine's focus restore can't flash the last bar element;
    • routes pushed from the bar (Search; Settings/Watchlist/Favorites/History/Requests from the panels) hand focus back to the bar on pop instead of the engine free-resolving onto an arbitrary row card (focus was jumping up 1–2 rows);
    • detail routes pushed from cards are untouched — they still restore focus to the originating card.

Test plan

  • Cold-launch: Home fully painted the frame the splash ends (tabs, avatar, first row art, marquee logo/backdrop/tint), no black image flashes.
  • Sweep left from Home → search icon; tab cluster visually centered.
  • From a card a few rows down: Back → nav, enter Search, Menu out → focus lands on the Home tab, rows unmoved; same via profile → Settings.
  • Open a detail page from a card, Menu out → focus returns to that card.
  • Player HUD: elapsed and remaining time render at equal opacity.

Summary by CodeRabbit

  • New Features

    • Improved tvOS startup performance with faster display of cached artwork, logos, profiles, and libraries.
    • Added smoother initial hero and marquee rendering with reduced first-frame flicker and unnecessary animations.
    • Improved initial focus behavior for the first home row and restored focus when navigating back.
    • Updated the top navigation layout to position Search alongside the main tabs.
  • Bug Fixes

    • Improved hero tint reuse and artwork prefetching.
    • Remaining player time now displays in fully opaque white for better readability.

zZebrahz added 4 commits July 11, 2026 22:44
- Prefetch profiles on authenticated cold launches and hydrate the
  top-bar avatar from cache (single-flight join with the prefetch)
- Deepen the tvOS home artwork warmup (12 -> 28 URLs) to cover the
  first screen's cards, marquee logo, and backdrop
- Paint prefetched art synchronously in CachedAsyncImage: the
  prefetchers warm the bare-URL cache key, which the resized render
  request always missed, forcing an async re-decode on first paint
- Seed the focus marquee with the first row's first item on cold entry
  instead of waiting for focus + rest debounce
- Snap in the initial backdrop, marquee block, and cached logo; only
  content-to-content swaps keep the ambient crossfade
- Let the focus engine's initial resolution land on the first card
  (defaultFocus .automatic) so it renders pre-focused instead of
  growing after the page paints; d-pad movement stays geometric
- Cache sampled backdrop tints in HeroBackdropPalette with a
  synchronous cachedTint(for:) lookup
- Warm the first home item's tint during the startup splash prefetch
- Apply a cached tint synchronously in the marquee model so the seeded
  backdrop and its color wash land on the same frame
- Snap the initial tint in TVRootHeroBackdrop; tint-to-tint changes
  keep the ambient crossfade
- Seed TVMainTabView's libraries and currentProfile from the startup
  prefetch cache so the bar's first frame after the splash has all type
  tabs and the avatar instead of popping them in a beat later.
- Move the search button into the centered tab cluster, left of Home,
  balanced by an invisible trailing twin so the tabs stay screen-centered.
- Choose the focus owner explicitly when the nav stack pops to root:
  re-assert bar suppression (the engine's restore could land on the last
  bar element for a frame), and hand focus back to the bar for routes
  pushed from it (search, profile / For You panel items) instead of
  letting the engine free-resolve onto an arbitrary row card.
@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@zZebrahz, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c154122-c393-455d-a419-b2b446b27f4f

📥 Commits

Reviewing files that changed from the base of the PR and between af7245e and 8a356b3.

📒 Files selected for processing (1)
  • iosApp/iosApp/Startup/StartupContentPrefetcher.swift
📝 Walkthrough

Walkthrough

Changes

tvOS experience

Layer / File(s) Summary
Startup prefetch and cache warming
iosApp/iosApp/Components/HeroBackdropPalette.swift, iosApp/iosApp/Startup/StartupContentPrefetcher.swift, iosApp/iosApp/tvOS/Caching/CachedAsyncImage.swift
Adds session tint caching, expands tvOS artwork prefetching, prefetches profiles, and renders synchronously cached images.
Hero cold-entry presentation
iosApp/iosApp/tvOS/Components/TVFocusMarquee.swift, iosApp/iosApp/tvOS/Components/TVRootHeroBackdrop.swift, iosApp/iosApp/tvOS/Components/TVSkylineSectionFeed.swift
Seeds marquee content from the first item, applies cached tints immediately, and disables initial artwork crossfades until content is displayed.
Default focus priority wiring
iosApp/iosApp/Components/MediaRow.swift, iosApp/iosApp/Screens/Home/SectionRow.swift, iosApp/iosApp/tvOS/Components/TVSkylineSectionFeed.swift
Adds configurable default-focus priority and enables automatic first-item focus for the first Skyline row.
Navigation cache and focus restoration
iosApp/iosApp/tvOS/Navigation/TVMainTabView.swift, iosApp/iosApp/tvOS/Navigation/TVTopMenuBar.swift
Initializes navigation state from caches, centralizes bar-origin navigation, restores top-menu focus after returning to root, and repositions the search control.
TV presentation styling
iosApp/iosApp/Screens/Player/tvOS/TVPlayerControls.swift
Changes the remaining-time label to opaque white.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant StartupContentPrefetcher
  participant HeroBackdropPalette
  participant TVSkylineSectionFeed
  participant TVFocusMarquee
  participant TVRootHeroBackdrop
  StartupContentPrefetcher->>HeroBackdropPalette: sample and cache hero tint
  TVSkylineSectionFeed->>TVFocusMarquee: seed first section item
  TVFocusMarquee->>HeroBackdropPalette: read cached tint
  TVFocusMarquee->>TVRootHeroBackdrop: display initial artwork and tint
  TVRootHeroBackdrop->>TVRootHeroBackdrop: enable transitions after first artwork
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main themes of the changes: tvOS startup paint improvements and top menu focus behavior.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tvos-july-11-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zZebrahz zZebrahz changed the title tvOS July 11 fixes: startup paint, nav bar polish, focus ownership Refine tvOS startup paint and top menu focus Jul 12, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
iosApp/iosApp/Startup/StartupContentPrefetcher.swift (1)

401-409: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Gate the tint warmup to tvOS.

HeroBackdropPalette.tintColor is consumed only by tvOS's focus marquee/hero backdrop (per the supplied TVFocusMarquee/TVRootHeroBackdrop evidence). This new warmup task runs unconditionally in shared code, so phone/other platforms pay for an image fetch + CIImage average-color sample with no consumer, unlike the maxHomeArtworkURLs split just above (lines 5-12) which is already platform-gated.

♻️ Proposed fix
         guard !urls.isEmpty else { return }
         PosterImageCache.prefetcher.startPrefetching(with: urls)
 
+        `#if` os(tvOS)
         // Warm the marquee's initial tint: tvOS seeds the marquee with the
         // first row's first item on cold entry, and a cached sample lets the
         // tint wash paint on the same frame as the backdrop instead of
         // fading up from the black background once sampling finishes.
         if let firstBackdrop = normalizedURL(from: contentSections.first?.items.first?.backdropUrl) {
             Task { _ = await HeroBackdropPalette.tintColor(for: firstBackdrop) }
         }
+        `#endif`
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@iosApp/iosApp/Startup/StartupContentPrefetcher.swift` around lines 401 - 409,
Gate the HeroBackdropPalette.tintColor warmup in StartupContentPrefetcher to
tvOS only, using the existing platform-conditional pattern near
maxHomeArtworkURLs. Keep the normalized first backdrop selection and Task
behavior unchanged within the tvOS branch, and avoid scheduling the image fetch
or palette sampling on other platforms.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@iosApp/iosApp/Startup/StartupContentPrefetcher.swift`:
- Around line 401-409: Gate the HeroBackdropPalette.tintColor warmup in
StartupContentPrefetcher to tvOS only, using the existing platform-conditional
pattern near maxHomeArtworkURLs. Keep the normalized first backdrop selection
and Task behavior unchanged within the tvOS branch, and avoid scheduling the
image fetch or palette sampling on other platforms.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cfb8d968-bc75-40bf-876f-f75ededef30d

📥 Commits

Reviewing files that changed from the base of the PR and between e2e1668 and af7245e.

📒 Files selected for processing (11)
  • iosApp/iosApp/Components/HeroBackdropPalette.swift
  • iosApp/iosApp/Components/MediaRow.swift
  • iosApp/iosApp/Screens/Home/SectionRow.swift
  • iosApp/iosApp/Screens/Player/tvOS/TVPlayerControls.swift
  • iosApp/iosApp/Startup/StartupContentPrefetcher.swift
  • iosApp/iosApp/tvOS/Caching/CachedAsyncImage.swift
  • iosApp/iosApp/tvOS/Components/TVFocusMarquee.swift
  • iosApp/iosApp/tvOS/Components/TVRootHeroBackdrop.swift
  • iosApp/iosApp/tvOS/Components/TVSkylineSectionFeed.swift
  • iosApp/iosApp/tvOS/Navigation/TVMainTabView.swift
  • iosApp/iosApp/tvOS/Navigation/TVTopMenuBar.swift

@Quick104
Quick104 merged commit aa2f054 into main Jul 13, 2026
1 check passed
@Quick104
Quick104 deleted the tvos-july-11-fixes branch July 13, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants