Files
aiturk-mobil/app/src/main/java/com/m57/hermescontrol/data/local
M57 3798d0330f Fix main-thread decryption block by caching token in StateFlow (#322)
Issue #278 reported that `AuthManager.getToken()` (which reads from
`EncryptedSharedPreferences`) was being called synchronously inside the
`MainNavigation` composable, causing UI thread blocks during navigation
transitions (PERF-10).

This commit resolves the issue by caching the token in a new `tokenFlow`
(`MutableStateFlow`) within `AuthManager`.
- The flow is initialised with the token during `AuthManager.init()`.
- Updates to the token (`setToken`, `setSelectedProfileId`,
  `setProfileToken`) are synchronised with `tokenFlow`.
- `MainNavigation` now correctly observes this state using
  `collectAsState()`, preventing disk-read blocking on recompositions.

Impact: Navigation transitions are now fully non-blocking. No side effects
are expected as state synchronisation maintains parity with persistent storage.

Resolves #278
2026-06-23 12:19:33 +03:00
..