tinymux/client/android/app
Stephen Dennis 941dec87b8 feat(client/android): persist and resume the Hydra session id (#762)
The Console client (and Win32GUI, which shares hydra_connection.cpp)
persists its Hydra session id and resumes via GetSession(saved_id) before
falling back to Authenticate. The Android client did neither. Bring it to
parity:

- World: add `hydraSession`, serialized with the other Hydra fields. It
  lands in EncryptedSharedPreferences alongside the password, so the token
  is encrypted at rest (the Console keeps its copy in plaintext
  worlds.txt).
- HydraConnection: accept a `resumeSessionId` and, when non-empty, probe
  it with GetSession before authenticating. A successful probe (session
  exists and the username matches) skips password auth entirely; any
  failure — expired, unknown, or transport error — clears the stale token
  and falls through to the normal Authenticate path. Expose
  `currentSessionId` so the caller can persist it. The Connect(game_name)
  call after auth is left unconditional, matching the Console.
- TitanApp: pass `world.hydraSession` when connecting a saved world, and
  on connect write the new-or-resumed id back via WorldRepository (only
  when it changed, and only for saved worlds — ad-hoc /hconnect sessions
  are not persisted).

Also fixes a pre-existing compile break that made the Android client
unbuildable: WorldTab.idleSeconds() returns Int but ConditionContext
expects Long (TitanApp.kt:218).

Verification: builds clean in a real Android environment (Android Studio
JBR 21 + SDK 35, Gradle 9.3.1) — `assembleDebug` produces app-debug.apk.
Not runtime-tested: the Hydra server lives in a separate repo and this box
has no AVD or instrumentation test source set, so resume behaviour has not
been exercised against a live server.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 15:18:43 -06:00
..
src/main feat(client/android): persist and resume the Hydra session id (#762) 2026-07-21 15:18:43 -06:00
build.gradle.kts Add gRPC/Hydra transport to Android client 2026-03-22 15:20:45 -06:00