What’s the best approach to implement “Do not disturb mode” into our apps? like letting the user choose to disable the notification between two periods.
Should I use the cancel method?
[[UIApplication sharedApplication] cancelAllLocalNotifications];
any thoughts on specific component to be used are appreciated.
Thank you
You can always use a bool instance that will turn YES when the user sets to “do not disturb” and NO when it disable setting. Therefore, before posting notifications, you can control if “do not disturb” is on or off using the bool instance. You will be therefore able change the behaviour of your whole app. If you want to specify a period, use a timer that will trigger a method in which you can set the bool to NO and post the notification that should be posted while “do not disturb” was on.