I am scheduling repeating(day) local notification on time set by user. I want to provide the user with a option such that he/she can disable these notification for weekends(Saturday,Sunday). Is it possible ? If yes, then please guide me in the right direction.
I am using this library and this is the code i am using to schedule the local notification.
PushNotification.localNotificationSchedule({
message: 'good morning',
date: date,
smallIcon: "ic_notification",
color: "#3591EC",
repeatType:'day',
});
as suggested by Chris Allwein instead of canceling the recurring daily notification, i scheduled recurring weekly notifications as chosen by the user. This is how i did it. Hope it helps someone.
let days=['Monday','Tuesday','Wednesday','Thursday','Friday'];
for(let i=0; i<days.length; i++){
let date = moment(days[i],"dddd");
Notification.schedule(message,date);
}
and in Notification.schedule()
i did the following
schedule(message, date){
let date = new Date(date);
PushNotificationIOS.scheduleLocalNotification({
fireDate: date.getTime(),
alertBody: message,
repeatInterval:'week'
});
}