rouse-context/work/src
Jason Monk 15df1b6eba Fix #112: Push refreshed FCM tokens to relay when tunnel is connected
FcmTokenRegistrar.registerToken was a no-op that only logged. When FCM
rotated the device token mid-session, the relay kept the stale token
until the next reconnect (could be hours). The pull-on-connect path in
TunnelForegroundService covered the disconnected case but not the
live-session case.

Inject TunnelClient into FcmTokenRegistrar; on token refresh, push via
TunnelClient.sendFcmToken when state is CONNECTED or ACTIVE. Treat
CONNECTING as disconnected to avoid racing a half-open connection.
Swallow send exceptions so a racing disconnect can't crash the FCM
service thread — the next wake's pull will re-sync.

Drop registerCurrentToken() and the RouseApplication.onCreate call site.
It was pure overhead: the tunnel already pulls a fresh token on every
connect, so a startup push adds nothing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 19:52:32 -04:00
..
main Fix #112: Push refreshed FCM tokens to relay when tunnel is connected 2026-04-14 19:52:32 -04:00
test Fix #112: Push refreshed FCM tokens to relay when tunnel is connected 2026-04-14 19:52:32 -04:00