Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#61] iOS: Refactor date components used in repeat notification scheduling. #64

Merged
merged 2 commits into from
Jun 22, 2018

Conversation

jeffscaturro-aka
Copy link
Contributor

@jeffscaturro-aka jeffscaturro-aka commented Jun 21, 2018

Issue #61

Description

  • Notifications scheduled for a time earlier in the day than the time the code was called resulted in invalid triggers (never getting fired).
  • For instance, it's noon and you are scheduling a morning notification to be shown daily. These wouldn't fire because our trigger is initialized with today's date resulting in the impossibility to be executed.

What Was Changed

  • Drop NSCalendarUnitYear|NSCalendarUnitMonth|NSCalendarUnitDay from the NSDateComponents we use for our UNCalendarNotificationTrigger. The trigger should ignore the year, month, and day and instead only be fired when it's the appropriate time and/or weekday.
  • Specify the calendar on the NSDateComponents since we no longer init with components from a date and calendar.

Testing

  • Regression tested scheduling daily notifications.
  • Regression tested scheduling weekly at day and time notifications.
  • Schedule a daily notification to be shown for a time earlier in the day; that is, schedule a notification to be shown daily at 8:00am if it's later than that already in the day when you schedule it with the plugin.

Little trick to test:

  • Schedule a daily and weekly notification for an hour ago (and today's weekday).
  • Go into your iPhone's Settings -> General -> Date & Time.
  • Turn off Set Automatically.
  • Move the time before each notification. As you drag the minute past it (and release) you should get your notification!

@MaikuB MaikuB merged commit 97bfe89 into MaikuB:master Jun 22, 2018
@MaikuB
Copy link
Owner

MaikuB commented Jun 22, 2018

Awesome, thanks! I'll publish this tomorrow

@jeffscaturro-aka jeffscaturro-aka deleted the 61_fix branch January 30, 2019 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants