Commit Graph

345 Commits

Author SHA1 Message Date
Trey t
bb332ade3c feat(paywall): enhance onboarding with rich backgrounds and intro pricing
- Add themed backgrounds for each onboarding feature page:
  - Unlimited Trips: animated route map with dotted paths and traveling car
  - Export & Share: floating documents with radiating share lines
  - Track Your Journey: stadium map with pins and achievement badges
- Add sports-themed pricing page background with random glow effects
- Display introductory offer pricing in subscription rows
- Add feature bullets to each onboarding page for better value prop
- Add crown icon header and feature pills to pricing page
- Add debug button in Settings to preview onboarding flow
- Create StoreKit configuration file for testing IAP

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 20:07:47 -06:00
Trey t
76a6958f5e docs: add comprehensive sync reliability documentation
Adds SYNC_RELIABILITY.md covering:
- Architecture overview with diagrams
- Component documentation (CloudKitService, CanonicalSyncService,
  BackgroundSyncManager, NetworkMonitor, SyncCancellationToken)
- Data flow diagrams for all sync triggers
- Error handling strategies
- Debugging guide with LLDB commands
- Testing checklist
- Performance considerations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 19:28:42 -06:00
Trey t
d377d03b10 docs: add comprehensive sync reliability documentation
Adds SYNC_RELIABILITY.md covering:
- Architecture overview with diagrams
- Component documentation (CloudKitService, CanonicalSyncService,
  BackgroundSyncManager, NetworkMonitor, SyncCancellationToken)
- Data flow diagrams for all sync triggers
- Error handling strategies
- Debugging guide with LLDB commands
- Testing checklist
- Performance considerations
- Info.plist configuration requirements

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 19:24:04 -06:00
Trey t
5686af262f feat(sync): add pagination, cancellation, and network restoration
- CloudKit pagination: fetchAllRecords() handles >400 record batches
  with cursor-based pagination (400 records per page)
- Cancellation support: SyncCancellationToken protocol enables graceful
  sync termination when background tasks expire
- Per-entity progress: SyncState now tracks timestamps per entity type
  so interrupted syncs resume where they left off
- NetworkMonitor: NWPathMonitor integration triggers sync on network
  restoration with 2.5s debounce to handle WiFi↔cellular flapping
- wasCancelled flag in SyncResult distinguishes partial from full syncs

This addresses critical data sync issues:
- CloudKit queries were limited to ~400 records but bundled data has ~5000 games
- Background tasks could be killed mid-sync without saving progress
- App had no awareness of network state changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 19:18:55 -06:00
Trey t
00b33202f5 chore: add .worktrees/ to gitignore for isolated development 2026-01-13 18:51:42 -06:00
Trey t
b433e1dad5 docs: add sync reliability design for CloudKit pagination and cancellation
Design covers three improvements:
- Paginated CloudKit fetches to handle >400 records
- Graceful cancellation with per-entity progress saving
- NWPathMonitor for auto-sync on network restoration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 18:49:12 -06:00
Trey t
b99c25d8f6 feat(sync): add background task system for nightly CloudKit sync
Add BGTaskScheduler-based background sync for keeping local data fresh:

- BackgroundSyncManager: New singleton managing background tasks
  - BGAppRefreshTask for periodic CloudKit sync (system-determined frequency)
  - BGProcessingTask for overnight sync + database cleanup (2 AM)
  - Auto-archives games older than 1 year during cleanup

- Info.plist: Added BGTaskSchedulerPermittedIdentifiers
  - com.sportstime.app.refresh (periodic sync)
  - com.sportstime.app.db-cleanup (overnight processing)

- SportsTimeApp: Integrated background task lifecycle
  - Register tasks in init() (required before app finishes launching)
  - Schedule tasks after bootstrap and when app enters background

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 18:36:35 -06:00
Trey t
f180e5bfed feat(sync): add CloudKit sync for dynamic sports
- Add CKSport model to parse CloudKit Sport records
- Add fetchSportsForSync() to CloudKitService for delta fetching
- Add syncSports() and mergeSport() to CanonicalSyncService
- Update DataProvider with dynamicSports support and allSports computed property
- Update MockAppDataProvider with matching dynamic sports support
- Add comprehensive documentation for adding new sports

