NativeScript / NativeScript/plugins
[@nativescript/local-notifications] Schedule not work on iOS with Buddhist calendar
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 206
- Forks
- 123
- Ø Merge
- 2 T. 1 Std.
- Gemergte PRs (30 T.)
- 1
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in index.ios.js bei LocalNotificationsImpl.schedulePendingNotificationsNew(), untersuche anschließend calendarWithMondayAsFirstDay() und die im Bericht gezeigte Trigger-Erstellung. Reproduziere das Problem unter iOS 14.4 mit aktiviertem buddhistischem Kalender und verifiziere, dass schedule() eine funktionierende Benachrichtigung erstellt und dabei das bestehende Wiederholungsverhalten beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- ios, javascript, typescript
- Bereich
- mobile-dev
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 52/100