Skip to content

Is there any way to access the notification queue directly? #105

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

Open
joaqo opened this issue Feb 12, 2025 · 3 comments
Open

Is there any way to access the notification queue directly? #105

joaqo opened this issue Feb 12, 2025 · 3 comments

Comments

@joaqo
Copy link

joaqo commented Feb 12, 2025

Hi! Just wondering if is there any way to access the notification queue directly?

@seniv
Copy link
Owner

seniv commented Feb 17, 2025

Hi👋
Right now, there's no option to do that. What exactly do you want to do with the queue? Maybe it's already implemented in the v3.0.0 RC, or I can implement it later

@joaqo
Copy link
Author

joaqo commented Feb 17, 2025

I wanted to create custom rules to decide what to do with an oncoming notification depending on the current notification being shown to the user. More specifically, in my app restaurants receive delivery orders, and those notifications are persistent for obvious reason. If there is a low priority notification incoming for the restaurant, but there is also a new order notification being shown, I want to ignore the incoming one as I don't want to dismiss the more important new order one.

For the time being I implemented this by manually tracking the current notification being shown myself on my app's code. But just thought it would be cool if I could access this information from the library itself.

Anyways really cool library, thanks for all the work!

@seniv
Copy link
Owner

seniv commented Mar 2, 2025

Thank you for the detailed description of your case, and sorry for my late response

Unfortunately, in the upcoming v3 release, there is nothing that can help you, but it makes me think about implementing 2 new features:

  1. getCurrentNotification method which will return information about the currently visible notification (most likely it would be the parameters that were provided to the showNotification method), or null if there are no notifications currently visible.
  2. Priority mechanics, the most obvious behavior that came to my mind is to provide priority parameter with the number as a value, and it will automatically determine the right queueMode depending on the priority of the currently visible notification and the notification that is about to show. Higher priority will have immediate mode, and equal or lower priority will put new notification right after the last notification with the same priority in the queue and use standBy mode.
    For example, you want to show a notification with priority 3. Currently, you have a notification with priority 4 already visible, in this case your queue will look like this:
    3(priority level)
    3
    3 <-- new notification
    2
    1
    And notifications will be shown from top to bottom. Hope that I explained it well enough.

So in theory getCurrentNotification method should be enough to determine the right queueMode manually, while "Priority" mechanism should do everything for you, depending on the priority parameter.

I would be happy to hear your feedback on the features I proposed, will they solve your issue, or not.

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