Right now site plugins will only be able to create push click handlers by using plain JS. We could try to create a generic handler that tries to use the link handlers defined by the plugin, that way site plugins will be able to support push clicks just by creating the corresponding link handler for the contexturl.
Also, there are a couple of problems when handling push clicks for site plugins:
- We only load the site plugins of the current site, so if you receive a push for another site stored in the app, that push won't be handled by the site plugins because they aren't loaded. The only way I can think of to handle this is:
- If the click belongs to another site, logout the user and login in the other site.
- Once logged in, wait for site plugins to be loaded (it can take a while).
- Once loaded, check if there is any push click handler to treat the notification. If there is none, open the Notifications page.
- If the push is clicked while the app is dead, it can take a while for site plugins to be loaded. We could be blocking the user for several seconds for nothing because maybe there is no site plugin to handle that link. I can't think of any way to solve this.
I see two problems in the solution proposed for the point 1. The first one is that if there is a push click handler that doesn't display anything, it just does some action, we'll be redirecting the user to another site when there's no need to, but IMO it's a minor problem. The other problem is the same as point 2, we could be blocking the user for nothing but I can't think of any other way to do this.