NativeScript / NativeScript/plugins

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

Aberta
#87 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Linguagem predominante
TypeScript
Estrelas
206
Forks
123
Merge médio
2d 1h
PRs com merge (30d)
1

Descrição

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.

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece em index.ios.js, em LocalNotificationsImpl.schedulePendingNotificationsNew(), depois inspecione calendarWithMondayAsFirstDay() e a construção do trigger mostrada no relatório. Reproduza no iOS 14.4 com o calendário budista habilitado e verifique se schedule() cria uma notificação funcional, preservando o comportamento de repetição existente.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
ios, javascript, typescript
Domínio
mobile-dev
Tipo de issue
Bug
Dificuldade
2/5
Tempo estimado
1-3 horas
Status de atividade
Estagnada
Clareza
Claramente especificada
Facilidade para iniciantes
52/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.