Fix TokenStorage stale cache bug and add user-friendly error messages
- Fix TokenStorage.getToken() returning stale cached token after login/logout - Add comprehensive ErrorMessageParser with 80+ error code mappings - Add Suite9 and Suite10 UI test files for E2E integration testing - Fix accessibility identifiers in RegisterView and ResidenceFormView - Fix UITestHelpers logout to target alert button specifically - Update various UI components with proper accessibility identifiers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ package com.example.casera.network
|
||||
*/
|
||||
object ApiConfig {
|
||||
// ⚠️ CHANGE THIS TO TOGGLE ENVIRONMENT ⚠️
|
||||
val CURRENT_ENV = Environment.DEV
|
||||
val CURRENT_ENV = Environment.LOCAL
|
||||
|
||||
enum class Environment {
|
||||
LOCAL,
|
||||
|
||||
@@ -33,10 +33,9 @@ object TokenStorage {
|
||||
|
||||
fun getToken(): String? {
|
||||
ensureInitialized()
|
||||
// Return cached token if available, otherwise try to load from storage
|
||||
if (cachedToken == null) {
|
||||
cachedToken = tokenManager?.getToken()
|
||||
}
|
||||
// Always read from storage to avoid stale cache issues
|
||||
// (DataManager.setAuthToken updates tokenManager directly, bypassing our cachedToken)
|
||||
cachedToken = tokenManager?.getToken()
|
||||
return cachedToken
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user