mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Location cleanup
This commit is contained in:
parent
a30fc18d73
commit
f2aea53ab6
4 changed files with 35 additions and 17 deletions
|
|
@ -55,14 +55,28 @@ struct NodeListItem: View {
|
|||
if node.positions?.count ?? 0 > 0 && connectedNode != node.num {
|
||||
HStack {
|
||||
let lastPostion = node.positions!.reversed()[0] as! PositionEntity
|
||||
let myCoord = CLLocation(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude)
|
||||
if lastPostion.nodeCoordinate != nil && myCoord.coordinate.longitude != LocationHelper.DefaultLocation.longitude && myCoord.coordinate.latitude != LocationHelper.DefaultLocation.latitude {
|
||||
let nodeCoord = CLLocation(latitude: lastPostion.nodeCoordinate!.latitude, longitude: lastPostion.nodeCoordinate!.longitude)
|
||||
let metersAway = nodeCoord.distance(from: myCoord)
|
||||
Image(systemName: "lines.measurement.horizontal")
|
||||
.font(.callout)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
DistanceText(meters: metersAway).font(.callout)
|
||||
if #available(iOS 17.0, macOS 14.0, *) {
|
||||
let myCoord = CLLocation(latitude: LocationsHandler.shared.lastLocation.coordinate.latitude, longitude: LocationsHandler.shared.lastLocation.coordinate.longitude)
|
||||
if lastPostion.nodeCoordinate != nil && myCoord.coordinate.longitude != LocationsHandler.DefaultLocation.longitude && myCoord.coordinate.latitude != LocationsHandler.DefaultLocation.latitude {
|
||||
let nodeCoord = CLLocation(latitude: lastPostion.nodeCoordinate!.latitude, longitude: lastPostion.nodeCoordinate!.longitude)
|
||||
let metersAway = nodeCoord.distance(from: myCoord)
|
||||
Image(systemName: "lines.measurement.horizontal")
|
||||
.font(.callout)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
DistanceText(meters: metersAway).font(.callout)
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
let myCoord = CLLocation(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude)
|
||||
if lastPostion.nodeCoordinate != nil && myCoord.coordinate.longitude != LocationHelper.DefaultLocation.longitude && myCoord.coordinate.latitude != LocationHelper.DefaultLocation.latitude {
|
||||
let nodeCoord = CLLocation(latitude: lastPostion.nodeCoordinate!.latitude, longitude: lastPostion.nodeCoordinate!.longitude)
|
||||
let metersAway = nodeCoord.distance(from: myCoord)
|
||||
Image(systemName: "lines.measurement.horizontal")
|
||||
.font(.callout)
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
DistanceText(meters: metersAway).font(.callout)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ struct RouteRecorder: View {
|
|||
@State var isShowingDetails = false
|
||||
@State var timer: Timer?
|
||||
@Namespace var namespace
|
||||
@Namespace var mapscope
|
||||
@Namespace var routerecorderscope
|
||||
@State var timeElapsed: TimerDisplayObject = TimerDisplayObject()
|
||||
@State var timerDisplay = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ struct RouteRecorder: View {
|
|||
VStack {
|
||||
VStack {
|
||||
VStack {
|
||||
Map(position: $position, scope: mapscope) {
|
||||
Map(position: $position, scope: routerecorderscope) {
|
||||
UserAnnotation()
|
||||
// ForEach(locations, id: \.id) { location in
|
||||
// Marker(location.name, systemImage: location.icon, coordinate: location.location)
|
||||
|
|
@ -53,6 +53,7 @@ struct RouteRecorder: View {
|
|||
// }
|
||||
}
|
||||
}
|
||||
.mapScope(routerecorderscope)
|
||||
.mapControls {
|
||||
MapUserLocationButton()
|
||||
MapCompass()
|
||||
|
|
@ -62,10 +63,6 @@ struct RouteRecorder: View {
|
|||
.mapStyle(.hybrid(elevation: .realistic, showsTraffic: true))
|
||||
.transition(.slide)
|
||||
.mapControlVisibility(.visible)
|
||||
.task {
|
||||
print("this is running")
|
||||
locationsHandler.startLocationUpdates()
|
||||
}
|
||||
.safeAreaInset(edge: .bottom) {
|
||||
ZStack {
|
||||
VStack {
|
||||
|
|
|
|||
|
|
@ -313,7 +313,6 @@ struct Settings: View {
|
|||
}
|
||||
}
|
||||
.onAppear {
|
||||
selection = SettingsSidebar.about
|
||||
if self.bleManager.context == nil {
|
||||
self.bleManager.context = context
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue