Page MenuHomePhabricator

Integrate with Push notifications
Open, MediumPublic5 Estimated Story Points

Description

This task encompasses the work of integrating the app with the new Push functionality in the Echo extension, as well as a few additional considerations regarding the use of Firebase.

  • Add dependency to Firebase.

We must add the necessary library dependency, and add a minimal service class that will receive messages from Firebase.

  • Make use of the new API in the Echo extension.

The Echo extension has a new API (echopushsubscriptions) that lets us subscribe and unsubscribe a device token that we will get from Firebase. As soon as we receive a token from Firebase, we should register it with the Echo API (making sure to unsubscribe any previous token). Echo will then use that token to broadcast notifications to the Firebase backend.

  • Receive and respond to messages from Firebase.

The messages that we receive from Firebase will not be the actual Echo notifications, but simply a "ping" to tell us that new notification(s) exist for the current user. Upon receiving such a message, we should poll the regular API for retrieving notifications, exactly as we do today.

  • Make sure to have fallbacks for various failure modes

If anything goes wrong with the push workflow, the app should automatically fall back to the current polling method of retrieving notifications. For example, if the API for registering the device token fails repeatedly.


Questions to be resolved:

  • When exactly during the lifecycle of the app does Firebase issue the token?
  • How often does Firebase re-issue a new token to the app?
  • Does the Echo extension detect if the same token is registered more than once? (i.e. is it safe to re-issue the API call to register the same token, without the limited token slots filling up?)

Event Timeline

Dbrant created this task.Sep 21 2020, 3:05 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 21 2020, 3:05 PM
Dbrant updated the task description. (Show Details)Sep 21 2020, 3:13 PM
Charlotte triaged this task as Medium priority.Sep 22 2020, 4:17 PM
Charlotte set the point value for this task to 5.
Charlotte renamed this task from EPIC: Integrate with Push notifications to Integrate with Push notifications.Sep 22 2020, 6:13 PM
Charlotte removed a project: Epic.

Notes for QA:

To receive a notification, try the following:

  • Make sure to be logged in to the app.
  • On your desktop, go to your User Talk page in an incognito window, and leave a message there. (so that you leave a message from an "anonymous" account, instead of from yourself.)
  • Wait for a notification to appear in the app. Unfortunately this may take up to 20 minutes; this is simply how the notifications are architected server-side.
  • If the notification does not appear after 20 minutes, something is not right.

Make sure to also test receiving notifications with your device's screen turned off, and with the app fully exited. (swipe it away from your running apps list)

ABorbaWMF added a subscriber: ABorbaWMF.

Looking good to me so far. I was able to receive a variety of notifications both with the app open and closed (exited). I received notifications from talk page entries, milestones and welcome messages. Tested on 2.7.50333-alpha-2020-10-22