feat: Enhance messaging read receipts and auto-read, fix auth 401 error suppression during logout, and refine agent profile expertise

This commit is contained in:
pradeepkumar
2026-03-27 06:32:46 +05:30
parent ba87e3b091
commit 4c06d0d895
7 changed files with 77 additions and 15 deletions

View File

@@ -14,6 +14,9 @@ class ApiClient {
bool _isRefreshing = false;
final List<_QueuedRequest> _failedQueue = [];
// Suppress 401 errors during logout to prevent SnackBar flashing
static bool suppressAuthErrors = false;
// Callback to notify app of forced logout
static void Function()? onForceLogout;
@@ -60,6 +63,12 @@ class ApiClient {
onError: (error, handler) async {
// Handle 401 — attempt token refresh
if (error.response?.statusCode == 401) {
// During logout, silently reject 401s without showing errors
if (suppressAuthErrors) {
handler.reject(error);
return;
}
final requestUrl = error.requestOptions.path;
// Don't try to refresh if this was the refresh request itself