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:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user