Mark Notification Tray Seen
Global Tray Tracking
Update the trayβs seen timestamp on server when user visits the Notification Tray screen
Badge Management
Control UI badge indicators based on global seen status
Overview
UsemarkNotificationTraySeen()
to update the trayβs seen timestamp on the server when the user visits the Notification Tray screen.
This method supports global-level read tracking, separate from per-item seen state. Once invoked, future calls to getNotificationTraySeen()
will return the new isSeen
value. It is recommended to call this method as soon as the tray UI is opened.
This method updates the global tray seen state, not individual notification items. Use
markSeen()
on individual items for fine-grained tracking.Implementation Guide
Usage Patterns
π― When to Mark Tray as Seen
π― When to Mark Tray as Seen
Screen Visibility
Primary Triggers
- User opens/navigates to notification tray screen
- Tray becomes visible in UI (viewDidAppear, onResume)
- User focuses on notification tray tab/section
User Intent
Secondary Triggers
- User pulls-to-refresh in tray
- User explicitly marks βall as readβ
- User interacts with tray controls
Implementation Timing Examples
π State Synchronization Patterns
π State Synchronization Patterns
Global Badge Management Flow
Cross-screen Badge Updates
Tab Bar Badges
Update navigation tab indicators when tray is marked as seen
App Icon Badge
Clear app icon badge count when global tray is seen
Header Indicators
Update header notification bells and counters
Menu Badges
Clear sidebar or menu notification indicators
π¨ UI State Management
π¨ UI State Management
Before and After Visual States
Error Handling
Common Error Scenarios
Common Error Scenarios
Network Connectivity
Handle offline scenarios gracefully without blocking UI
Concurrent Operations
Prevent multiple simultaneous mark-seen operations
Authentication Issues
Handle token expiration during badge updates
State Inconsistency
Manage UI state when server operations fail
Error Handling Implementation
Error Handling Implementation
Best Practices
π― Implementation Guidelines
π― Implementation Guidelines
Timing
Call Timing
- As soon as tray UI becomes visible
- On screen/tab focus, not just app launch
- Consider slight delay for better UX
- Avoid calling multiple times for same session
Error Handling
Failure Management
- Fail silently to avoid blocking UI
- Implement exponential backoff for retries
- Log errors for debugging purposes
- Donβt show error dialogs for this operation
π§ Performance Optimization
π§ Performance Optimization
- Debounce Calls: Prevent multiple rapid calls during screen transitions
- Cache State: Store last known seen state locally for immediate UI updates
- Background Processing: Perform operation off main thread where possible
- Batch Operations: Combine with other notification operations when feasible
π¨ User Experience
π¨ User Experience
- Immediate Feedback: Update UI badges immediately, sync with server async
- Smooth Animations: Use transitions when hiding badge indicators
- Progressive Enhancement: UI should work even if operation fails
- Accessibility: Announce seen state changes to screen readers
π Security Considerations
π Security Considerations
- Authentication: Verify user is authenticated before calling
- Rate Limiting: Implement client-side rate limiting to prevent abuse
- Privacy: Handle seen states according to privacy policies
- Logging: Avoid logging sensitive notification data