diff --git a/lib/app.dart b/lib/app.dart index ca77a3d..befc569 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -334,7 +334,18 @@ class _PaginaPrincipalState extends State<_PaginaPrincipal> { debugPrint( '[PluriWave][alarmas] alarma ignorada porque ya hay una activa id=${alarma.id} activa=$_alarmaSonandoId', ); - await alarmas.android.ocultarNotificacionAlarma(alarma.id); + // A duplicate delivery of the SAME ring's own fire event (the live + // eventosAlarma stream and the one-shot obtenerEventoInicial() read + // the same native event and can both reach here) must be a no-op: + // ocultarNotificacionAlarma -> dismissAlarmNotification unconditionally + // stops PluriWaveAlarmService for that id on the native side, which + // would tear down the currently-ringing service and undo the + // ring-scoped media-volume override long before the real handoff. + // Only hide the notification when a genuinely DIFFERENT alarm fired + // while this one is active (single-ring-at-a-time by design). + if (alarma.id != _alarmaSonandoId) { + await alarmas.android.ocultarNotificacionAlarma(alarma.id); + } return; }