Alerts & Notifications Technical Overview
Overview
The Alerts screen provides users with a centralized location to view, manage, and acknowledge system notifications and alerts generated by the Smarta platform. It supports real-time updates, swipe-to-mark-as-read, and bulk actions for efficient alert management.
Key Functionalities
1. Alert Retrieval & Display
- Fetching Alerts:
- Alerts are securely fetched from the backend using the authenticated user's token.
- The list is refreshed on screen load and can be manually refreshed by the user (pull-to-refresh).
- Sorting & Grouping:
- Alerts are sorted by creation date and grouped by read/unread status, with unread alerts shown at the top.
- Visual Feedback:
- Each alert displays its message, creation time, and read time (if applicable).
- Alerts are color-coded by severity (yellow, orange, red) and visually distinguished when read.
2. Alert Management Actions
- Mark as Read (Swipe):
- Users can swipe an alert to the left to mark it as read. This triggers a backend update and refreshes the list.
- Bulk Mark All as Read:
- A toolbar button allows users to mark all unread alerts as read in a single action.
- Success and error feedback is provided for all actions.
3. Real-Time & Robust Feedback
- Pull-to-Refresh:
- Users can refresh the alert list at any time to fetch the latest data from the backend.
- Error Handling:
- All network and backend errors are caught and displayed to the user via alerts.
- The UI remains responsive and disables actions as needed during network operations.
4. Security & Data Integrity
- Authenticated Requests:
- All alert actions require a valid authentication token and are performed securely.
- Session Awareness:
- If authentication data is missing, the screen disables alert actions and logs the user out if necessary.