feat: Implement real-time agent connection state updates and enhance app shell navigation transitions.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
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/agents/data/models/agent_profile.dart';
|
||||
import 'package:real_estate_mobile/features/agents/presentation/providers/agents_provider.dart';
|
||||
import 'package:real_estate_mobile/features/messaging/data/socket_service.dart';
|
||||
|
||||
class AgentDetailState {
|
||||
final AgentProfile? agent;
|
||||
@@ -375,10 +378,22 @@ class SpecializationCard {
|
||||
class AgentDetailNotifier extends StateNotifier<AgentDetailState> {
|
||||
final AgentsRepository _repo;
|
||||
final String agentId;
|
||||
StreamSubscription? _connectionResponseSub;
|
||||
|
||||
AgentDetailNotifier(this._repo, this.agentId)
|
||||
: super(const AgentDetailState()) {
|
||||
_load();
|
||||
// Listen for real-time connection response (accepted/rejected)
|
||||
_connectionResponseSub =
|
||||
SocketService().onConnectionResponse.listen((_) {
|
||||
if (mounted) loadConnectionStatus();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_connectionResponseSub?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _load() async {
|
||||
|
||||
Reference in New Issue
Block a user