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

[Android] Add the ability to remove notifications based on the tag #1058

Merged
merged 3 commits into from
Jul 20, 2018

Conversation

dgruseck
Copy link
Contributor

@dgruseck dgruseck commented May 7, 2018

It would be awesome to be able to remove notification using the tag.

Copy link
Contributor

@chrisbianca chrisbianca left a comment

Choose a reason for hiding this comment

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

@dgruseck big thanks for this, sorry it's taken a little while to review properly. I've suggested a couple of minor changes - if you're able to make these I can get it merged in for the next release.

* Remove a delivered notifications by tag.
* @param tag
*/
removeDeliveredNotificationsByTag(tag: string): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you able to move this into AndroidNotifications.js as it's Android specific functionality?

You'll see it that file, that the JS does a platform check when a method is called and resolves an empty promise if it's not Android. If we follow that pattern then we don't need to worry about the iOS implementation that you've added.

@@ -284,6 +289,7 @@ private WritableMap parseRemoteMessage(RemoteMessage message) {
}
if (notification.getTag() != null) {
androidMap.putString("group", notification.getTag());
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we have the tag property, I don't think we should also set that as the group as they are two separate things. Are you able to remove the group?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing the group could be a breaking change for some people, because of that I'm not sure if we should do that.

@jamesisaac
Copy link

This would be great, or even just the part which adds the ability to call setTag when creating a local notification (seems like quite an inconsistency between local/remote notifications).

@Salakar Salakar added Workflow: Waiting for User Response Blocked waiting for user response. plugin: messaging FCM only - ( messaging() ) - do not use for Notifications notifications labels Jul 1, 2018
@Salakar
Copy link
Member

Salakar commented Jul 1, 2018

@dgruseck any updates on the requested changes?

@Salakar Salakar self-assigned this Jul 20, 2018
@Salakar Salakar removed the Workflow: Waiting for User Response Blocked waiting for user response. label Jul 20, 2018
@Salakar
Copy link
Member

Salakar commented Jul 20, 2018

@dgruseck thanks for updating this, looks fine to me now.

Will merge but could you update the docs to add these on please;

https://rnfirebase.io/docs/master/notifications/reference/AndroidNotification
/\----\/
https://github.com/invertase/react-native-firebase-docs/blob/master/docs/notifications/reference/AndroidNotification.md


Loving react-native-firebase and the support we provide? Please consider supporting us with any of the below:

@Salakar Salakar merged commit 321e4a2 into invertase:master Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: messaging FCM only - ( messaging() ) - do not use for Notifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants