Problem/Motivation
This module is great and got me out of the starting blocks. I could see how it would work well for some use cases as is. I also saw potential for my use case with the example given on the module page.
However I quickly realised that it wasn't possible to send a push notification to a single users devices. I'm building a community platform and wanted to be able to notify all devices of a specific user ie a message is received or activity on their content.
I use the flag module for things such as a subscribe to content or follow users. I wanted to be able to send all followers a notification when the followed person posted new content. Perhaps if a user subscribes to content and a new comment is posted, I'd want to be able to send a notification to the subscribers.
I don't like the idea of asking people for permission to send notifications before they are signed in. After dismissing the dialog, on loading another page, the prompt would show again. I also want to be able to specify how often the dialog would show after being declined.
I thought the prompt text should be configurable. Otherwise we would need to hack the file or accept it as is out of the box.
All my websites use Bootstrap in one way or another. Figure this is the same for many. So I wanted to have the option to use a Bootstrap Modal.
Lastly if I send a broadcast message, I want to be able to send the user to a specific page. The current form doesn't allow that.
Proposed resolution
- Develop prompt permission. See this:
https://www.drupal.org/project/advanced_pwa/issues/3287328
✨
Prompt Permission, Rules and Flag integrations
Closed: duplicate
- Save UID against devices.
- PWA Rules sub-module. Actions: Send push notification to all & Send push notifications to user.
- PWA Rules Flag sub-module. 2 actions: Send push notification to flagging users of content & Send push notification to flagging users of user.
- Add URL setting to form for broadcasting a push notification.
- Develop settings to specify the text used in the prompt.
- Develop Bootstrap Modal and repeat schedule.
- Create link to trigger push prompt. Use:
<span class="push-prompt-link">Some plain text <span class="trigger-push-prompt">The link text</span></span>
. The link will only display if the user has permission, hasn't already subscribed and hasn't clicked block in the browser.
Remaining tasks I need pointers/help with
- Update sent push notifications. ie "x received 9 likes" to "x received 10 likes".
- Cache settings. On and off setting. Or specify pages to cache on devices, like you would for displaying a block.