Add iPhone target with shared data layer and persistent cache
Two-target restructure: shared sources (models, services, settings, extensions, team logos) move into Shared/, consumed by both the existing macOS menu bar app and a new iOS app. MainService no longer imports AppKit — platform code attaches via a MainServiceObserver protocol (MacObserverAdapter wires back to MenuManager / StatusItemManager / NotificationManager). iPhone app is a single SwiftUI page mirroring the macOS menu (playoff round + yesterday/today/tomorrow), with a gear-icon settings sheet (display option + IndieAbout for license/changelog). Persistent JSON snapshot in Application Support paints last-known data on cold launch; "Updated …" header escalates secondary → orange (>5min) → red (>30min) so staleness is visually unmistakable. Foreground polling, scenePhase refresh, and pull-to-refresh; no notifications on iOS in v1.
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
# IceGlass
|
||||
|
||||
A macOS menu bar app for NHL game situational awareness.
|
||||
NHL game situational awareness for macOS (menu bar) and iPhone (single-page app).
|
||||
|
||||
## Key Features
|
||||
|
||||
### macOS menu bar app
|
||||
- NHL shield icon in the menu bar with game count
|
||||
- Shows games from yesterday, today, and tomorrow grouped by date (configurable)
|
||||
- Regular-season rows show league-wide game number (`#547 NYR @ WAS …`)
|
||||
@@ -11,28 +12,37 @@ A macOS menu bar app for NHL game situational awareness.
|
||||
- Game format: `NYR @ WAS 0:2 (FINAL)` / `DAL @ TOR Today @ 7:30 PM`
|
||||
- Click a game to open NHL GameCenter; option-click for NHL Videocast
|
||||
- Goal scored notifications with scoring team logo
|
||||
- Game start notifications on FUT→LIVE state transition
|
||||
- Game start / game ended notifications
|
||||
- Dynamic polling: 7s during live games, scales back when idle
|
||||
- Display Options: choose which days to show (yesterday/today/tomorrow)
|
||||
- Refresh Now (⌘R) for immediate updates
|
||||
- Launch at Login support
|
||||
- About window via IndieAbout
|
||||
|
||||
### iPhone app
|
||||
- Single scrollable page mirroring the macOS menu's content
|
||||
- "Updated …" header showing relative + absolute ET timestamps; turns orange after 5 min, red after 30 min
|
||||
- Persistent JSON cache in Application Support so cold launches paint last-known data instantly
|
||||
- Pull-to-refresh, plus auto-refresh on scene activation and foreground polling timer
|
||||
- Settings sheet (gear, top-right): display option picker + IndieAbout (license + changelog)
|
||||
- Tap a game to open NHL GameCenter; tap a series to open the NHL series page
|
||||
|
||||
## Building
|
||||
|
||||
Requires XcodeGen to generate the project:
|
||||
|
||||
```bash
|
||||
xcodegen generate
|
||||
xcodebuild -scheme IceGlass -configuration Debug build
|
||||
xcodebuild -scheme IceGlass -configuration Debug build # macOS
|
||||
xcodebuild -scheme IceGlass-iOS -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 17 Pro' build
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
Menu bar app using singleton services pattern:
|
||||
- **MainService** — polls NHL scoreboard API, manages game data
|
||||
- **MenuManager** — builds dropdown menu with date-grouped games
|
||||
- **StatusItemManager** — manages menu bar icon
|
||||
- **NotificationManager** — game start and goal scored notifications with team logos
|
||||
Two targets sharing a common data layer (`Shared/`) and platform-specific UI:
|
||||
|
||||
Uses the NHL Web API (`api-web.nhle.com/v1/scoreboard/now`) for league-wide schedule and score data.
|
||||
- **Shared/** — `MainService`, `ApiService`, `AppSettings`, `NHLDataCache`, models, Date/Time/Logger helpers
|
||||
- **IceGlass/** — macOS-only managers (MenuManager, StatusItemManager, NotificationManager, AboutWindow)
|
||||
- **IceGlass-iOS/** — SwiftUI views, ScoreboardViewModel (`@Observable`)
|
||||
|
||||
`MainService` exposes a `MainServiceObserver` protocol; each platform installs its own adapter to bridge data updates into AppKit (macOS) or `@Observable` invalidation (iOS). Data is fetched from the NHL Web API (`api-web.nhle.com/v1/scoreboard/now`, `/standings/{date}`, `/playoff-bracket/{year}`).
|
||||
|
||||
Reference in New Issue
Block a user