mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: Add disconnect broadcast and improve app port handling (#4502)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
a493cf1420
commit
31790ff709
10 changed files with 181 additions and 41 deletions
|
|
@ -118,7 +118,7 @@ constructor(
|
|||
}
|
||||
|
||||
private fun onConnectionChanged(c: ConnectionState) {
|
||||
if (connectionStateHolder.connectionState.value == c && c !is ConnectionState.Connected) return
|
||||
if (connectionStateHolder.connectionState.value == c) return
|
||||
Logger.d { "onConnectionChanged: ${connectionStateHolder.connectionState.value} -> $c" }
|
||||
|
||||
sleepTimeout?.cancel()
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue