Merge branch 'main' into 2.0.16_Working_Changes

This commit is contained in:
Garth Vander Houwen 2023-02-23 15:52:04 -08:00 committed by GitHub
commit d83fcd1247
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 15 deletions

View file

@ -2021,9 +2021,9 @@ extension BLEManager: CBCentralManagerDelegate {
//connectedPeripheral.peripheral = peripherals[0]
// 5
//connectedPeripheral.peripheral.delegate = self
for peripheral in peripherals {
switch peripheral.state {
case .connecting: // I've only seen this happen when
// re-launching attached to Xcode.
@ -2035,9 +2035,9 @@ extension BLEManager: CBCentralManagerDelegate {
//centralManager.connect(peripheral)
default: break
}
// connectedPeripheral.peripheral
//connectedPeripheral.peripheral = peripheral
//connectedPeripheral.peripheral.delegate = self

View file

@ -22,7 +22,7 @@ struct MapViewSwiftUI: UIViewRepresentable {
let centeringMode: CenteringMode
let centerOnPositionsOnly: Bool
@AppStorage("meshMapRecenter") private var recenter = false
@AppStorage("meshMapRecentering") private var recenter = false
// Offline Maps
//make this view dependent on the UserDefault that is updated when importing a new map file
@ -50,12 +50,11 @@ struct MapViewSwiftUI: UIViewRepresentable {
let center = CLLocationCoordinate2D(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude)
let region = MKCoordinateRegion(center: center, span: span)
mapView.setRegion(region, animated: true)
mapView.setUserTrackingMode(.followWithHeading, animated: true)
mapView.addAnnotations(positions)
}
// Other MKMapView Settings
mapView.showsUserLocation = true
mapView.showsUserLocation = false
mapView.preferredConfiguration.elevationStyle = .realistic
mapView.isPitchEnabled = true
mapView.isRotateEnabled = true
@ -130,10 +129,10 @@ struct MapViewSwiftUI: UIViewRepresentable {
}
case .clientGps:
mapView.addAnnotations(positions)
mapView.showsUserLocation = true
mapView.setUserTrackingMode(.followWithHeading, animated: true)
if recenter {
let span = MKCoordinateSpan(latitudeDelta: 0.003, longitudeDelta: 0.003)
let region = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: LocationHelper.currentLocation.latitude, longitude: LocationHelper.currentLocation.longitude), span: span)
mapView.setRegion(region, animated: true)
mapView.centerCoordinate = LocationHelper.currentLocation
}
}
}

View file

@ -204,7 +204,7 @@ struct DeviceConfig: View {
// Need to request a LoRaConfig from the remote node before allowing changes
if bleManager.connectedPeripheral != nil && node?.deviceConfig == nil {
print("empty device config")
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral?.num ?? -1, context: context)
if connectedNode != nil && connectedNode!.num > 0 {
_ = bleManager.requestDeviceConfig(fromUser: connectedNode!.user!, toUser: node!.user!, adminIndex: connectedNode?.myInfo?.adminIndex ?? 0)
}

View file

@ -154,7 +154,7 @@ struct ExternalNotificationConfig: View {
isPresented: $isPresentingSaveConfirm,
titleVisibility: .visible
) {
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral?.num ?? -1, context: context)
if connectedNode != nil {
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)

View file

@ -143,7 +143,7 @@ struct MQTTConfig: View {
isPresented: $isPresentingSaveConfirm,
titleVisibility: .visible
) {
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral?.num ?? -1, context: context)
if connectedNode != nil {
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)

View file

@ -77,7 +77,7 @@ struct TelemetryConfig: View {
isPresented: $isPresentingSaveConfirm,
titleVisibility: .visible
) {
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral.num, context: context)
let connectedNode = getNodeInfo(id: bleManager.connectedPeripheral?.num ?? -1, context: context)
if connectedNode != nil {
let nodeName = node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown")
let buttonText = String.localizedStringWithFormat(NSLocalizedString("save.config %@", comment: "Save Config for %@"), nodeName)