NativeScript / NativeScript/plugins

[@nativescript/local-notifications] Schedule not work on iOS with Buddhist calendar

Abierto
#87 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
TypeScript
Estrellas
206
Forks
123
Merge medio
2 d 1 h
PR fusionados (30 d)
1

Descripción

Dear sir,
I had upgraded my app to NativeScript 7 and the notification (@nativescript/local-notifications, version 5.1.0) does not work on iOS (14.4). After debugging all day, I found that LocalNotifications.schedule() not work because my iPhone is set the calendar to Buddhist.

The bug is in the index.ios.js file, in the method schedulePendingNotificationsNew() of class LocalNotificationsImpl as part of code below:

 // Notification trigger and repeat
 let trigger;
 if (options.at) {
   const cal = NSCalendar.currentCalendar;  //LocalNotificationsImpl.calendarWithMondayAsFirstDay();
   const date = cal.componentsFromDate(LocalNotificationsImpl.getInterval(options.interval), options.at);
   date.timeZone = NSTimeZone.defaultTimeZone;
   trigger = UNCalendarNotificationTrigger.triggerWithDateMatchingComponentsRepeats(date, options.interval !== undefined);
 }
 else {
   trigger = UNTimeIntervalNotificationTrigger.triggerWithTimeIntervalRepeats(2, false);
 }

At the line 137, the LocalNotificationsImpl.calendarWithMondayAsFirstDay() which return ISO8601 (Gregorian) calendar make a wrong matching trigger. So, I change the code to use the NSCalendar.currentCalendar and It work well.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza en index.ios.js, en LocalNotificationsImpl.schedulePendingNotificationsNew(); después, inspecciona calendarWithMondayAsFirstDay() y la construcción del trigger mostrada en el informe. Reproduce el problema en iOS 14.4 con el calendario budista habilitado y verifica que schedule() cree una notificación que funcione sin alterar el comportamiento de repetición existente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
ios, javascript, typescript
Área
mobile-dev
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
52/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.