mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Clean up map settings form a bit
This commit is contained in:
parent
4584d5f5ce
commit
73f1f65553
4 changed files with 35 additions and 36 deletions
|
|
@ -20686,9 +20686,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Only Show Favorites" : {
|
||||
|
||||
},
|
||||
"Open Location Code (aka Plus Codes)" : {
|
||||
"localizations" : {
|
||||
|
|
@ -28467,7 +28464,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"Show Waypoints " : {
|
||||
"Show Waypoints" : {
|
||||
"localizations" : {
|
||||
"de" : {
|
||||
"stringUnit" : {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ extension UserDefaults {
|
|||
case enableMapTraffic
|
||||
case enableMapPointsOfInterest
|
||||
case enableOfflineMaps
|
||||
case onlyShowFavoriteNodesMap
|
||||
case enableMapShowFavorites
|
||||
case mapTileServer
|
||||
case enableOverlayServer
|
||||
case mapOverlayServer
|
||||
|
|
@ -120,8 +120,8 @@ extension UserDefaults {
|
|||
@UserDefault(.enableMapPointsOfInterest, defaultValue: false)
|
||||
static var enableMapPointsOfInterest: Bool
|
||||
|
||||
@UserDefault(.onlyShowFavoriteNodesMap, defaultValue: false)
|
||||
static var onlyShowFavoriteNodesMap: Bool
|
||||
@UserDefault(.enableMapShowFavorites, defaultValue: false)
|
||||
static var enableMapShowFavorites: Bool
|
||||
|
||||
@UserDefault(.enableDetectionNotifications, defaultValue: false)
|
||||
static var enableDetectionNotifications: Bool
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ struct MeshMapContent: MapContent {
|
|||
@AppStorage("meshMapShowNodeHistory") private var showNodeHistory = false
|
||||
@AppStorage("meshMapShowRouteLines") private var showRouteLines = false
|
||||
@AppStorage("enableMapConvexHull") private var showConvexHull = false
|
||||
@AppStorage("onlyShowFavoriteNodesMap") private var favoriteNodesOnly = false
|
||||
@AppStorage("enableMapShowFavorites") private var showFavorites = false
|
||||
@Binding var showTraffic: Bool
|
||||
@Binding var showPointsOfInterest: Bool
|
||||
@Binding var selectedMapLayer: MapLayer
|
||||
|
|
@ -40,7 +40,7 @@ struct MeshMapContent: MapContent {
|
|||
@MapContentBuilder
|
||||
var positionAnnotations: some MapContent {
|
||||
ForEach(positions, id: \.id) { position in
|
||||
if !favoriteNodesOnly || (position.nodePosition?.favorite == true) {
|
||||
if !showFavorites || (position.nodePosition?.favorite == true) {
|
||||
/// Node color from node.num
|
||||
let nodeColor = UIColor(hex: UInt32(position.nodePosition?.num ?? 0))
|
||||
let positionName = position.nodePosition?.user?.longName ?? "?"
|
||||
|
|
@ -61,7 +61,7 @@ struct MeshMapContent: MapContent {
|
|||
.onAppear {
|
||||
self.scale = 1
|
||||
}
|
||||
.onChange(of: favoriteNodesOnly) {
|
||||
.onChange(of: showFavorites) {
|
||||
|
||||
scale = 0.5 // Reset to initial state
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ struct MapSettingsForm: View {
|
|||
@Environment(\.dismiss) private var dismiss
|
||||
@State private var currentDetent = PresentationDetent.medium
|
||||
@AppStorage("meshMapShowNodeHistory") private var nodeHistory = false
|
||||
@AppStorage("meshMapShowRouteLines") private var routeLines = false
|
||||
@AppStorage("meshMapShowRouteLines") private var enableMapRouteLines = false
|
||||
@AppStorage("enableMapConvexHull") private var convexHull = false
|
||||
@AppStorage("enableMapWaypoints") private var waypoints = true
|
||||
@AppStorage("onlyShowFavoriteNodesMap") private var favoriteNodesOnly = false
|
||||
@AppStorage("enableMapWaypoints") private var enableMapWaypoints = true
|
||||
@AppStorage("enableMapShowFavorites") private var enableMapShowFavorites = false
|
||||
@Binding var traffic: Bool
|
||||
@Binding var pointsOfInterest: Bool
|
||||
@Binding var mapLayer: MapLayer
|
||||
|
|
@ -54,23 +54,25 @@ struct MapSettingsForm: View {
|
|||
.onChange(of: meshMapDistance) { _, newMeshMapDistance in
|
||||
UserDefaults.meshMapDistance = newMeshMapDistance
|
||||
}
|
||||
Toggle(isOn: $waypoints) {
|
||||
Label("Show Waypoints ", systemImage: "signpost.right.and.left")
|
||||
Toggle(isOn: $enableMapWaypoints) {
|
||||
Label {
|
||||
Text("Show Waypoints")
|
||||
} icon: {
|
||||
Image(systemName: "signpost.right.and.left")
|
||||
.symbolRenderingMode(.multicolor)
|
||||
}
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.onTapGesture {
|
||||
UserDefaults.enableMapWaypoints = !waypoints
|
||||
.tint(.accentColor)
|
||||
}
|
||||
Toggle(isOn: $enableMapShowFavorites) {
|
||||
Label {
|
||||
Text("Favorites")
|
||||
} icon: {
|
||||
Image(systemName: "star.fill")
|
||||
.symbolRenderingMode(.multicolor)
|
||||
}
|
||||
}
|
||||
|
||||
Toggle(isOn: $favoriteNodesOnly) {
|
||||
Label("Only Show Favorites", systemImage: "star.fill")
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.onTapGesture {
|
||||
self.favoriteNodesOnly.toggle()
|
||||
UserDefaults.onlyShowFavoriteNodesMap = self.favoriteNodesOnly
|
||||
}
|
||||
.tint(.accentColor)
|
||||
Toggle(isOn: $nodeHistory) {
|
||||
Label("Node History", systemImage: "building.columns.fill")
|
||||
}
|
||||
|
|
@ -79,15 +81,10 @@ struct MapSettingsForm: View {
|
|||
self.nodeHistory.toggle()
|
||||
UserDefaults.enableMapNodeHistoryPins = self.nodeHistory
|
||||
}
|
||||
Toggle(isOn: $routeLines) {
|
||||
Toggle(isOn: $enableMapRouteLines) {
|
||||
Label("Route Lines", systemImage: "road.lanes")
|
||||
}
|
||||
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.onTapGesture {
|
||||
self.routeLines.toggle()
|
||||
UserDefaults.enableMapRouteLines = self.routeLines
|
||||
}
|
||||
.tint(.accentColor)
|
||||
Toggle(isOn: $convexHull) {
|
||||
Label("Convex Hull", systemImage: "button.angledbottom.horizontal.right")
|
||||
}
|
||||
|
|
@ -105,9 +102,14 @@ struct MapSettingsForm: View {
|
|||
UserDefaults.enableMapTraffic = self.traffic
|
||||
}
|
||||
Toggle(isOn: $pointsOfInterest) {
|
||||
Label("Points of Interest", systemImage: "mappin.and.ellipse")
|
||||
Label {
|
||||
Text("Points of Interest")
|
||||
} icon: {
|
||||
Image(systemName: "mappin.and.ellipse")
|
||||
.symbolRenderingMode(.multicolor)
|
||||
}
|
||||
}
|
||||
.toggleStyle(SwitchToggleStyle(tint: .accentColor))
|
||||
.tint(.accentColor)
|
||||
.onTapGesture {
|
||||
self.pointsOfInterest.toggle()
|
||||
UserDefaults.enableMapPointsOfInterest = self.pointsOfInterest
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue