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
  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.

CommentFileSizeAuthor
#2 advanced_pwa_community_upgrade.patch39.34 KBgmaximus
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gMaximus created an issue. See original summary.

gmaximus’s picture

StatusFileSize
new39.34 KB

Here's my complete patch that includes all features developed so far (1-7). I hope others find it useful.

gmaximus’s picture

I also use this to disable device caching. Not a real fix though: https://www.drupal.org/project/advanced_pwa/issues/3070894#comment-14589266

gmaximus’s picture

Issue summary: View changes
gmaximus’s picture

If you run this patch on an existing install, you'll need to run database updates. This is to add the UID column to the table.

gmaximus’s picture

Status: Active » Needs review
anybody’s picture

The patch seems quite large, perhaps it would make sense to turn it into a MR for easier review? And perhaps you may want to request co-maintainership?

gmaximus’s picture

@Anybody The fork now has all my work. Merge request submitted. :)

gmaximus’s picture

gmaximus’s picture

Title: Summary of upgrades to this module to suit community platforms » Upgrades to this module to suit community platforms inc Rules and Flag support
Issue summary: View changes
gmaximus’s picture

gmaximus’s picture

Issue summary: View changes

  • gMaximus committed e20efc88 on 8.x-1.x
    Issue #3293486: Upgrades to this module to suit community platforms
    
gmaximus’s picture

Status: Needs review » Fixed
gmaximus’s picture

Status: Fixed » Closed (fixed)