Save delegate and proxy calls to previous delegate #1514
Merged
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.
This solution will solve two plugins from disabling the other as a notification delegate in iOS. The current delegate set on the notification center is saved in a property. When presenting or handing response the handler checks the notification type as already present in the current code. If the notification type is a remote notification it is proxied to the previously available delegate.
This solves a current problem with the cordova-plugin-firebase:
And adds:
4. Local notifications calls Firebase's delegate and Firebase handles the remote notification as if it was the current delegate set on the notification center.
In my opinion this is something all plugins working with the notification center should do as there can only be one delegate set on the notification center, receiving all notifications remote or local.