Don't be dumb

This commit is contained in:
Garth Vander Houwen 2023-11-17 23:57:56 -08:00
parent 70052affc4
commit a8a3dab926
2 changed files with 13 additions and 2 deletions

View file

@ -259,8 +259,9 @@ func upsertPositionPacket (packet: MeshPacket, context: NSManagedObjectContext)
/// Don't save the same position over and over.
if mutablePositions.count > 0 {
let mostRecent = mutablePositions.lastObject as! PositionEntity
if mostRecent.latitudeI == position.latitudeI && mostRecent.longitudeI == position.latitudeI {
if mostRecent.latitudeI == position.latitudeI && mostRecent.longitudeI == position.longitudeI {
mutablePositions.remove(mostRecent)
print("Delete stupid fixed position for \(position.nodePosition)")
}
}
mutablePositions.add(position)

View file

@ -106,7 +106,17 @@ struct MeshMap: View {
}
.frame(width: 60, height: 60)
}
CircleText(text: position.nodePosition?.user?.shortName ?? "?", color: Color(nodeColor), circleSize: 40)
if position.nodePostion?.hasDetectionSensor ?? false {
Image(systemName: "sensor.fill")
.symbolRenderingMode(.palette)
.symbolEffect(.variableColor)
.padding()
.foregroundStyle(.white)
.background(Color(nodeColor))
.clipShape(Circle())
} else {
CircleText(text: position.nodePosition?.user?.shortName ?? "?", color: Color(nodeColor), circleSize: 40)
}
}
.onTapGesture { location in
selectedPosition = (selectedPosition == position ? nil : position)