Back to standard as a default map type

hook up map the setting to the user default for meshMapType
This commit is contained in:
Garth Vander Houwen 2023-02-20 20:00:00 -08:00
parent 844c424c1b
commit 527ff53150
3 changed files with 26 additions and 3 deletions

View file

@ -59,7 +59,7 @@ class UserSettings: ObservableObject {
self.provideLocation = UserDefaults.standard.object(forKey: "provideLocation") as? Bool ?? false
self.provideLocationInterval = UserDefaults.standard.object(forKey: "provideLocationInterval") as? Int ?? 900
self.keyboardType = UserDefaults.standard.object(forKey: "keyboardType") as? Int ?? 0
self.meshMapType = UserDefaults.standard.string(forKey: "meshMapType") ?? "hybridFlyover"
self.meshMapType = UserDefaults.standard.string(forKey: "meshMapType") ?? "standard"
self.meshMapCustomTileServer = UserDefaults.standard.string(forKey: "meshMapCustomTileServer") ?? ""
}
}

View file

@ -13,6 +13,7 @@ struct NodeDetail: View {
@Environment(\.managedObjectContext) var context
@EnvironmentObject var bleManager: BLEManager
@Environment(\.colorScheme) var colorScheme: ColorScheme
@AppStorage("meshMapType") private var meshMapType = "standard"
@State private var mapType: MKMapType = .standard
@State var waypointCoordinate: CLLocationCoordinate2D?
@State var editingWaypoint: Int = 0
@ -435,6 +436,28 @@ struct NodeDetail: View {
})
.onAppear {
self.bleManager.context = context
switch meshMapType {
case "standard":
mapType = .standard
break
case "mutedStandard":
mapType = .mutedStandard
break
case "hybrid":
mapType = .hybrid
break
case "hybridFlyover":
mapType = .hybridFlyover
break
case "satellite":
mapType = .satellite
break
case "satelliteFlyover":
mapType = .satelliteFlyover
break
default:
mapType = .hybridFlyover
}
}
.task(id: node.num) {
do {

View file

@ -29,7 +29,7 @@ struct NodeMap: View {
}
}
}
@AppStorage("meshMapType") private var meshMapType = "standard"
@AppStorage("meshMapType") private var meshMapType = "hybridFlyover"
//&& nodePosition != nil
@FetchRequest(sortDescriptors: [NSSortDescriptor(key: "time", ascending: true)],
@ -42,7 +42,7 @@ struct NodeMap: View {
), animation: .none)
private var waypoints: FetchedResults<WaypointEntity>
@State private var mapType: MKMapType = .hybridFlyover
@State private var mapType: MKMapType = .standard
@State var waypointCoordinate: CLLocationCoordinate2D = LocationHelper.DefaultLocation
@State var editingWaypoint: Int = 0
@State private var presentingWaypointForm = false