mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor: replace nodeDBbyID with getUser() function
This commit is contained in:
parent
a6cfbcbfa7
commit
84939a74d2
5 changed files with 19 additions and 29 deletions
|
|
@ -383,7 +383,7 @@ fun MapView(
|
|||
fun getUsername(id: String?) = if (id == DataPacket.ID_LOCAL) {
|
||||
context.getString(R.string.you)
|
||||
} else {
|
||||
model.nodeDB.nodes.value[id]?.user?.longName ?: context.getString(R.string.unknown_username)
|
||||
model.getUser(id).longName
|
||||
}
|
||||
|
||||
fun MapView.onWaypointChanged(waypoints: Collection<Packet>): List<MarkerWithLabel> {
|
||||
|
|
@ -467,7 +467,7 @@ fun MapView(
|
|||
}
|
||||
|
||||
fun MapView.zoomToNodes() {
|
||||
val nodeMarkers = onNodesChanged(model.nodeDB.nodesByNum.values)
|
||||
val nodeMarkers = onNodesChanged(model.nodesByNum.values)
|
||||
if (nodeMarkers.isNotEmpty()) {
|
||||
val box = BoundingBox.fromGeoPoints(nodeMarkers.map { it.position })
|
||||
val center = GeoPoint(box.centerLatitude, box.centerLongitude)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue