feat: allow hiding offline and/or non-direct nodes from list and map (#2052)

Co-authored-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
Łukasz Kosson 2025-06-09 19:44:53 +02:00 committed by GitHub
parent 6becdf137b
commit e781d6774b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 211 additions and 16 deletions

View file

@ -33,6 +33,7 @@ import com.geeksville.mesh.Position
import com.geeksville.mesh.TelemetryProtos
import com.geeksville.mesh.copy
import com.geeksville.mesh.model.Node
import com.geeksville.mesh.util.onlineTimeThreshold
import com.google.protobuf.ByteString
data class NodeWithRelations(
@ -164,9 +165,7 @@ data class NodeEntity(
*/
val isOnline: Boolean
get() {
val now = System.currentTimeMillis() / 1000
val timeout = 2 * 60 * 60
return (now - lastHeard <= timeout)
return lastHeard > onlineTimeThreshold()
}
companion object {