flutter_local_notifications icon indicating copy to clipboard operation
flutter_local_notifications copied to clipboard

[flutter_local_notifications] WIP Custom intervals for periodicallyShow

Open micimize opened this issue 3 years ago • 2 comments

Changes repeatInterval in periodicallyShow to a Duration and treats older apple platforms without custom duration support as a special case. Also turned RepeatInterval into a class extension with static methods for backwards compatibility.

I haven't added assertions to enforce older platforms are using the right intervals or changed the docs yet, or tested much beyond iOS simulator – wanted to get feedback on the overall approach first.

micimize avatar Jul 17 '22 20:07 micimize

Thanks for the PR. It's a clever way of handling it so props for that :)

It looks like would cause an issue on Android with old scheduled notifications saved to shared preferences where the value for the repeat interval represents the index associated with the enum value. With the code changes done in the PR, those old notifications would have its repeat interval be interpreted as a value in milliseconds

MaikuB avatar Jul 26 '22 09:07 MaikuB

Ah I see – yes that could be a problem. I could also see there being a similar issue on iOS with old enum values cached.

Not sure what the best way of dealing with this is – adding legacy handling feels awkward, but I can't find any docs/utilities for doing at-update-time migrations/scripts for flutter.

micimize avatar Aug 05 '22 16:08 micimize

I'd suggest a new method to deal with this. It would also be cleaner in the sense in that there's a separate method that only works from certain versions of iOS/macOS. Coming up with a name for the new method could be difficult though given Dart doesn't support method/function overloading to make use of the existing name

MaikuB avatar Aug 08 '22 09:08 MaikuB

Hey @MaikuB when can we expect this update as this will be a game changer for certain use cases?

neelayak avatar Aug 08 '22 19:08 neelayak