feat(sports): ESPN scoreboards for 7 leagues, reloaded while the tab is open #14

Merged
namillis merged 2 commits from feat/sports-espn into main 2026-11-11 01:04:18 +00:00
Owner

Phase 1 of the iPhone Sports handoff: the TV app's ESPN scoreboard, in layout A of the mockups. Finding a channel for every game, the Other channels sheet and Search hand-off are Phase 2.

What changed

  • ESPN scoreboards (LiveWire/Sports/EspnClient.swift). The TV app's 7 leagues load at once, and a league that fails is skipped. The error state shows only when every league fails and nothing has loaded yet. Dates are accepted with or without seconds (2026-09-29T00:15Z). Logos come from ESPN's image resizer at 60 px, about 4 KB each instead of 98 KB.
  • List rules (LiveWire/Sports/SportsList.swift), ported from SportsList.kt, SportsFormat.kt and SportsRepository.kt:
    • Sections are On now (league order, then start), Coming up (soonest first) and Finished (most recent first, dimmed).
    • Scores show only for live and finished games. A coming game shows "10:30 PM" today or "Thu 8:15 PM" on another day.
    • League chips list each league that has games, with its count. The row is hidden when only All is left.
    • A game is matched to the pool's Live Sports channel by the TV app's rule: both teams named, and the event starts within 12 h of the game.
  • Rows (LiveWire/Sports/SportsView.swift) follow mockup A. Each row has the league, the status (red with a dot while live), a line per team (logo, code, name, score, leader in bold) and the networks. A game with a pool channel gets a Live Now pill, and tapping it plays the channel and switches to Watch, as before. Other games aren't tappable until Phase 2 adds sources.
  • Refresh (LiveWire/Sports/SportsStore.swift, AppModel.refreshLiveNow). Scores and the Live Sports category (get_live_streams&category_id=) reload when the tab opens, when the app comes back to the foreground, and every 30 s while a game is live or should have started. Pull to refresh works too. Opening the tab again within 10 s doesn't reload.
  • More from the pool. The pool's Live Sports events that match no ESPN game follow the scoreboard: live ones first, then by start time. The first 5 show, and "Show all" lists the rest. They use the old Sports row. This was planned for Phase 3, but without it Phase 1 would drop tennis, F1 and the rest from the tab. It's a separate section because tonight the pool listed 163 events against ESPN's 62 games. Mixed into On now, they buried the scoreboard (113 rows).
  • Tests. There's a new LiveWireTests target in project.yml (the project was regenerated with XcodeGen 2.46.0, and a shared LiveWire scheme is now committed). The TV app's Sports, format and ESPN-date tests are ported, plus tests for the iPhone's pool rows and the scoreboard mapping. 30 tests.
  • README.md: the Sports line, LiveWire/Sports/, how to run the tests, and the -sportsLeague / -sportsFail launch arguments.

Intent: bring the iPhone Sports tab up to the TV app's scoreboard. Not a goal here: channel matching for games the pool doesn't carry, the Other channels sheet, followed teams, or the score bar (Phases 2 and 3).

Testing

iPhone 18 Pro Simulator, Debug build, tv3, Tuesday 10 November 7:45–8:00 PM ET:

  • All 7 leagues loaded: 62 games, 9 live. Each live game ESPN listed had a Live Now channel.
  • 30 s refresh. With the tab open, SPORTS reload lines showed Bucks–Knicks going 10-13 → 13-13 at 6:00 → 5:47 → 5:01 in the 1st, about every 30 s.
  • Foreground. I went to Settings for 15 s and came back, and the tab reloaded at once (13-15, 4:37).
  • The Live Sports category reloaded alongside the scores (163 channels).
  • xcodebuild test passes 30 of 30.

Finding: ESPN's default college boards are small

ESPN's default college scoreboards only list featured games. Tonight, NCAAB listed 8 games where groups=50 (all of Division I) has 69, 38 of them live. NCAAF listed 20 of Saturday's games and left out tonight's two live MAC games, which groups=80 includes. The TV app makes the same call, so this PR matches it. Those games still show under More from the pool when the pool carries them. Adding groups is a one-line change per league, if you want it in both apps.

Screenshots

All leagues NHL chip Finished (NFL chip) ESPN unreachable
All leagues NHL chip Finished ESPN failed

The last one also shows More from the pool and its Show all button.

