Closed timacdonald closed 6 years ago
i'm not really sure if it is the best way to add helper methods for this.. Since the naming of the methods says "you can set the BadgeCount for every notification" but it should be " you can set the Badge Count for every notification on iOS"... @Lloople what do you think?
Yea, I considered doing incrementIosBadgeCount()
but then I thought if in the future you could increment Android badge counts you'd have to change your consuming code.
Where as if its just a generic incrementBadgeCount()
you could update the library to do both.
...but after thinking about it, if this is wanted you are probably right: something like incrementIosBadgeCount()
is probably the way to go.
I agree with both of you 😅 I mean, there's a chance OneSignal add this to another platforms like Android or whatever, and your methods contains the word ios
explicity on the parameter key. I think those methods should reference ios
as Lukas suggested, and in a future we can have a method over it if OneSignal add more platforms like incrementBadgesCount()
which will contain the logic for ios and other platforms.
Hey @LKDevelopment and @Lloople I've renamed those methods. Let me know if you think that is more suiting or something else.
Sweet. I'm already using this, but if you want to do a RC and ping me, I'm happy to pull it in to this app I'm working on and give it a test just to be uber sure everything is working as expected 👍
@timacdonald thank you. Over the night i've got a little idea how we could clean up the code a little bit. I will merge this and then will overhaul all :) Thank you!
sounds good - and thank you both
Added a few helper methods to help deal with badge counts on iOS. Note that these only apply to iOS - as OneSignal does not allow badge counts on Android.
From the docs:
I doubt you want to add methods for every parameter, but I thought this was a good candidate because it's not just key / value, but a couple of key / values to get it working. Tripped me up for a minute and thought it might help others in the future.