Page MenuHomePhabricator

EPIC: Host notifications locally so users can see their notifications while offline
Closed, ResolvedPublic

Description

Background
Presently when a user clicks on notifications and they are offline it takes them to a page that says "cannot connect to internet" and doesn't show their notifications.

Task
Host notifications in a way that allows users to access them when in offline mode, although they are unable to act on the notifications.

Current state:

image (4).png (2×1 px, 95 KB)

Example of desired state from another app:

Screenshot_20210803-143516.png (2×1 px, 417 KB)

Event Timeline

This is a huge task that should probably become an Epic, and broken into subtasks.
A rough sketch of how a proper solution would work:

  • Create a new local database table to hold notifications.
  • The background worker that checks for new notifications will write them to the database, instead of presenting them to the user directly. The database will now be the source of truth for notifications.
  • A new background worker will periodically check the database for new notifications, and present them to the user.
  • The Notification Center activity will show notifications from the database. Ergo: notifications will now be available offline, since they are being read from the database.

Some questions for @JTannerWMF :

  • What happens if the user marks a notification as read/unread while offline? Will we now need to synchronize the read/unread state of notifications between the local database and the server? (Recommendation: No. When offline, interactions with notifications will be limited to just seeing them, not any other kind of action, including marking as read.)
  • Upon initial install (or upgrade), will we need to pre-populate our database with all of the user's old notifications since the beginning of time? (Recommendation: Please no. Notifications available offline could be limited to those that arrived on the user's device after installation, and those that were unread at the time of install. Of course if the user navigates to the Notification Center while online, any notifications they browse could also be saved in the database, and therefore be available offline.)

What happens if the user marks a notification as read/unread while offline? Will we now need to synchronize the read/unread state of notifications between the local database and the server? (Recommendation: No. When offline, interactions with notifications will be limited to just seeing them, not any other kind of action, including marking as read.)

The answer to this is no. If they make any interaction it should tell them they are offline

Upon initial install (or upgrade), will we need to pre-populate our database with all of the user's old notifications since the beginning of time? (Recommendation: Please no. Notifications available offline could be limited to those that arrived on the user's device after installation, and those that were unread at the time of install. Of course if the user navigates to the Notification Center while online, any notifications they browse could also be saved in the database, and therefore be available offline.)

I agree with going with your recommended approach.

@Dbrant would you mind kindly creating the epic and sub tasks for this and putting it in needs triage? We can discuss the appropriate time to pull these on the board in our next team meeting?

Dbrant renamed this task from Host notifications locally so users can see their notifications in offline mode to EPIC: Host notifications locally so users can see their notifications while offline.Aug 6 2021, 3:38 PM
Dbrant added a project: Epic.