refactor(alarm): make the ringing screen pure UI over a reduced native port
PantallaAlarmaSonando no longer owns any audio orchestration (fallback player, dB ramp, native handoff confirm, media-volume override/restore): it only calls EstadoAlarmas.finalizarEjecucion/posponerAlarma from Stop/Snooze/back, keeping the single-exit guard, PopScope back=Stop and dismiss semantics intact. The status line now reads directly from the alarm's static config (station name or a neutral label) instead of a live playback/handoff state. PuertoAlarmasAndroid drops confirmarAudioFlutter, forzarVolumenMediaParaAlarma and restaurarVolumenMedia, and app.dart no longer pre-starts a station before pushing the ring screen. This is the Dart half of moving to a single native ring-audio owner (WU1 of 2); the Kotlin service rebuild lands next and keeps this intermediate state shippable with no double audio.
This commit is contained in:
@@ -17,31 +17,11 @@ class FakePuertoAlarmasAndroid implements PuertoAlarmasAndroid {
|
||||
bool ignoraOptimizacionBateria = true;
|
||||
int solicitudesExencionBateria = 0;
|
||||
|
||||
/// Records each [forzarVolumenMediaParaAlarma] call (Slice 2: ring-scoped
|
||||
/// device-volume override).
|
||||
final volumenForzado = <double>[];
|
||||
|
||||
/// Counts [restaurarVolumenMedia] calls (Slice 2). A plain counter, not a
|
||||
/// list: widget tests only need to assert how many times restore ran.
|
||||
int volumenRestaurado = 0;
|
||||
|
||||
/// Test-only failure switch (Design D7): when true, [programar] throws
|
||||
/// instead of scheduling, enabling failure-path coverage that the fake
|
||||
/// could not otherwise produce.
|
||||
bool fallaProgramar = false;
|
||||
|
||||
/// Test-only gate (Slice 3: fade-in dedup at handoff). When set,
|
||||
/// [confirmarAudioFlutter] suspends on this completer before resolving,
|
||||
/// letting a test observe the pre-confirm state deterministically instead
|
||||
/// of racing real stream/timer scheduling. Complete it to let the call
|
||||
/// proceed.
|
||||
Completer<void>? puertaConfirmarAudioFlutter;
|
||||
|
||||
/// Test-only failure switch (Slice 3 edge case): when true,
|
||||
/// [confirmarAudioFlutter] throws after the gate above (if any) resolves,
|
||||
/// simulating a dead/never-there native channel at handoff.
|
||||
bool fallaConfirmarAudioFlutter = false;
|
||||
|
||||
/// Simulates a native -> Flutter `alarmFired` MethodChannel event.
|
||||
void emitirEvento(EventoAlarmaAndroid evento) => _eventos.add(evento);
|
||||
|
||||
@@ -74,27 +54,6 @@ class FakePuertoAlarmasAndroid implements PuertoAlarmasAndroid {
|
||||
ocultadas.add(alarmaId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> confirmarAudioFlutter(String alarmaId) async {
|
||||
if (puertaConfirmarAudioFlutter != null) {
|
||||
await puertaConfirmarAudioFlutter!.future;
|
||||
}
|
||||
if (fallaConfirmarAudioFlutter) {
|
||||
throw StateError('fake confirmarAudioFlutter failure');
|
||||
}
|
||||
detenidas.add(alarmaId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> forzarVolumenMediaParaAlarma(double fraccion) async {
|
||||
volumenForzado.add(fraccion);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> restaurarVolumenMedia() async {
|
||||
volumenRestaurado++;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<DiagnosticoAlarmasAndroid> diagnostico() async =>
|
||||
DiagnosticoAlarmasAndroid(
|
||||
|
||||
Reference in New Issue
Block a user