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.