NativeScript / NativeScript/plugins
[@nativescript/local-notifications] Schedule not work on iOS with Buddhist calendar
Personne n'a encore pris cette issue.
- Langage dominant
- TypeScript
- Étoiles
- 206
- Forks
- 123
- Merge moyen
- 2 j 1 h
- PR mergées (30 j)
- 1
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez dans index.ios.js, au niveau de LocalNotificationsImpl.schedulePendingNotificationsNew(), puis examinez calendarWithMondayAsFirstDay() et la construction du trigger présentée dans le rapport. Reproduisez le problème sur iOS 14.4 avec le calendrier bouddhiste activé et vérifiez que schedule() crée une notification fonctionnelle tout en conservant le comportement de répétition existant.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- ios, javascript, typescript
- Domaine
- mobile-dev
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- À l'abandon
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 52/100