|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +BCC Media App — a Flutter video-on-demand app for iOS, Android, and web. Has two flavors: **BCC Media** (main) and **Kids** (in `kids/` directory, separate Flutter project that imports the main app). |
| 8 | + |
| 9 | +## Development Setup |
| 10 | + |
| 11 | +```bash |
| 12 | +git submodule update --init |
| 13 | +make pubgetall # flutter pub get for all packages |
| 14 | +# Copy lib/env/.env.dart.template → lib/env/.env.dart and fill in values |
| 15 | +``` |
| 16 | + |
| 17 | +## Common Commands |
| 18 | + |
| 19 | +```bash |
| 20 | +# Code generation (run during development — required after model/route/GraphQL changes) |
| 21 | +dart run build_runner watch --delete-conflicting-outputs |
| 22 | + |
| 23 | +# Generate localization files (after editing lib/l10n/bccm_en.arb) |
| 24 | +flutter gen-l10n |
| 25 | + |
| 26 | +# Analyze |
| 27 | +flutter analyze |
| 28 | + |
| 29 | +# Run tests |
| 30 | +flutter test # all tests |
| 31 | +flutter test test/some_test.dart # single test |
| 32 | + |
| 33 | +# Build web |
| 34 | +make web-build |
| 35 | + |
| 36 | +# Version management |
| 37 | +make bump # bump main app version |
| 38 | +make bump-kids # bump kids app version |
| 39 | +make release # create release tag and push |
| 40 | +make release-kids # kids release |
| 41 | + |
| 42 | +# Useful |
| 43 | +make help # list all make targets |
| 44 | +make pubgetall # pub get for all packages |
| 45 | +make main-branch # sync submodules to their main branches |
| 46 | +make fix-time # fix android emulator clock drift (SSL issues) |
| 47 | +``` |
| 48 | + |
| 49 | +Use VS Code debug configurations in `.vscode/launch.json` for running/debugging (e.g. `bccm-mobile: debug`, `kids-mobile: debug`). |
| 50 | + |
| 51 | +## Architecture |
| 52 | + |
| 53 | +### State Management |
| 54 | +**Riverpod** with code generation. Key providers in `lib/providers/`: |
| 55 | +- `settingsProvider` — user preferences (Freezed model) |
| 56 | +- `playbackServiceProvider` — video playback |
| 57 | +- `bccmGraphQLProvider` — GraphQL client |
| 58 | +- `featureFlagsProvider` — Unleash feature flags |
| 59 | +- `authStateProvider` — authentication state |
| 60 | + |
| 61 | +### Routing |
| 62 | +**auto_route** for navigation, **app_links** for deep linking (not Flutter's built-in deep linking). Routes defined in `lib/router/router.dart`, generated to `router.gr.dart`. Special routes (`/r/`, `/tvlogin`, legacy routes) handled via `lib/helpers/router/special_routes.dart`. |
| 63 | + |
| 64 | +### Submodules |
| 65 | +- `submodules/bccm_flutter/bccm_core` — shared core library (GraphQL, auth, push notifications, utils). Anything shared with other apps goes here. |
| 66 | +- `submodules/bccm_flutter/bmm_api` — BMM audio API client |
| 67 | +- `submodules/bccm_player` — standalone native video player library (playback, Chromecast, AirPlay) |
| 68 | + |
| 69 | +### API Layer |
| 70 | +- **GraphQL** (main content API) — queries in `.graphql` files, code-generated to `.graphql.dart` |
| 71 | +- **BMM API** — audio/podcast content |
| 72 | +- **Auth0** — authentication |
| 73 | +- **Unleash** — feature flags |
| 74 | + |
| 75 | +### Flavors |
| 76 | +Configured in `lib/flavors.dart`. Entry points: `lib/main_prod.dart` (production), `lib/main_dev.dart` (development). Each flavor specifies Firebase options, design system, assets, and default language. |
| 77 | + |
| 78 | +### Translations |
| 79 | +Phrase-managed i18n. Source strings in `lib/l10n/bccm_en.arb`. Pushing to master triggers Phrase to distribute translation jobs; completed translations arrive as automated PRs. |
| 80 | + |
| 81 | +## Code Generation |
| 82 | + |
| 83 | +Generated files (do not edit manually): |
| 84 | +- `.freezed.dart` — immutable models (Freezed) |
| 85 | +- `.g.dart` — JSON serialization, Riverpod providers |
| 86 | +- `.graphql.dart` — GraphQL types and operations |
| 87 | +- `.gr.dart` — auto_route routes |
| 88 | +- `lib/l10n/app_localizations*.dart` — localization |
| 89 | + |
| 90 | +These are excluded from analysis in `analysis_options.yaml`. |
| 91 | + |
| 92 | +## Linting |
| 93 | + |
| 94 | +Uses `package:flutter_lints/flutter.yaml` with `prefer_single_quotes: true` and `avoid_print: false`. |
| 95 | + |
| 96 | +## Testing |
| 97 | + |
| 98 | +- Unit/widget tests: `test/` directory, run with `flutter test` |
| 99 | +- E2E UI tests: `.maestro/` directory using [Maestro](https://maestro.mobile.dev/), run during release pipeline |
0 commit comments