plugins
plugins copied to clipboard
[@nativescript/local-notifications] Custom interval not working on iOS - incomplete feature
Hi, after updating plugin to version 5.1.0, which introduce the capacity of set a custom number interval (in days) when notification is scheduled, I noticed that custom intervals not works on iOS. For example when I set a notification to schedule every X days (it works nice if scheduled daily).
In the iOS implementation of the plugin, call to method NSCalendar.componentsFromDate should be called with a CalendarUnit object and date object according to apple reference but CalendarUnit can only represent a specific range unit such minute, hour, day, month, etc. so currently is impossible to schedule a notification that triggers, for example, every 2 days and when this value is passed it introduces the insertion of a badly scheduled notification.
Example
LocalNotifications.schedule([
{
title: 'The title',
body: 'Recurs every minute until cancelled',
...
interval: 2,
at: new Date(new Date().getTime() + 10 * 1000), // 10 seconds from now
},
]).then(...)
Tested with @nativescript/ios: "7.0.0" @nativescript/core: "7.0.9" nativescript-cli version 7.1.2
I hope this may help anyone, any suggestions are appreciated. Thank you.