rotimi-best / prayerkeep

A PWA that allows users share prayer requests. The goal of the project is described https://coda.io/@rotimi-best/prayerkeep-better-way-of-sharing-prayer-requests
https://prayerkeep.com
1 stars 1 forks source link

Setup push notification in the app. #44

Closed rotimi-best closed 4 years ago

rotimi-best commented 4 years ago

This commit 56c9acd was what allowed me get a push notification both on mobile and desktop.

Findings

  1. A user might not get the push notification prompt because their setting refuses push notification.
  2. Writing a custom service worker was enough to allow the push notification. (might need future work on this)

Push flow

  1. User sign's up
  2. We show message asking for push.
  3. We trigger prompt message if user agrees and cancel if user clicks cancel (should be recorded in google analytics)
  4. We send the subscription data with the userId to the server.
  5. On the server side we push into the subscriptions array of the user.

TODO

  1. Implement above flow and save the subscription in the db
  2. Save the user's email and other information on the server.
  3. Listen for unsubscription in serviceWorker
rotimi-best commented 4 years ago

All the Todo listed below has been done.