[Solved] What would be a good way to handle “snoozed” functions?


In general the question seems to be how to ensure that something happens at a certain date-time.

  1. Work out what the target date-time is and write it down somewhere stable (a file, user defaults, whatever) along with what has to happen then.

  2. Watch the clock. A timer that fires every minute will probably be good enough; just look at the clock and see if that time has passed. If it has, do the thing and erase the info saying that this thing needs to happen at this date-time.

  3. If the app goes into the background, stop the timer.

  4. When the app comes to the foreground again, check your date-time.

    • If the time has passed, do the thing and erase the info saying that this thing needs to happen at this date-time.

    • If not, start the timer again and keep watching the clock.

solved What would be a good way to handle “snoozed” functions?