android: keep session authenticated on startup when offline
Some checks failed
CI / test (push) Failing after 2m7s
Some checks failed
CI / test (push) Failing after 2m7s
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
@@ -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,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user