Skip to content

Conversation

@timacdonald
Copy link
Contributor

@timacdonald timacdonald commented Mar 13, 2018

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:

Badges - shows the number of notifications outstanding. Note: Android badges are automatically handled by OneSignal.

// source: https://documentation.onesignal.com/reference#section-appearance

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.

@LKaemmerling
Copy link
Collaborator

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?

@timacdonald
Copy link
Contributor Author

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.

@Lloople
Copy link
Collaborator

Lloople commented Mar 13, 2018

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.

@timacdonald
Copy link
Contributor Author

Hey @LKDevelopment and @Lloople I've renamed those methods. Let me know if you think that is more suiting or something else.

Copy link
Collaborator

@Lloople Lloople left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the naming is pretty good now, we have the change to add a generic method in the future for all badges if required.

@timacdonald
Copy link
Contributor Author

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 👍

@LKaemmerling LKaemmerling merged commit 0477a89 into laravel-notification-channels:master Mar 14, 2018
@LKaemmerling
Copy link
Collaborator

@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!

@timacdonald
Copy link
Contributor Author

sounds good - and thank you both

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants