cordova-plugin-firebasex
cordova-plugin-firebasex copied to clipboard
[FEATURE] App controlled, foreground notifications
Feature request
Right now background notifications are posted to the drawer, and foreground notifications are handled by a callback, optionally pushes can contain "notification_foreground" to force foreground notifications, however this is strictly a server side option.
What isn't available is anyway for the app itself to decide if it should be displayed while it is in the foreground.
A simple case would be a instant messaging application, where you always want notification_foreground type of display, except in one case, when you have the chat with that single person already open, and displayed.
In that one case you would opt to ignore the notification display, and simply update the current screen to reflect the message received.
I suggest that a simple way of handling this would be a way to trigger a notification, as if notification_foreground had be included, after the callback has notified. Simply because that is what I think sounds simplest to implement.
Something vaguely resembling,
FirebasePlugin.onMessageReceived(function(message) {
if ( ! message.show_notification && app_specific_test(message) ) {
FirebasePlugin.postNotification(message);
}
});
or
FirebasePlugin.onMessageReceived(function(message) {
if ( ! message.show_notification && app_specific_test(message) ) {
message.displayNotification = true;
}
});
Thought I'm uncertain if this is truly the easiest way to handle this feature, another option might be available that I am unaware of, I'm not familiar with the development of cordova plugins.
Thank you for reading.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Reopening as stalebot incorrectly closed it