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

Add repeat interval for monthly notifications? #91

Closed
SuitMonkeyB opened this issue Aug 22, 2018 · 10 comments
Closed

Add repeat interval for monthly notifications? #91

SuitMonkeyB opened this issue Aug 22, 2018 · 10 comments

Comments

@SuitMonkeyB
Copy link

Hi MaikuB,
would it be possible to add a repeatInterval for monthly alarms?

@MaikuB
Copy link
Owner

MaikuB commented Aug 22, 2018

Could you elaborate more with an example? I'm assuming you mean something have notification every x months? In any case, I'd be happy to look at a PR for this

@SuitMonkeyB
Copy link
Author

Oh, I mean specifically with the repeatInterval. Functions can be made to fire a notification once a minute, hour, day, week, but not monthly currently.

@MaikuB
Copy link
Owner

MaikuB commented Aug 22, 2018

Oh yep gotcha now. Can you explain the specific scenario you're trying to solve? I imagine it's to show a notification at a specific date and time every month.

@SuitMonkeyB
Copy link
Author

SuitMonkeyB commented Aug 22, 2018

Yea that's exactly it. Say for example the user sets a reminder within my app to be reminded once a month at a certain date to buy dog food.
My app then scuedules a reoccurring notification which fires at that date every month.

I noticed the infrastructure based on repeatInterval was missing the ability to repeat monthly.

@MaikuB
Copy link
Owner

MaikuB commented Aug 22, 2018

Note: sorry this will be long...main answer is in last paragraph

Sounds like you're looking at the periodicallyShow function, which wouldn't have been suitable to what you're doing as it's meant to more closely mirror this in iOS and that isn't tied to a specific date and depends on when you've called it. Furthermore, the interval is based on the number of seconds so that's why the month is not available in the enum.

My current thinking is it won't be added or at least I don't have a timeframe for putting it. One of the reasons why it hasn't been done as well is that the expected behaviour of a monthly notification could potentially vary depending on each app intends it to do. One might define this to be every 30 days, if it's once a month, (how many days/seconds does that mean) or day of the month etc. If I look at when I schedule a event using the Google calendar app, if I did the a monthly event that started on the 31st of August, then it falls into the "day of the month" scenario as it the event on appears on months with 31 days.

IMO, as opposed to having monthly notifications, I think if and when #21 is done, that would give devs more flexibility to do monthly notifications that would fit their needs as they could schedule one notification, be notified when it appears and attempt to schedule another one in the future. I believe the headless Dart work that the Flutter team has done should be on the dev channel (0.5.8) now to see how it works. However, even if #21 was done I don't think I'd release an update until the changes done by the Flutter team has rolled over into the beta channel since more devs are likely to be on that channel/branch.

@SuitMonkeyB
Copy link
Author

Yea the headless Dart work would be incredibly useful. I understand your reasoning; it's along the same lines I was thinking as well due to months having varying days, meaning estimating the seconds in between notifications will be inconsistient. Guess I'll wait for the changes to be rolled from the Flutter side.

@MaikuB
Copy link
Owner

MaikuB commented Aug 22, 2018

If you're working on something urgent, an interim solution you could look into is to fork the repo and modify so you can implement the scenario you're after. On Android you'd likely need to modify the receiver code to look at the intent to see if it's a monthly notification so it can schedule another one prior to actually showing the notification

@aalittle
Copy link

I agree that having a monthly reminder would be a very valuable feature and Id'd be willing to take a crack at a PR if there's interest. I was thinking that the monthly reminder could have a default behaviour of setting the UNCalendarNotificationTrigger to repeat Monthly with the 'day' set in the DateComponents to a value passed in by the caller to dictate the day of the month to fire. We could use the day property in NotificationDetails.h to take a 1-31 value. If the caller chooses 31, then the notification will only fire on months with 31 days, which I believe is the behavior found on iOS. That said, you could still set monthly reminders that fire reliably for the 1st day of the month (1-28 would fire for all months).

@mkuzmentsov
Copy link

+1

@MaikuB
Copy link
Owner

MaikuB commented Jan 18, 2020

Closing as implementing monthly notifications as per the original post will not be implemented (see reasons above). There's been no progress on headless execution on the Flutter side too

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

No branches or pull requests

4 participants