Implemented per stream subscription recovery with polling fallback
This commit is contained in:
@@ -4,7 +4,6 @@ import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
|
||||
import '../models/notification_item.dart';
|
||||
import '../providers/notifications_provider.dart';
|
||||
import '../providers/realtime_controller.dart';
|
||||
|
||||
/// Wraps the app and installs both a Supabase realtime listener and the
|
||||
/// FCM handlers described in the frontend design.
|
||||
@@ -46,11 +45,11 @@ class _NotificationBridgeState extends ConsumerState<NotificationBridge>
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
super.didChangeAppLifecycleState(state);
|
||||
// App lifecycle is now monitored, but individual streams handle their own
|
||||
// recovery via StreamRecoveryWrapper. This no longer forces a global reconnect,
|
||||
// which was the blocking behavior users complained about.
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
try {
|
||||
// Trigger a best-effort realtime reconnection when the app resumes.
|
||||
ref.read(realtimeControllerProvider).recoverConnection();
|
||||
} catch (_) {}
|
||||
// Future: Could trigger stream-specific recovery hints if needed.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user