Phase 1 of the iPhone Sports handoff: the TV app's ESPN scoreboard, in layout A of the mockups. Finding a channel for every game, the Other channels sheet and Search hand-off are Phase 2. ## What changed - **ESPN scoreboards** (`LiveWire/Sports/EspnClient.swift`). The TV app's 7 leagues load at once, and a league that fails is skipped. The error state shows only when every league fails and nothing has loaded yet. Dates are accepted with or without seconds (`2026-09-29T00:15Z`). Logos come from ESPN's image resizer at 60 px, about 4 KB each instead of 98 KB. - **List rules** (`LiveWire/Sports/SportsList.swift`), ported from `SportsList.kt`, `SportsFormat.kt` and `SportsRepository.kt`: - Sections are On now (league order, then start), Coming up (soonest first) and Finished (most recent first, dimmed). - Scores show only for live and finished games. A coming game shows "10:30 PM" today or "Thu 8:15 PM" on another day. - League chips list each league that has games, with its count. The row is hidden when only All is left. - A game is matched to the pool's Live Sports channel by the TV app's rule: both teams named, and the event starts within 12 h of the game. - **Rows** (`LiveWire/Sports/SportsView.swift`) follow mockup A. Each row has the league, the status (red with a dot while live), a line per team (logo, code, name, score, leader in bold) and the networks. A game with a pool channel gets a Live Now pill, and tapping it plays the channel and switches to Watch, as before. Other games aren't tappable until Phase 2 adds sources. - **Refresh** (`LiveWire/Sports/SportsStore.swift`, `AppModel.refreshLiveNow`). Scores and the Live Sports category (`get_live_streams&category_id=`) reload when the tab opens, when the app comes back to the foreground, and every 30 s while a game is live or should have started. Pull to refresh works too. Opening the tab again within 10 s doesn't reload. - **More from the pool.** The pool's Live Sports events that match no ESPN game follow the scoreboard: live ones first, then by start time. The first 5 show, and "Show all" lists the rest. They use the old Sports row. This was planned for Phase 3, but without it Phase 1 would drop tennis, F1 and the rest from the tab. It's a separate section because tonight the pool listed 163 events against ESPN's 62 games. Mixed into On now, they buried the scoreboard (113 rows). - **Tests.** There's a new `LiveWireTests` target in `project.yml` (the project was regenerated with XcodeGen 2.46.0, and a shared `LiveWire` scheme is now committed). The TV app's Sports, format and ESPN-date tests are ported, plus tests for the iPhone's pool rows and the scoreboard mapping. 30 tests. - `README.md`: the Sports line, `LiveWire/Sports/`, how to run the tests, and the `-sportsLeague` / `-sportsFail` launch arguments. Intent: bring the iPhone Sports tab up to the TV app's scoreboard. Not a goal here: channel matching for games the pool doesn't carry, the Other channels sheet, followed teams, or the score bar (Phases 2 and 3). ## Testing iPhone 18 Pro Simulator, Debug build, tv3, Tuesday 10 November 7:45–8:00 PM ET: - All 7 leagues loaded: 62 games, 9 live. Each live game ESPN listed had a Live Now channel. - **30 s refresh.** With the tab open, `SPORTS` reload lines showed Bucks–Knicks going 10-13 → 13-13 at 6:00 → 5:47 → 5:01 in the 1st, about every 30 s. - **Foreground.** I went to Settings for 15 s and came back, and the tab reloaded at once (13-15, 4:37). - The Live Sports category reloaded alongside the scores (163 channels). - `xcodebuild test` passes 30 of 30. ## Finding: ESPN's default college boards are small ESPN's default college scoreboards only list featured games. Tonight, NCAAB listed 8 games where `groups=50` (all of Division I) has 69, 38 of them live. NCAAF listed 20 of Saturday's games and left out tonight's two live MAC games, which `groups=80` includes. The TV app makes the same call, so this PR matches it. Those games still show under More from the pool when the pool carries them. Adding `groups` is a one-line change per league, if you want it in both apps. ## Screenshots | All leagues | NHL chip | Finished (NFL chip) | ESPN unreachable | |---|---|---|---| | ![All leagues](https://git.namillis.me/namillis/LiveWireiOS/raw/branch/feat/sports-espn/design/pr-shots/sports-espn/1-all.jpg) | ![NHL chip](https://git.namillis.me/namillis/LiveWireiOS/raw/branch/feat/sports-espn/design/pr-shots/sports-espn/2-nhl-chip.jpg) | ![Finished](https://git.namillis.me/namillis/LiveWireiOS/raw/branch/feat/sports-espn/design/pr-shots/sports-espn/3-finished.jpg) | ![ESPN failed](https://git.namillis.me/namillis/LiveWireiOS/raw/branch/feat/sports-espn/design/pr-shots/sports-espn/4-espn-failed.jpg) | The last one also shows More from the pool and its Show all button.
Ports LiveWireTV's Sports list rules, status formatting, ESPN mapping and Live Now matching, with their tests as a new LiveWireTests target. The pool's other Live Sports events follow under More from the pool.
namillis deleted branch feat/sports-espn 2026-11-11 01:04:18 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
namillis/LiveWireiOS!14
No description provided.