Skip to content

Fix determination of push type for empty notifications with badge 0#109

Merged
Pr0Ger merged 1 commit intoPr0Ger:masterfrom
cassidylaidlaw:master
Jul 1, 2020
Merged

Fix determination of push type for empty notifications with badge 0#109
Pr0Ger merged 1 commit intoPr0Ger:masterfrom
cassidylaidlaw:master

Conversation

@cassidylaidlaw
Copy link
Copy Markdown
Contributor

Without this change, it is impossible to send an empty notification that just sets the app badge to 0 (removes the badge). If notification.badge is 0, then APNsClient.send_notification_async will calculate the push type as background, which will not update the badge number. The solution is to compare notification.badge explicitly to None.

@Pr0Ger Pr0Ger merged commit 8494361 into Pr0Ger:master Jul 1, 2020
@Pr0Ger
Copy link
Copy Markdown
Owner

Pr0Ger commented Jul 1, 2020

@cassidylaidlaw Thanks for contribution.

Btw, send_notification_async()/send_notification_batch() has param push_type to override this inferring. Dunno why it's not exposed in send_notification() method, I'll fix it in next release

@cassidylaidlaw
Copy link
Copy Markdown
Contributor Author

Thanks for merging!

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