feat(service): Preserve Connecting state on reconnect

Keeps the connection state as 'Connecting' if it was not 'Disconnected' when `handleConnected` is called.

This prevents the UI from briefly showing a disconnected state during a reconnection attempt, such as when the device is rebooting.

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-02-07 15:40:08 -06:00
parent 0bcc801bc4
commit 75143ba07c

View file

@ -134,7 +134,10 @@ constructor(
}
private fun handleConnected() {
connectionStateHolder.setState(ConnectionState.Connecting)
// The service state remains 'Connecting' until config is fully loaded
if (connectionStateHolder.connectionState.value == ConnectionState.Disconnected) {
connectionStateHolder.setState(ConnectionState.Connecting)
}
serviceBroadcasts.broadcastConnection()
Logger.d { "Starting connect" }
connectTimeMsec = System.currentTimeMillis()