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

[1.x] Add support for setting badge count on iOS #41

Closed
wants to merge 7 commits into from

Conversation

lagerroos
Copy link

This PR allows the user to attach a badge count, in other words, the number of unread notifications on an app icon. It also allows sending background updates through Firebase, e.g. to wake up the app from a sleeping state.

@gentritabazi gentritabazi changed the title Added support for setting badge count on iOS [1.x] Add support for setting badge count on iOS Jul 18, 2022
Comment on lines +143 to +148
if (isset($this->badgeCount)) {
$fields['notification']['badge'] = $this->badgeCount;
}
if (isset($this->contentAvailable)) {
$fields['notification']['content_available'] = $this->contentAvailable;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (isset($this->badgeCount)) {
$fields['notification']['badge'] = $this->badgeCount;
}
if (isset($this->contentAvailable)) {
$fields['notification']['content_available'] = $this->contentAvailable;
}
if (isset($this->badgeCount)) {
$fields['notification']['badge'] = $this->badgeCount;
}
if (isset($this->contentAvailable)) {
$fields['notification']['content_available'] = $this->contentAvailable;
}

@gentritabazi
Copy link
Collaborator

@lagerroos Thanks for your contribution. Can you also add documentation to the README file?

@gentritabazi
Copy link
Collaborator

I just saw that the 2 methods are only for IOS, so it makes sense to use withAdditionalData .

https://firebase.google.com/docs/cloud-messaging/http-server-ref

@Artyomushko
Copy link

@gentritabazi01 But unfortunately it does not work from data field it should be pushed to notification field. So that PR is actually needed

@Artyomushko Artyomushko mentioned this pull request Jul 28, 2022
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.

3 participants