feat: Implement optimistic UI for agent availability toggle, add email and phone visibility toggles, and improve the logout process with immediate socket disconnection and best-effort API calls.

This commit is contained in:
pradeepkumar committed 2026-03-15 00:35:39 +05:30
1 parent 54fdd66270
commit 21f669fca5
6 files changed
+104 -14

No files matched your search

@@ -103,12 +103,15 @@ class AuthNotifier extends StateNotifier<AuthState> {
}
Future<void> logout() async {
state = state.copyWith(status: AuthStatus.loading);
// Disconnect socket before logout
// Disconnect socket immediately
SocketService().disconnect();
// Unregister FCM token before clearing auth
await PushNotificationService().unregister();
await _repository.logout();
// Attempt FCM unregister and API logout (best-effort, don't block)
try {
await PushNotificationService().unregister();
} catch (_) {}
try {
await _repository.logout();
} catch (_) {}
state = const AuthState();
}