Upgrades to this module to suit community platforms inc Rules and Flag support

Created on 30 June 2022, over 2 years ago
Updated 22 April 2024, 7 months ago

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

  1. Develop prompt permission. See this: https://www.drupal.org/project/advanced_pwa/issues/3287328 Prompt Permission, Rules and Flag integrations Closed: duplicate
  2. Save UID against devices.
  3. PWA Rules sub-module. Actions: Send push notification to all & Send push notifications to user.
  4. PWA Rules Flag sub-module. 2 actions: Send push notification to flagging users of content & Send push notification to flagging users of user.
  5. Add URL setting to form for broadcasting a push notification.
  6. Develop settings to specify the text used in the prompt.
  7. Develop Bootstrap Modal and repeat schedule.
  8. 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.

🌱 Plan
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom gMaximus

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024