feat: Implement real-time agent connection state updates and enhance app shell navigation transitions.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:real_estate_mobile/features/agents/data/agents_repository.dart';
|
||||
import 'package:real_estate_mobile/features/messaging/data/socket_service.dart';
|
||||
|
||||
class AgentNetworkState {
|
||||
final List<Map<String, dynamic>> pendingRequests;
|
||||
@@ -36,9 +39,21 @@ class AgentNetworkState {
|
||||
|
||||
class AgentNetworkNotifier extends StateNotifier<AgentNetworkState> {
|
||||
final AgentsRepository _repo;
|
||||
StreamSubscription? _connectionRequestSub;
|
||||
|
||||
AgentNetworkNotifier(this._repo) : super(const AgentNetworkState()) {
|
||||
loadData();
|
||||
// Listen for real-time connection request events
|
||||
_connectionRequestSub =
|
||||
SocketService().onConnectionRequest.listen((_) {
|
||||
if (mounted) loadData();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_connectionRequestSub?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> loadData() async {
|
||||
|
||||
Reference in New Issue
Block a user