- Added state management for startup retry and custom station handling in `EstadoRadio`. - Created tasks for implementing strict TDD with RED tests for HTTP failure retries and EQ persistence. - Developed verification report to ensure compliance with TDD practices. - Introduced fake services for testing, including `FakeServicioAudio`, `FakeServicioFavoritos`, and `FakeServicioRadio`. - Implemented widget tests for `PantallaInicio` and `PantallaFavoritos` to validate UI behavior with custom stations. - Enhanced `ServicioRadio` to support host rotation and retry logic for API calls. - Established a new configuration file to enforce project constraints and testing rules.
2.9 KiB
2.9 KiB
Tasks: Startup retry, custom stations, and equalizer persistence
Phase 1: Test seams and RED tests
- 1.1 RED: Add
test/servicios/servicio_radio_test.dartproving a transient HTTP failure retries with another host and succeeds. - 1.2 RED: Add
test/servicios/servicio_radio_test.dartproving exhausted retries surface an error after the configured attempt cap. - 1.3 RED: Add
test/estado/estado_radio_test.dartproving a saved custom station is included in the main listing getter. - 1.4 RED: Add
test/estado/estado_radio_test.dartproving main EQ loads from persistence before playback EQ selection. - 1.5 RED: Add station EQ tests proving own EQ overrides main and disabled own EQ falls back to main.
- 1.6 RED: Add/update a widget test proving
PantallaIniciorenders custom stations and favorite tap calls the favorite flow.
Phase 2: Foundation / services
- 2.1 GREEN: Modify
ServicioRadioto accept injectablehttp.Client, host list, max attempts, and retry delay while preserving default constructor behavior. - 2.2 GREEN: Implement bounded retry/host rotation in
ServicioRadio._get()without adding unbounded startup waits. - 2.3 GREEN: Create
lib/servicios/servicio_ecualizador.dartwith SharedPreferences JSON load/save for main EQ and per-station EQ map. - 2.4 GREEN: Add equality/copy helpers to
PresetEcualizadoronly if required by tests.
Phase 3: State integration
- 3.1 GREEN: Update
EstadoRadioconstructor for optional service injection and load EQ config during_init(). - 3.2 GREEN: Add a combined main listing getter (
emisorasInicioor equivalent) that includes custom stations plus API stations without duplicates. - 3.3 GREEN: Persist main EQ changes when no station-own EQ scope is active.
- 3.4 GREEN: Add methods to enable/update/disable EQ per favorite station and persist the map.
- 3.5 GREEN: Change playback EQ selection to apply station EQ when present, otherwise main EQ.
Phase 4: UI wiring
- 4.1 GREEN: Update
PantallaInicioto render the combined main listing when no genre filter is selected. - 4.2 GREEN: Reuse
TarjetaEmisorafavorite controls for custom stations; do not introduce a parallel favorite path. - 4.3 GREEN: Update
PantallaAjustesEQ controls to show/edit main EQ and, when the current station is a favorite, allow own-EQ vs main-EQ mode. - 4.4 GREEN: Fix
ServicioAudio/handler soemisoraActualis set on successful playback and cleared on stop/error as tests require.
Phase 5: REFACTOR and verification
- 5.1 REFACTOR: Remove duplicated JSON/persistence logic from
EstadoRadiowhere the new service owns it. - 5.2 REFACTOR: Keep Spanish naming and Provider/ChangeNotifier style consistent with existing folders.
- 5.3 VERIFY: Run
flutter testonly; never runflutter build. - 5.4 VERIFY: Compare passing tests against every Given/When/Then scenario in
spec.md.