feat(alarms): native reliability fixes and end-to-end snooze
- Use mediaPlayback|systemExempted FGS type with FOREGROUND_SERVICE_SYSTEM_EXEMPTED so alarms fire on Android 14+ (FOREGROUND_SERVICE_ALARM does not exist in the SDK) - Deduplicate fire notifications: the foreground service FSI notification is the single owner; receiver path removed - Notification channel v2 with alarm sound URI and USAGE_ALARM attributes, one-time guarded migration from legacy channels - Pass fallback station through the MethodChannel (NativeAlarmSpec schemaVersion 3) with a three-stage audio chain: primary -> fallback station -> bundled WAV - Native fade-in volume ramp honoring fadeInSegundos when the app is killed - Request battery-optimization exemption once, tracked with a persisted asked-once flag - Fix snooze end-to-end: native ACTION_SNOOZE now reports back to Flutter (snoozed event + cold-start sync), snooze anchor unified to occurrence+minutes on both sides, periodic recalc no longer erases an active snooze - Add snooze buttons (3/5/10/custom) to the ringing screen with shared audio teardown - Redesign ringing screen on PluriWaveScaffold with reduced-motion-aware entry animation (new PluriAnimate helper) - Alarm editor: live next-trigger preview, searchable station pickers (primary and fallback), configurable snooze duration, volume floor down to 0 - New alarm strings localized across all 13 locales - New unit/widget tests for the snooze flow, alarm bridge payloads, ringing screen and editor (77 tests green) - SDD artifacts for the app-quality-and-native-alarms change (explore, proposal, spec, design, tasks, apply progress)
This commit is contained in:
@@ -0,0 +1,251 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pluriwave/estado/estado_alarmas.dart';
|
||||
import 'package:pluriwave/modelos/alarma_musical.dart';
|
||||
import 'package:pluriwave/servicios/servicio_alarmas.dart';
|
||||
import 'package:pluriwave/servicios/servicio_alarmas_android.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../helpers/fakes_alarmas.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
setUp(() {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
});
|
||||
|
||||
AlarmaMusical alarmaDiaria(String id, {int snoozeMinutos = 5}) =>
|
||||
AlarmaMusical(
|
||||
id: id,
|
||||
nombre: 'Diaria',
|
||||
hora: 7,
|
||||
minuto: 30,
|
||||
tipoProgramacion: TipoProgramacionAlarma.diaria,
|
||||
diasSemana: const [],
|
||||
snoozeMinutos: snoozeMinutos,
|
||||
);
|
||||
|
||||
test('posponerAlarma ancla snoozeHasta en proximaEjecucion + minutos, '
|
||||
'programa una sola vez y notifica', () async {
|
||||
final ahora = DateTime(2026, 6, 11, 7, 0);
|
||||
final android = FakePuertoAlarmasAndroid();
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(reloj: () => ahora),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
addTearDown(android.dispose);
|
||||
await estado.guardarAlarma(alarmaDiaria('s1'));
|
||||
|
||||
final alarma = estado.alarmas.single;
|
||||
expect(alarma.proximaEjecucion, DateTime(2026, 6, 11, 7, 30));
|
||||
final programadasAntes = android.programadas.length;
|
||||
var notificaciones = 0;
|
||||
estado.addListener(() => notificaciones++);
|
||||
|
||||
await estado.posponerAlarma(alarma, 5);
|
||||
|
||||
expect(estado.alarmas.single.snoozeHasta, DateTime(2026, 6, 11, 7, 35));
|
||||
expect(estado.alarmas.single.snoozeOrigen, DateTime(2026, 6, 11, 7, 30));
|
||||
expect(android.programadas.length, programadasAntes + 1);
|
||||
expect(android.programadas.last.snoozeHasta, DateTime(2026, 6, 11, 7, 35));
|
||||
expect(notificaciones, greaterThanOrEqualTo(1));
|
||||
});
|
||||
|
||||
test(
|
||||
'la lista de alarmas refleja el snooze de forma sincrona tras posponer',
|
||||
() async {
|
||||
final ahora = DateTime(2026, 6, 11, 7, 0);
|
||||
final android = FakePuertoAlarmasAndroid();
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(reloj: () => ahora),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
addTearDown(android.dispose);
|
||||
await estado.guardarAlarma(alarmaDiaria('sync1'));
|
||||
|
||||
final futuro = estado.posponerAlarma(estado.alarmas.single, 10);
|
||||
await futuro;
|
||||
|
||||
// Sin polls ni esperas adicionales: el estado ya refleja el snooze.
|
||||
expect(
|
||||
estado.alarmas.single.proximaProgramable,
|
||||
DateTime(2026, 6, 11, 7, 40),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
'evento nativo snoozed registra el snooze sin reprogramar en Android',
|
||||
() async {
|
||||
final ahora = DateTime(2026, 6, 11, 7, 0);
|
||||
final android = FakePuertoAlarmasAndroid();
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(reloj: () => ahora),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
addTearDown(android.dispose);
|
||||
await estado.guardarAlarma(alarmaDiaria('n1'));
|
||||
final programadasAntes = android.programadas.length;
|
||||
|
||||
final origen = DateTime(2026, 6, 11, 7, 30);
|
||||
final hasta = DateTime(2026, 6, 11, 7, 40);
|
||||
final notificado = Completer<void>();
|
||||
estado.addListener(() {
|
||||
if (!notificado.isCompleted) notificado.complete();
|
||||
});
|
||||
|
||||
android.emitirEvento(
|
||||
EventoAlarmaAndroid(
|
||||
alarmaId: 'n1',
|
||||
titulo: 'Diaria',
|
||||
accion: EventoAlarmaAndroid.accionSnoozed,
|
||||
occurrenceAtMillis: origen.millisecondsSinceEpoch,
|
||||
snoozeUntilMillis: hasta.millisecondsSinceEpoch,
|
||||
),
|
||||
);
|
||||
await notificado.future;
|
||||
|
||||
expect(estado.alarmas.single.snoozeHasta, hasta);
|
||||
expect(estado.alarmas.single.snoozeOrigen, origen);
|
||||
expect(
|
||||
android.programadas.length,
|
||||
programadasAntes,
|
||||
reason: 'el nativo ya reprogramo; no debe haber un segundo programar',
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
'recalcularTodas tras posponer preserva snoozeHasta (guard regresion S4)',
|
||||
() async {
|
||||
var ahora = DateTime(2026, 6, 11, 7, 0);
|
||||
final android = FakePuertoAlarmasAndroid();
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(reloj: () => ahora),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
addTearDown(android.dispose);
|
||||
await estado.guardarAlarma(alarmaDiaria('r1'));
|
||||
await estado.posponerAlarma(estado.alarmas.single, 5);
|
||||
|
||||
final snooze = estado.alarmas.single.snoozeHasta;
|
||||
expect(snooze, isNotNull);
|
||||
|
||||
ahora = DateTime(2026, 6, 11, 7, 2);
|
||||
await estado.refrescarProgramacion();
|
||||
|
||||
expect(estado.alarmas.single.snoozeHasta, snooze);
|
||||
expect(android.programadas.last.snoozeHasta, snooze);
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
'inicializar importa snoozes nativos activos sin esperar el poll',
|
||||
() async {
|
||||
final ahora = DateTime.now();
|
||||
final origen = ahora.subtract(const Duration(minutes: 2));
|
||||
final hasta = ahora.add(const Duration(minutes: 8));
|
||||
final servicio = ServicioAlarmas(reloj: () => ahora);
|
||||
final objetivo = ahora.add(const Duration(hours: 1));
|
||||
await servicio.guardarAlarma(
|
||||
AlarmaMusical(
|
||||
id: 'cold1',
|
||||
nombre: 'Cold start',
|
||||
hora: objetivo.hour,
|
||||
minuto: objetivo.minute,
|
||||
tipoProgramacion: TipoProgramacionAlarma.diaria,
|
||||
diasSemana: const [],
|
||||
),
|
||||
);
|
||||
|
||||
final android =
|
||||
FakePuertoAlarmasAndroid()
|
||||
..snoozesNativos.add(
|
||||
EstadoSnoozeNativo(
|
||||
alarmaId: 'cold1',
|
||||
snoozeHasta: hasta,
|
||||
snoozeOrigen: origen,
|
||||
),
|
||||
);
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: servicio,
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
addTearDown(android.dispose);
|
||||
|
||||
await estado.inicializar();
|
||||
|
||||
expect(estado.alarmas.single.snoozeHasta, hasta);
|
||||
expect(estado.alarmas.single.snoozeOrigen, origen);
|
||||
expect(android.programadas.last.snoozeHasta, hasta);
|
||||
},
|
||||
);
|
||||
|
||||
test('desactivar una alarma pospuesta limpia el snooze (S2-R5)', () async {
|
||||
final ahora = DateTime(2026, 6, 11, 7, 0);
|
||||
final android = FakePuertoAlarmasAndroid();
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(reloj: () => ahora),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
addTearDown(android.dispose);
|
||||
await estado.guardarAlarma(alarmaDiaria('stop1'));
|
||||
await estado.posponerAlarma(estado.alarmas.single, 5);
|
||||
expect(estado.alarmas.single.snoozeHasta, isNotNull);
|
||||
|
||||
await estado.cambiarActiva(estado.alarmas.single, false);
|
||||
|
||||
expect(estado.alarmas.single.snoozeHasta, isNull);
|
||||
expect(estado.alarmas.single.activa, isFalse);
|
||||
// El puente real cancela el setAlarmClock para alarmas inactivas.
|
||||
expect(android.programadas.last.activa, isFalse);
|
||||
});
|
||||
|
||||
test(
|
||||
'finalizarEjecucion limpia snooze y reprograma Android sin snooze',
|
||||
() async {
|
||||
final ahora = DateTime(2026, 6, 11, 7, 36);
|
||||
final android = FakePuertoAlarmasAndroid();
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(reloj: () => ahora),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
addTearDown(android.dispose);
|
||||
await estado.guardarAlarma(
|
||||
AlarmaMusical(
|
||||
id: 'fin1',
|
||||
nombre: 'Diaria',
|
||||
hora: 7,
|
||||
minuto: 30,
|
||||
tipoProgramacion: TipoProgramacionAlarma.diaria,
|
||||
diasSemana: const [],
|
||||
proximaEjecucion: DateTime(2026, 6, 11, 7, 30),
|
||||
snoozeHasta: DateTime(2026, 6, 11, 7, 40),
|
||||
snoozeOrigen: DateTime(2026, 6, 11, 7, 30),
|
||||
),
|
||||
);
|
||||
|
||||
await estado.finalizarEjecucion('fin1');
|
||||
|
||||
expect(estado.alarmas.single.snoozeHasta, isNull);
|
||||
expect(android.ocultadas, contains('fin1'));
|
||||
expect(android.programadas.last.snoozeHasta, isNull);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pluriwave/estado/estado_alarmas.dart';
|
||||
import 'package:pluriwave/modelos/alarma_musical.dart';
|
||||
@@ -7,6 +5,8 @@ import 'package:pluriwave/servicios/servicio_alarmas.dart';
|
||||
import 'package:pluriwave/servicios/servicio_alarmas_android.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../helpers/fakes_alarmas.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
@@ -38,57 +38,67 @@ void main() {
|
||||
final alarma = estado.alarmas.single;
|
||||
await estado.posponerAlarma(alarma, 5);
|
||||
|
||||
expect(estado.alarmas.single.snoozeHasta, DateTime(2026, 5, 25, 7, 36));
|
||||
expect(android.programadas.last.proximaProgramable, DateTime(2026, 5, 25, 7, 36));
|
||||
// Ancla unificada (S2-R6): proximaEjecucion (7:31:02, normalizada por
|
||||
// inminencia) + 5 minutos — ya no "ahora + 5".
|
||||
expect(estado.alarmas.single.snoozeHasta, DateTime(2026, 5, 25, 7, 36, 2));
|
||||
expect(
|
||||
android.programadas.last.proximaProgramable,
|
||||
DateTime(2026, 5, 25, 7, 36, 2),
|
||||
);
|
||||
|
||||
ahora = DateTime(2026, 5, 25, 7, 32);
|
||||
await estado.refrescarProgramacion();
|
||||
|
||||
expect(estado.alarmas.single.snoozeHasta, DateTime(2026, 5, 25, 7, 36));
|
||||
expect(android.programadas.last.proximaProgramable, DateTime(2026, 5, 25, 7, 36));
|
||||
expect(estado.alarmas.single.snoozeHasta, DateTime(2026, 5, 25, 7, 36, 2));
|
||||
expect(
|
||||
android.programadas.last.proximaProgramable,
|
||||
DateTime(2026, 5, 25, 7, 36, 2),
|
||||
);
|
||||
});
|
||||
|
||||
test('posponer desde preaviso mueve esta ejecucion desde la hora original', () async {
|
||||
final android = FakePuertoAlarmasAndroid();
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(
|
||||
reloj: () => DateTime(2026, 5, 25, 7),
|
||||
),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
addTearDown(android.dispose);
|
||||
await estado.guardarAlarma(
|
||||
AlarmaMusical(
|
||||
id: 'pre1',
|
||||
nombre: 'Preaviso',
|
||||
hora: 7,
|
||||
minuto: 30,
|
||||
tipoProgramacion: TipoProgramacionAlarma.diaria,
|
||||
diasSemana: const [],
|
||||
proximaEjecucion: DateTime(2026, 5, 25, 7, 30),
|
||||
),
|
||||
);
|
||||
test(
|
||||
'posponer desde preaviso mueve esta ejecucion desde la hora original',
|
||||
() async {
|
||||
final android = FakePuertoAlarmasAndroid();
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(reloj: () => DateTime(2026, 5, 25, 7)),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
addTearDown(android.dispose);
|
||||
await estado.guardarAlarma(
|
||||
AlarmaMusical(
|
||||
id: 'pre1',
|
||||
nombre: 'Preaviso',
|
||||
hora: 7,
|
||||
minuto: 30,
|
||||
tipoProgramacion: TipoProgramacionAlarma.diaria,
|
||||
diasSemana: const [],
|
||||
proximaEjecucion: DateTime(2026, 5, 25, 7, 30),
|
||||
),
|
||||
);
|
||||
|
||||
final alarma = estado.alarmas.single;
|
||||
await estado.posponerProximaDesdePreaviso(
|
||||
alarma,
|
||||
10,
|
||||
DateTime(2026, 5, 25, 7, 30),
|
||||
);
|
||||
final alarma = estado.alarmas.single;
|
||||
await estado.posponerProximaDesdePreaviso(
|
||||
alarma,
|
||||
10,
|
||||
DateTime(2026, 5, 25, 7, 30),
|
||||
);
|
||||
|
||||
expect(estado.alarmas.single.snoozeHasta, DateTime(2026, 5, 25, 7, 40));
|
||||
expect(estado.alarmas.single.snoozeOrigen, DateTime(2026, 5, 25, 7, 30));
|
||||
expect(android.programadas.last.proximaProgramable, DateTime(2026, 5, 25, 7, 40));
|
||||
});
|
||||
expect(estado.alarmas.single.snoozeHasta, DateTime(2026, 5, 25, 7, 40));
|
||||
expect(estado.alarmas.single.snoozeOrigen, DateTime(2026, 5, 25, 7, 30));
|
||||
expect(
|
||||
android.programadas.last.proximaProgramable,
|
||||
DateTime(2026, 5, 25, 7, 40),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
test('finalizar diaria calcula siguiente dia y limpia snooze', () async {
|
||||
final android = FakePuertoAlarmasAndroid();
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(
|
||||
reloj: () => DateTime(2026, 5, 25, 7, 31),
|
||||
),
|
||||
servicio: ServicioAlarmas(reloj: () => DateTime(2026, 5, 25, 7, 31)),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
@@ -111,15 +121,16 @@ void main() {
|
||||
await estado.finalizarEjecucion('a2');
|
||||
|
||||
expect(estado.alarmas.single.snoozeHasta, isNull);
|
||||
expect(estado.alarmas.single.proximaEjecucion, DateTime(2026, 5, 26, 7, 30));
|
||||
expect(
|
||||
estado.alarmas.single.proximaEjecucion,
|
||||
DateTime(2026, 5, 26, 7, 30),
|
||||
);
|
||||
});
|
||||
|
||||
test('finalizar unica la desactiva y queda sin proxima ejecucion', () async {
|
||||
final android = FakePuertoAlarmasAndroid();
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(
|
||||
reloj: () => DateTime(2026, 5, 25, 7, 31),
|
||||
),
|
||||
servicio: ServicioAlarmas(reloj: () => DateTime(2026, 5, 25, 7, 31)),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
@@ -144,16 +155,82 @@ void main() {
|
||||
expect(estado.alarmas.single.proximaEjecucion, isNull);
|
||||
});
|
||||
|
||||
test(
|
||||
'solicita exencion de bateria una sola vez cuando no esta exenta',
|
||||
() async {
|
||||
final android =
|
||||
FakePuertoAlarmasAndroid()..ignoraOptimizacionBateria = false;
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(reloj: () => DateTime(2026, 5, 25, 7)),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
addTearDown(android.dispose);
|
||||
|
||||
await estado.guardarAlarma(
|
||||
const AlarmaMusical(
|
||||
id: 'bat1',
|
||||
nombre: 'Bateria',
|
||||
hora: 7,
|
||||
minuto: 30,
|
||||
tipoProgramacion: TipoProgramacionAlarma.diaria,
|
||||
diasSemana: [],
|
||||
),
|
||||
);
|
||||
|
||||
expect(android.solicitudesExencionBateria, 1);
|
||||
|
||||
await estado.guardarAlarma(
|
||||
const AlarmaMusical(
|
||||
id: 'bat2',
|
||||
nombre: 'Bateria 2',
|
||||
hora: 8,
|
||||
minuto: 0,
|
||||
tipoProgramacion: TipoProgramacionAlarma.diaria,
|
||||
diasSemana: [],
|
||||
),
|
||||
);
|
||||
|
||||
expect(android.solicitudesExencionBateria, 1);
|
||||
},
|
||||
);
|
||||
|
||||
test('no solicita exencion de bateria cuando ya esta exenta', () async {
|
||||
final android = FakePuertoAlarmasAndroid();
|
||||
final estado = EstadoAlarmas(
|
||||
servicio: ServicioAlarmas(reloj: () => DateTime(2026, 5, 25, 7)),
|
||||
android: android,
|
||||
iniciarAutomaticamente: false,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
addTearDown(android.dispose);
|
||||
|
||||
await estado.guardarAlarma(
|
||||
const AlarmaMusical(
|
||||
id: 'bat3',
|
||||
nombre: 'Exenta',
|
||||
hora: 7,
|
||||
minuto: 30,
|
||||
tipoProgramacion: TipoProgramacionAlarma.diaria,
|
||||
diasSemana: [],
|
||||
),
|
||||
);
|
||||
|
||||
expect(android.solicitudesExencionBateria, 0);
|
||||
});
|
||||
|
||||
test(
|
||||
'inicializar sincroniza ejecucion nativa y evita reprogramar al instante',
|
||||
() async {
|
||||
final android = FakePuertoAlarmasAndroid()
|
||||
..ejecucionesNativas.add(
|
||||
EjecucionAlarmaNativa(
|
||||
alarmaId: 'native1',
|
||||
gestionadaEn: DateTime(2026, 5, 25, 7, 30),
|
||||
),
|
||||
);
|
||||
final android =
|
||||
FakePuertoAlarmasAndroid()
|
||||
..ejecucionesNativas.add(
|
||||
EjecucionAlarmaNativa(
|
||||
alarmaId: 'native1',
|
||||
gestionadaEn: DateTime(2026, 5, 25, 7, 30),
|
||||
),
|
||||
);
|
||||
final servicio = ServicioAlarmas(
|
||||
reloj: () => DateTime(2026, 5, 25, 7, 30, 20),
|
||||
);
|
||||
@@ -194,70 +271,3 @@ void main() {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
class FakePuertoAlarmasAndroid implements PuertoAlarmasAndroid {
|
||||
final programadas = <AlarmaMusical>[];
|
||||
final canceladas = <String>[];
|
||||
final detenidas = <String>[];
|
||||
final ocultadas = <String>[];
|
||||
final ejecucionesNativas = <EjecucionAlarmaNativa>[];
|
||||
final _eventos = StreamController<EventoAlarmaAndroid>.broadcast();
|
||||
|
||||
@override
|
||||
Stream<EventoAlarmaAndroid> get eventosAlarma => _eventos.stream;
|
||||
|
||||
@override
|
||||
Future<void> programar(AlarmaMusical alarma) async {
|
||||
programadas.add(alarma);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> cancelar(String alarmaId) async {
|
||||
canceladas.add(alarmaId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> detenerSonidoNativo(String alarmaId) async {
|
||||
detenidas.add(alarmaId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> ocultarNotificacionAlarma(String alarmaId) async {
|
||||
ocultadas.add(alarmaId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> confirmarAudioFlutter(String alarmaId) async {
|
||||
detenidas.add(alarmaId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<DiagnosticoAlarmasAndroid> diagnostico() async =>
|
||||
const DiagnosticoAlarmasAndroid(
|
||||
puedeProgramarExactas: true,
|
||||
notificacionesPermitidas: true,
|
||||
puedeUsarPantallaCompleta: true,
|
||||
ignoraOptimizacionBateria: true,
|
||||
alarmasNativasPendientes: 0,
|
||||
fabricante: 'test',
|
||||
versionSdk: 35,
|
||||
);
|
||||
|
||||
@override
|
||||
Future<EventoAlarmaAndroid?> obtenerEventoInicial() async => null;
|
||||
|
||||
@override
|
||||
Future<List<EjecucionAlarmaNativa>>
|
||||
obtenerEjecucionesNativasGestionadas() async => ejecucionesNativas;
|
||||
|
||||
@override
|
||||
Future<bool> solicitarPermisoAlarmasExactas() async => true;
|
||||
|
||||
@override
|
||||
Future<bool> solicitarPermisoNotificaciones() async => true;
|
||||
|
||||
@override
|
||||
Future<bool> solicitarPermisoPantallaCompleta() async => true;
|
||||
|
||||
Future<void> dispose() => _eventos.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user