refactor(alarm): make the ringing screen pure UI over a reduced native port
Build & Deploy PluriWave / Análisis de código (push) Successful in 36s
Build & Deploy PluriWave / Build APK + AAB release (push) Successful in 2m40s

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:
2026-07-12 11:36:31 +02:00
parent 836fb44adb
commit bd7f883118
8 changed files with 73 additions and 635 deletions
+1 -24
View File
@@ -89,7 +89,6 @@ class _PaginaPrincipal extends StatefulWidget {
}
class _PaginaPrincipalState extends State<_PaginaPrincipal> {
static const _volumenInicialFadeInAlarmas = 0.05;
int _indice = 0;
StreamSubscription<String>? _errorSubscription;
StreamSubscription<EventoAlarmaAndroid>? _alarmaSubscription;
@@ -353,15 +352,10 @@ class _PaginaPrincipalState extends State<_PaginaPrincipal> {
_alarmaSonandoId = alarma.id;
try {
await _prearrancarAudioAlarma(alarma);
if (!mounted) return;
await Navigator.of(context).push(
MaterialPageRoute<void>(
builder:
(_) => PantallaAlarmaSonando(
alarma: alarma,
audioPrearrancado: alarma.emisora != null,
),
builder: (_) => PantallaAlarmaSonando(alarma: alarma),
fullscreenDialog: true,
),
);
@@ -373,23 +367,6 @@ class _PaginaPrincipalState extends State<_PaginaPrincipal> {
}
}
Future<void> _prearrancarAudioAlarma(AlarmaMusical alarma) async {
// The ring-scoped stream override is NOT raised here anymore: the ringing
// screen owns it and raises it only when audio is actually about to be
// audible (first `reproduciendo`, or right before the fallback WAV
// plays). Raising it during pre-start let the ExoPlayer track spin-up —
// which briefly runs at gain 1.0 — blast at the ring level; under the
// user's original stream volume that spin-up is inaudible.
final emisora = alarma.emisora;
if (emisora == null) return;
final radio = context.read<EstadoRadio>();
debugPrint(
'[PluriWave][alarmas] prearrancar emisora alarma id=${alarma.id} emisora=${emisora.nombre}',
);
await radio.audio.setVolumen(_volumenInicialFadeInAlarmas);
unawaited(radio.reproducir(emisora));
}
void _mostrarTimerDialog(BuildContext context) {
showModalBottomSheet(
context: context,