Skip to content

Latest commit

 

History

History
43 lines (37 loc) · 4.25 KB

AGENTS.md

File metadata and controls

43 lines (37 loc) · 4.25 KB

Viola Agent Notes

Keep this file updated whenever meaningful product, architecture, or workflow changes happen.

Project overview

  • Viola app with five tabs: News, Calendario, Classifica, FirenzeViola, LadyRadio.
  • Uses Observation (@Observable, @Bindable) for view models and controllers.
  • News data comes from a news articles API (see Viola/News/NewsClient.swift).

Architecture & state

  • News list: NewsListModel (cached via Sharing file storage) + NewsListView with integrated .searchable.
  • Search: NewsSearchModel drives results; recents stored in AppStorage("recentSearches").
  • Calendario and Classifica derive the current season from the tournament API's archivio == 0 metadata and expose independent season menus. The tournament catalogue is paginated to include historical seasons, and Classifica derives its Serie A group ID from the selected season.
  • Article detail: ArticleDetailModel loads detail + media embeds.
  • Article body images are rendered as markdown images and SingleImageLinkMarkdownParser injects tappable viola-image://open?url=... links per image run. Taps open a Quick Look fullscreen preview backed by local cached files (Caches/article-image-previews) in single-image mode (no gallery list/swipe sequence state). Scope excludes hero-image tap handling and fullscreen preview captions. The modal viewer shows a white-tinted top-left share action and top-right close button.
  • Article body images in StructuredText use a custom Textual image attachment loader (RoundedBodyImageAttachmentLoader) to render with rounded corners.
  • Live banner + detail: LiveBannerViewModel fetches current live match list (Fiorentina filter) and injects a banner atop the News list; tapping opens LiveMatchDetailView driven by LiveDetailViewModel fetching full live detail (summary/commentary/lineup tabs). Banner result is cached to disk for fast startup. In DEBUG, if the live list is unreachable, the banner falls back to LiveMockData.sampleMatch; detail still calls the real API.
  • Live summary rows are precomputed in LiveDetailViewModel during refresh and consumed by LiveSummarySection to avoid heavy recomputation in body.

Media playback

  • Live streams are centralized in LiveStreamPlayer with separate audio/video sources.
  • FirenzeViola/LadyRadio tabs share a Radio/Diretta segmented control tied to a page-style TabView; the palinsesto sits below and does not change with the Radio/Diretta selection.
  • Palinsesto filters the empty placeholder slot (idprogramma == 0), uses a larger section header, and relies on row-level loading spinners for slow episode streams (no background audio prewarm task).
  • PlaybackCoordinator owns lock screen metadata + remote command routing and enforces single active playback.
  • Inline audio uses InlineAudioPlayerView controller; inline video uses InlineVideoPlayerView.
  • Only one audio/video source plays at a time (live or inline).
  • Live video uses LiveVideoPlayerView (AVPlayerViewController) with optional PiP + auto-start on background for the main Diretta player.
  • PiP "Back to App" restoration is handled via AVPlayerViewControllerDelegate in LiveVideoPlayerView; on restore, stream tabs force Diretta and switch to the active source tab (FirenzeViola/LadyRadio).
  • Background audio + PiP are enabled in Config/Info.plist (UIBackgroundModes includes audio and picture-in-picture).
  • PlaybackCoordinator updates MPNowPlayingInfoCenter.playbackState and registers remote command handling.
  • Live stream source selection does not interrupt playback; switching happens on play when the selected source differs.
  • Radio/Diretta controls reflect the selected source rather than the currently playing stream.
  • Stream accessory uses an AVPlayerLayer preview to avoid creating a second AVPlayerViewController.
  • Lady Radio audio reads ICY timedMetadata via AVPlayerItem to surface current song (title/artist) for lock screen + Radio view.
  • Palinsesto decoding now tolerates null/empty palinsesto nodes (returns empty schedule instead of throwing).

Build & verification

  • Use XcodeBuildMCP for builds after meaningful changes.
  • Typical flow:
    1. list_sims (ensure a booted simulator)
    2. session-set-defaults with projectPath, scheme: Viola, and simulatorId
    3. build_sim