android: keep session authenticated on startup when offline
Some checks failed
CI / test (push) Failing after 2m7s

This commit is contained in:
Codex
2026-03-09 15:27:58 +03:00
parent 89755394f7
commit 3eb68cedad
2 changed files with 6 additions and 1 deletions

View File

@@ -343,3 +343,7 @@
- Added paged local history reading path by introducing configurable message observe limit (`observeMessages(chatId, limit)`). - Added paged local history reading path by introducing configurable message observe limit (`observeMessages(chatId, limit)`).
- Updated chat screen loading strategy to expand local Room-backed history first when loading older messages. - Updated chat screen loading strategy to expand local Room-backed history first when loading older messages.
- Added network-failure fallback in message sync/load-more: if network is unavailable but local cache exists, chat remains readable without blocking error. - Added network-failure fallback in message sync/load-more: if network is unavailable but local cache exists, chat remains readable without blocking error.
### Step 58 - Keep authenticated session when offline at app start
- Updated auth restore flow in `AuthViewModel`: network errors during session restore no longer force logout when local tokens exist.
- App now opens authenticated flow in offline mode instead of redirecting to login.

View File

@@ -101,10 +101,11 @@ class AuthViewModel @Inject constructor(
} }
is AppResult.Error -> { is AppResult.Error -> {
val keepAuthenticatedOffline = result.reason is AppError.Network
_uiState.update { _uiState.update {
it.copy( it.copy(
isCheckingSession = false, isCheckingSession = false,
isAuthenticated = false, isAuthenticated = keepAuthenticatedOffline,
errorMessage = null, errorMessage = null,
) )
} }