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

cancelNotification on last grouped notification leaves empty group #162

Closed
yotam-nots opened this issue May 26, 2020 · 6 comments
Closed

Comments

@yotam-nots
Copy link

Hey,

On Android, I've noticed that calling cancelNotification on the last notification in a group leaves an empty group summary notification.
Clicking on the last notification does get clear the group summary as expected.

@yotam-nots
Copy link
Author

yotam-nots commented Jun 23, 2020

Code that reproduces the issue:

const androidChannelId = await notifee.createChannel({
  id: "default",
  name: "Default Channel",
  sound: "default",
  importance: Importance.HIGH,
});
await notifee.displayNotification({
  title: "group",
  id: "group-id",
  subtitle: "subtitle",
  android: {
    channelId: androidChannelId,
    groupSummary: true,
    groupId: "group-id",
    smallIcon: "notification_icon",
    color: "#ffcc11",
    groupAlertBehavior: AndroidGroupAlertBehavior.CHILDREN,
    pressAction: {
      launchActivity: "default",
      id: "default",
    },
  },
});
await notifee.displayNotification({
  id: "notification-id",
  title: "title",
  subtitle: "hello",
  body: "body",
  android: {
    importance: Importance.HIGH,
    channelId: androidChannelId,
    color: "#ffcc11",
    smallIcon: "notification_icon",
    groupId: "group-id",
  },
});
await notifee.cancelNotification("notification-id");

WhatsApp Image 2020-06-23 at 3

@helenaford
Copy link
Member

It should be possible to track how many notifications are displayed in a group using the DISMISSED events, and when the group gets to 1, delete the group via cancelNotification(groupId) and redisplay the last notification.

@yotam-nots
Copy link
Author

@helenaford that could work, but I feel like it could be nice if it was taken care of on the library level. Seems like a lot of logic, and that anyone who uses groups would need to reimplement

@helenaford
Copy link
Member

@yotam-nots It only occurs if you are using groups with cancelNotification. Not sure how much this happens, maybe it's common feature... something we can look into.

@yotam-nots
Copy link
Author

thanks!

possibly related: maybe the (missing?) tag functionality could help here?

@Salakar Salakar transferred this issue from invertase/react-native-notifee Sep 24, 2021
@helenaford
Copy link
Member

Please reopen if this is still an issue.

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

No branches or pull requests

2 participants