This repository has been archived by the owner on Sep 4, 2020. It is now read-only.
Issue 2585 - Alllowing to clear notification when the app is not running #2619
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: iOS hasn't been tested yet because of #2617. I am delivering the PR nonetheless for discussions and possible changes if needed. When I am able to do the usecase described in #2617 I will be able to test iOS and fix any mistakes if needed.
Description
I added an extra optional key to the payload
clearNotification
, this key can be used to clear notificitations that have saidnotId
.For example:
The changes are quite simple, for Android I added an extra check if the
clearNotification
key is available, if so then we simple remove the notification with that ID. I did change theclearNotification()
method. I move the functionality to a static method. That way anyone that has acces can call the method while the cordova bridge is still intact.For iOS basically the same thing except that I moved the
clearNotification()
functionality toclearRealNotification()
so it can be used by anyone that has acccsm, and still keeping the cordova bridge intact.Related Issue
#2585
Motivation and Context
This allows developers to remove notification from the notification tray without their user having the app open/running.
And here are some use-cases for this functionality describe by an other user.
How Has This Been Tested?
I tested this by sending above payload through FCM towards my devices. Android functionality hasn't changed much, I tested the push and the cordova bridge and both are still working as expected.
iOS testing HAS NOT BEEN DONE YET because of #2617. Because the
clearNotification
is in the same method as thenotId
, I haven't been able to test it yet.Documentation is also not done because I wasn't sure where to put the new information, if anyone can point me in that direction, much appreciated.
Types of changes
Checklist: