Page MenuHomePhabricator

Update Notifications activity to read from local database and network
Closed, ResolvedPublic

Description

Our current Notifications activity displays a list of the user's notifications by reading them from the network, which means that it won't show anything if the device is offline. After creating a local database with notifications that are persisted from the server, we will now be able to display known notifications even if the device is offline. The Notifications activity will require the following changes:

Step 1

  • If the device is online, fetch notifications from the network as before, but instead of displaying them, persist them to the database.
  • If the device is offline, skip this step.

Step 2

  • Display notifications from the database (whether or not the device is offline), since the database is now the source of truth.

Other considerations:

  • If the device is offline, all interactions with notifications shall be disabled, including marking them as read/unread, and any of the "actions" given by each notification.

Event Timeline

LGoto triaged this task as Medium priority.Aug 10 2021, 4:44 PM

Hi @Dbrant @schoenbaechler and @JTannerWMF

If the device is offline, all interactions with notifications shall be disabled, including marking them as read/unread, and any of the "actions" given by each notification.

Should we disable the click action for all list items (go to the primary link/secondary link)? It will mostly show the error message about the device being offline, but if the users have visited the pages before, it will be available for offline reading because of device caching.

Thanks @cooltey

It will mostly show the error message about the device being offline,

This is what I see when trying to access notifications when offline (latest Alpha):

Screenshot_1636634198.png (2×1 px, 64 KB)

I think the error message Unable resolve host “commons.wikimedia.org”: No address associated with hostname does not make too much sense so I suggest to remove it.

but if the users have visited the pages before, it will be available for offline reading because of device caching.

In regards to that, I suggest to reduce opacity of all notification list items, like on the Explore feed...

Screenshot_1636634507.png (2×1 px, 163 KB)

... and disable all tap targets on it. I’d say an additional “offline“ info snackbar when trying to tap an element could be helpful too. Are we using this pattern (snackbar) already somehwere in the app? If yes, please reuse! If not, here’s the snackbar copy and CTA:

Copy: Your network is unavailable, please check your internet connection and try again.
CTA: Try again

Hi @schoenbaechler
Sorry about the confusion, I should attach this link to my previous comment:
~~https://github.com/wikimedia/apps-android-wikipedia/tree/notification_offline_design~~

Please download the APK below and do a fresh install, so that you will see the notification when the device is offline.

You can test it on the alpha APK now.