fix: detekt (#3090)

This commit is contained in:
James Rich 2025-09-14 08:26:21 -05:00 committed by GitHub
parent 7905334f1b
commit ba003487c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1378,11 +1378,17 @@ class MeshService :
val isRouter = localConfig.device.role == ConfigProtos.Config.DeviceConfig.Role.ROUTER
val lsEnabled = localConfig.power.isPowerSaving || isRouter
val effectiveState = when (newState) {
ConnectionState.CONNECTED -> ConnectionState.CONNECTED
ConnectionState.DEVICE_SLEEP -> if (lsEnabled) ConnectionState.DEVICE_SLEEP else ConnectionState.DISCONNECTED
ConnectionState.DISCONNECTED -> ConnectionState.DISCONNECTED
}
val effectiveState =
when (newState) {
ConnectionState.CONNECTED -> ConnectionState.CONNECTED
ConnectionState.DEVICE_SLEEP ->
if (lsEnabled) {
ConnectionState.DEVICE_SLEEP
} else {
ConnectionState.DISCONNECTED
}
ConnectionState.DISCONNECTED -> ConnectionState.DISCONNECTED
}
onConnectionChanged(effectiveState)
}