didChangeAppLifecycleState method

  1. @override
void didChangeAppLifecycleState(
  1. AppLifecycleState state
)
override

Refresh inbox when app returns to foreground. This is the reliable fallback for when silent push doesn't work (battery optimization, iOS background limits, Firebase not configured, etc.)

Implementation

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
  if (state == AppLifecycleState.resumed && _initialized) {
    debugPrint('InboxService: app resumed, refreshing inbox if stale');
    // Use refreshIfStale so brief app switches don't trigger unnecessary
    // network requests. A full refresh() still happens when the cache
    // has expired, covering the case where silent push didn't arrive.
    refreshIfStale();
  }
}