The app can now sync sport definitions from CloudKit, enabling new sports
to be added without app updates. Sports are fetched, merged into SwiftData,
and exposed via AppDataProvider.allSports alongside built-in Sport enum cases.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 18:27:56 -06:00
Trey t
dc278085de feat(domain): add DynamicSport model for CloudKit-defined sports
Struct representing sports synced from CloudKit. Conforms to AnySport
protocol for interchangeable use with Sport enum in UI and planning.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 16:22:02 -06:00
Trey t
e781eaa17c feat(domain): add AnySport conformance to Sport enum
Existing Sport enum now conforms to AnySport protocol, enabling
unified handling with future DynamicSport types.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 16:17:04 -06:00
Trey t
3b1add024f feat(domain): add AnySport protocol for unified sport handling
Defines protocol that both Sport enum and DynamicSport will conform to,
enabling interchangeable use in UI and planning engine.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 16:11:53 -06:00
Trey t
56869ce479 feat(ui): add 23 home screen design variants with picker
Add design style system with 23 unique home screen aesthetics:
- Classic (original SportsTime design, now default)
- 12 experimental styles (Brutalist, Luxury Editorial, etc.)
- 10 polished app-inspired styles (Flighty, SeatGeek, Apple Maps,
  Things 3, Airbnb, Spotify, Nike Run Club, Fantastical, Strava,
  Carrot Weather)

Includes settings picker to switch between styles and persists
selection via UserDefaults.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 14:44:30 -06:00
Trey t
3d40145ffb docs: update planning documents and todos
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 13:16:52 -06:00
Trey t
04b62f147e fix: resolve compiler warnings across codebase
- PaywallView: remove unnecessary nil coalescing for currencyCode
- GameDAGRouter: change var to let for immutable compositeKeys
- GamesHistoryRow/View: add missing wnba and nwsl switch cases
- VisitDetailView: fix unused variable in preview
- AchievementEngine: use convenience init to avoid default parameter warning
- ProgressCardGenerator: use method overload instead of default parameter
- StadiumProximityMatcher: extract constants to ProximityConstants enum

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 13:16:40 -06:00
Trey t
22772fa57f feat(store): add In-App Purchase system with Pro subscription
Implement freemium model with StoreKit 2:
- StoreManager singleton for purchase/restore/entitlements
- ProFeature enum defining gated features
- PaywallView and OnboardingPaywallView for upsell UI
- ProGate view modifier and ProBadge component

Feature gating:
- Trip saving: 1 free trip, then requires Pro
- PDF export: Pro only with badge indicator
- Progress tab: Shows ProLockedView for free users
- Settings: Subscription management section

