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:
+1
-24
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user