Get the last 50 nodes seen for the mesh map, zoom much closer by default, only show nodes from the last 48 hours on the mesh map

This commit is contained in:
Garth Vander Houwen 2024-03-23 18:22:10 -07:00
parent 7d00a5882b
commit 03a210e415
2 changed files with 4 additions and 5 deletions

View file

@ -14,13 +14,13 @@ extension PositionEntity {
static func allPositionsFetchRequest() -> NSFetchRequest<PositionEntity> {
let request: NSFetchRequest<PositionEntity> = PositionEntity.fetchRequest()
request.fetchLimit = 75
request.fetchLimit = 50
//request.fetchBatchSize = 1
//request.returnsObjectsAsFaults = true
//request.includesSubentities = false
request.returnsDistinctResults = true
request.sortDescriptors = [NSSortDescriptor(key: "time", ascending: false)]
request.predicate = NSPredicate(format: "nodePosition != nil && latest == true", Calendar.current.date(byAdding: .day, value: -7, to: Date())! as NSDate)
request.predicate = NSPredicate(format: "nodePosition != nil && latest == true && time >= %@", Calendar.current.date(byAdding: .day, value: -2, to: Date())! as NSDate)
return request
}

View file

@ -29,11 +29,11 @@ struct MeshMap: View {
@AppStorage("enableMapConvexHull") private var showConvexHull = false
@AppStorage("enableMapTraffic") private var showTraffic: Bool = false
@AppStorage("enableMapPointsOfInterest") private var showPointsOfInterest: Bool = false
@AppStorage("mapLayer") private var selectedMapLayer: MapLayer = .hybrid
@AppStorage("mapLayer") private var selectedMapLayer: MapLayer = .standard
// Map Configuration
@Namespace var mapScope
@State var mapStyle: MapStyle = MapStyle.standard(elevation: .flat, emphasis: MapStyle.StandardEmphasis.muted ,pointsOfInterest: .all, showsTraffic: true)
@State var position = MapCameraPosition.automatic
@State var position = MapCameraPosition.camera(MapCamera(centerCoordinate: LocationHelper.currentLocation, distance: 2500000, heading: 0, pitch: 0))
@State var isEditingSettings = false
@State var selectedPosition: PositionEntity?
@State var showWaypoints = false
@ -42,7 +42,6 @@ struct MeshMap: View {
@State var newWaypointCoord: CLLocationCoordinate2D?
@State var isMeshMap = true
/// && time >= %@
@FetchRequest(fetchRequest: PositionEntity.allPositionsFetchRequest(), animation: .none)
var positions: FetchedResults<PositionEntity>