rotimi-best/prayerkeep

Setup push notification in the app.

Closed this issue · 2 comments

Setup push notification in the app.

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

All the Todo listed below has been done.

  • Implement above flow and save the subscription in the db

  • Save the user's email and other information on the server.

  • Listen for unsubscription in serviceWorker