mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Decouple NodeMapScreen from MetricsViewModel (#3323)
Co-authored-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
8b4397a825
commit
ff95bc5311
7 changed files with 87 additions and 47 deletions
|
|
@ -20,6 +20,8 @@ package org.meshtastic.core.proto
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.geeksville.mesh.MeshProtos
|
||||
import com.geeksville.mesh.MeshProtos.MeshPacket
|
||||
import com.geeksville.mesh.MeshProtos.Position
|
||||
import java.text.DateFormat
|
||||
import kotlin.time.Duration.Companion.days
|
||||
|
||||
|
|
@ -38,3 +40,9 @@ fun MeshProtos.Position.formatPositionTime(dateFormat: DateFormat): String {
|
|||
}
|
||||
return timeText
|
||||
}
|
||||
|
||||
fun MeshPacket.toPosition(): Position? = if (!decoded.wantResponse) {
|
||||
runCatching { Position.parseFrom(decoded.payload) }.getOrNull()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue