diff --git a/Meshtastic/Extensions/UserDefaults.swift b/Meshtastic/Extensions/UserDefaults.swift index 179d76c8..6150915e 100644 --- a/Meshtastic/Extensions/UserDefaults.swift +++ b/Meshtastic/Extensions/UserDefaults.swift @@ -10,12 +10,10 @@ import Foundation extension UserDefaults { enum Keys: String, CaseIterable { - case hasBeenLaunched case meshtasticUsername case preferredPeripheralId case provideLocation case provideLocationInterval - //case meshMapType case meshMapRecentering case meshMapShowNodeHistory case meshMapShowRouteLines @@ -27,16 +25,6 @@ extension UserDefaults { Keys.allCases.forEach { removeObject(forKey: $0.rawValue) } } - static var hasBeenLaunched: Bool { - get { - let result = UserDefaults.standard.bool(forKey: "hasBeenLaunched") - UserDefaults.standard.set(true, forKey: "hasBeenLaunched") - return result - } set { - UserDefaults.standard.set(newValue, forKey: "hasBeenLaunched") - } - } - static var meshtasticUsername: String { get { UserDefaults.standard.string(forKey: "meshtasticUsername") ?? "" @@ -57,9 +45,7 @@ extension UserDefaults { static var provideLocation: Bool { get { - let result = UserDefaults.standard.bool(forKey: "provideLocation") - UserDefaults.standard.set(true, forKey: "provideLocation") - return result + UserDefaults.standard.bool(forKey: "provideLocation") } set { UserDefaults.standard.set(newValue, forKey: "provideLocation") } @@ -74,15 +60,6 @@ extension UserDefaults { } } -// static var mapType: Int { -// get { -// UserDefaults.standard.integer(forKey: "meshMapType") -// } -// set { -// UserDefaults.standard.set(newValue, forKey: "meshMapType") -// } -// } - static var mapLayer: MapLayer { get { MapLayer(rawValue: UserDefaults.standard.string(forKey: "mapLayer") ?? MapLayer.standard.rawValue) ?? MapLayer.standard diff --git a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift index 61ed0753..447d01b0 100644 --- a/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift +++ b/Meshtastic/Views/Map/Custom/MapViewSwiftUI.swift @@ -222,7 +222,7 @@ struct MapViewSwiftUI: UIViewRepresentable { } /// Set selected map layer - // setOverlays(mapView: mapView) + setOverlays(mapView: mapView) let annotationCount = waypoints.count + (showNodeHistory ? positions.count : latest.count) if annotationCount != mapView.annotations.count { @@ -274,11 +274,6 @@ struct MapViewSwiftUI: UIViewRepresentable { self.parent.mapView.addGestureRecognizer(longPressRecognizer) } - func mapViewDidChangeVisibleRegion(_ mapView: MKMapView) { - - //print (mapView.visibleMapRect) - } - func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { switch annotation { @@ -448,7 +443,7 @@ struct MapViewSwiftUI: UIViewRepresentable { } public func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer { - + switch overlay { case let overlay as MKTileOverlay: return MKTileOverlayRenderer(tileOverlay: overlay) diff --git a/Meshtastic/Views/Settings/AppSettings.swift b/Meshtastic/Views/Settings/AppSettings.swift index 6debbe72..dc544509 100644 --- a/Meshtastic/Views/Settings/AppSettings.swift +++ b/Meshtastic/Views/Settings/AppSettings.swift @@ -60,10 +60,6 @@ struct AppSettings: View { Label("provide.location", systemImage: "location.circle.fill") } .toggleStyle(SwitchToggleStyle(tint: .accentColor)) - .onTapGesture { - self.provideLocation.toggle() - UserDefaults.provideLocation = self.provideLocation - } if UserDefaults.provideLocation { @@ -119,8 +115,8 @@ struct AppSettings: View { .onChange(of: (meshtasticUsername)) { newMeshtasticUsername in UserDefaults.meshtasticUsername = newMeshtasticUsername } - .onChange(of: provideLocation) { _ in - + .onChange(of: provideLocation) { newProvideLocation in + UserDefaults.provideLocation = newProvideLocation if bleManager.connectedPeripheral != nil { self.bleManager.sendWantConfig() }