Also fixes pre-existing test issues with StadiumVisit
and ItineraryOption model signature changes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 11:41:40 -06:00
Trey t
e4204175ea docs: add In-App Purchase implementation plan
14 bite-sized TDD tasks covering:
- StoreKit configuration file setup
- StoreManager with entitlement checking
- PaywallView and OnboardingPaywallView
- ProGate view modifier for feature gating
- Trip saving, PDF export, and Progress tab gating
- Settings subscription management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 10:11:02 -06:00
Trey t
56138d3282 docs: add in-app purchase and subscription system design
Freemium model with StoreKit 2 local-only entitlement checking.
Pro features: unlimited trips, PDF export, progress tracking.
Monthly ($4.99) and annual ($49.99) pricing with Family Sharing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 10:07:08 -06:00
Trey t
c0f1645434 feat(ui): replace loading indicators with Apple-style LoadingSpinner
- Add LoadingSpinner component with small/medium/large sizes using system gray color
- Add LoadingPlaceholder for skeleton loading states
- Add LoadingSheet for full-screen blocking overlays
- Replace ThemedSpinner/ThemedSpinnerCompact across all views
- Remove deprecated loading components from AnimatedComponents.swift
- Delete LoadingTextGenerator.swift
- Fix PhotoImportView layout to fill full width

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 22:43:33 -06:00
Trey t
f8204007e6 docs: add loading redesign implementation plan
13 tasks covering LoadingSpinner, LoadingPlaceholder, LoadingSheet
creation, ProgressView replacements, and deprecated component removal.
Includes TDD with 13 new tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 22:17:33 -06:00
Trey t
7cb5aafd67 docs: add loading system redesign design
Complete design spec for overhauling all loading views, progress
indicators, and spinners. Covers LoadingSpinner, LoadingPlaceholder,
and LoadingSheet components with Apple-style minimal aesthetic.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 22:14:57 -06:00
Trey t
ba3ea6daeb fix(sync): add foreground sync, remove manual sync button
- Add scenePhase observer to sync when app returns to foreground
- Remove misleading "Sync Schedules" button from Settings (it only
  reloaded local data, didn't actually sync from CloudKit)
- Fix GamesHistoryView to refresh list after deleting a visit

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 22:04:10 -06:00
Trey t
0524284ab8 feat: add planning tips and grouped trip options sorting
- Add PlanningTips data model with 105 tips across 7 categories
- Wire random tips into HomeView (3 tips per session)
- Add TripOptionsGrouper for grouping by city/game count and mileage
- Update TripOptionsView with sectioned display when sorting
- Recommended and Best Efficiency remain flat lists

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 21:49:04 -06:00
Trey t
89167c01d7 feat(progress): add progress tracking enhancements
- Enable zoom/pan on progress map with reset button
- Add visit count badges to stadium chips
- Create GamesHistoryView with year grouping and sport filters
- Create StadiumVisitHistoryView for viewing all visits to a stadium
- Add VisitListCard and GamesHistoryRow components
- Add "See All" navigation from Recent Visits to Games History
- Add tests for map interactions, visit lists, and games history

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 21:34:33 -06:00
Trey t
ed526cabeb refactor(wizard): show all steps at once with validation gating
- Replace progressive reveal with single fade-in of all steps
- Add canPlanTrip validation requiring all fields before planning
- Disable Plan Trip button until all selections are made
- Simplify ViewModel by removing step-by-step visibility logic
- Update tests for new validation-based approach

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 21:19:35 -06:00
Trey t
94bb68d431 fix(wizard): improve UX with step reordering and UI polish
- Reorder wizard steps: dates before sports (enables availability check)
- Add contentShape(Rectangle()) for full tap targets on all cards
- Fix route preference showing preselected value
- Fix sport cards having inconsistent heights
- Speed up step reveal animation (0.3s → 0.15s)
- Add debounced scroll delay to avoid interrupting selection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 21:13:45 -06:00
Trey t
8a958a0f7e feat: replace TripCreationView with TripWizardView in HomeView
Remove classic trip creation form and use new wizard flow directly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:52:29 -06:00
Trey t
d2b530b06f feat(wizard): add TripWizardView container with progressive reveal
- Auto-scroll to newly revealed sections
- Integration with TripPlanningEngine
- Navigation to TripOptionsView on success
- Error handling with alerts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:49:28 -06:00
Trey t
bddbebee32 feat(wizard): add all wizard step components
- DatesStep: date range selection with duration indicator
- RegionsStep: geographic region selection
- RoutePreferenceStep: direct/scenic/balanced preference
- RepeatCitiesStep: unique vs repeat city visits
- MustStopsStep: optional must-stop locations
- ReviewStep: summary and plan button

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:48:27 -06:00
Trey t
002dfbd872 feat(wizard): add SportsStep with availability graying
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:47:11 -06:00
Trey t
4371c1cc0c feat(wizard): add PlanningModeStep component
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:46:44 -06:00
Trey t
abdf11e62e feat(wizard): add TripWizardViewModel with reveal state logic
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:45:52 -06:00
Trey t
d39e8cff30 fix: use dynamic team lookup in scraper for stadium renames
Replace hardcoded stadiumTeamMap with AppDataProvider lookup so
stadium renames (e.g., AT&T Center → Frost Bank Center) work
automatically via CloudKit sync without code changes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:36:36 -06:00
Trey t
393bb8d6f8 feat: enhance game picker row with location and broadcast info
Add city/state location and broadcast channel to GameCalendarRow
in the "By Games" trip building flow. Users now see:
- Clock icon with game time
- Building icon with stadium name
- Location pin with city, state
- TV icon with broadcast channel (when available)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:29:10 -06:00
Trey t
37a1347ce3 perf: lazy hierarchical loading for game picker
Replace upfront loading of all games with lazy Sport → Team → Game
hierarchy. Games are now fetched per-team when expanded and cached
to prevent re-fetching. Also removes pagination workaround and
pre-computes groupings in ScheduleViewModel to avoid per-render work.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:19:46 -06:00
Trey t
9531ed1008 docs: add Trip Planning Enhancements implementation plan
12 tasks with TDD approach:
- TripWizardViewModel with reveal state logic
- 8 step components (PlanningMode, Sports, Dates, Regions, etc.)
- TripWizardView container with auto-scroll
- Settings toggle for classic vs wizard mode
- Integration tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:38:05 -06:00
Trey t
4999c90595 docs: add dynamic sports via CloudKit design
Hybrid approach: keep Sport enum for existing 7 sports,
add DynamicSport struct for CloudKit-defined leagues.
Unified via AnySport protocol for seamless UI integration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:32:42 -06:00
Trey t
1ef3b0335e perf: add pagination to game selection view
Fixes lag and color inconsistency in trip creation game selection.
- Add pagination with 50 games per page to TripCreationViewModel
- Add displayedAvailableGames, loadInitialAvailableGames, loadMoreAvailableGames
- Update GamePickerSheet to use paginated data with infinite scroll trigger
- Show "Load more games" button with progress indicator and count

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:16:42 -06:00
Trey t
746b56bc77 perf: add pagination to schedule list
Loads 50 games at a time to fix lag with large datasets.

- Add pagination state (displayedGames, currentPage, allFilteredGames)
- Add loadInitialGames() and loadMoreGames() methods
- Update gamesBySport to use displayedGames
- Add infinite scroll trigger via onAppear on last game
- Add ProgressView indicator when more games available
- Reset pagination when search text changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:07:54 -06:00
Trey t
3530b31cca docs: add 3 feature enhancement design plans
- Trip Planning Enhancements: progressive reveal single-screen wizard
- Progress Tracking Enhancements: multiple visits, games history, zoomable map
- Polish Enhancements: grouped sorting, 100+ planning tips

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:07:46 -06:00
Trey t
9f3a762324 fix: add AT&T Center alias for Frost Bank Center
NBA scraper now resolves old stadium name to current Spurs arena.
The AT&T Center was renamed to Frost Bank Center in July 2024.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:04:16 -06:00
Trey t
64c64093c4 feat: add timezone support for stadium-local game times
Adds timeZoneIdentifier to Stadium model and localGameTime/localGameTimeShort
computed properties to RichGame. Game times can now display in venue local
timezone. Also adds timezone field to Python StadiumInfo dataclass with
example entries for Pacific, Central, Mountain, and Toronto timezones.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:58:35 -06:00
Trey t
402a8877f3 fix: remove redundant My Trips title from tab view
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:52:18 -06:00
Trey t
1ffd6122c9 fix: pace capsule animation glitch in trip options view
Adds contentTransition(.identity) to pace filter icon and text to prevent
SwiftUI's default text morphing animation when changing pace filter
(All/Packed/Moderate/Relaxed). Also adds animation(nil, value:) to
disable animations on the capsule container.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:48:16 -06:00
Trey t
cf939c4ba3 fix: disable animation on Reset button in game picker
Wrap selectedIds.removeAll() in withTransaction with disablesAnimations
to prevent animation glitches when clearing all selections at once.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:45:08 -06:00
Trey t
d255e28dcc fix: remove weird animation on game selection
Disables implicit animation when toggling game selection to prevent
visual glitches/morphing effect. Uses both withTransaction to disable
animations on the state change and .animation(nil, value:) on the
selection indicator and row background.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:41:40 -06:00
Trey t
7946161945 feat: show location info in schedule view
Adds stadium name and city to game rows in the schedule list.
The GameRowView now has a showLocation parameter that displays
a location row with mappin icon when enabled.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:38:17 -06:00
Trey t
b14f72a0fb perf: move trip generation off main actor
Fixes launch freeze by running TripPlanningEngine in background task.
UI now responsive immediately while trips generate.

- Move heavy computation to Task.detached with .userInitiated priority
- Change all helper methods to nonisolated static functions
- Create local TripPlanningEngine in background task instead of instance property

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:27:49 -06:00
Trey t
aa0bc4def8 docs: add bug fixes design for 9 TODO issues
Covers performance (launch freeze, list lag), UI polish (animations,
missing location info, timezone display), and scraper alias fix.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:06:27 -06:00
Trey t
e70b9faab8 fix: show all team games (home and away) when browsing by team
Previously, browsing by team (e.g., Houston Astros) only showed home games.
Now games are associated with both home AND away teams, so selecting a team
shows all their games regardless of whether they're playing at home or away.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 11:09:50 -06:00
Trey t
3978429716 feat: complete delta sync implementation - add allGames, update callers
- Add allRichGames method to DataProvider
- Update TripCreationViewModel.loadGamesForBrowsing to use allGames (removes 90-day limit)
- Update MockCloudKitService sync methods to use new delta sync signatures
- Update MockAppDataProvider with renamed methods and new allGames/allRichGames
- Fix all callers: ScheduleViewModel, TripCreationViewModel, SuggestedTripsGenerator, GameMatcher
- Update CLAUDE.md documentation with new method names

This completes the delta sync implementation:
- CloudKit sync now uses modificationDate for proper delta sync
- First sync fetches ALL data, subsequent syncs only fetch modified records
- "By Games" mode now shows all available games (not just 90 days)
- All data types (stadiums, teams, games) use consistent delta sync pattern

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 11:04:52 -06:00