mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Cleanup Client tracking mode some
This commit is contained in:
parent
b79e63e573
commit
dba7889666
7 changed files with 48 additions and 43 deletions
|
|
@ -93,6 +93,8 @@ enum SenderIntervals: Int, CaseIterable, Identifiable {
|
|||
|
||||
enum UpdateIntervals: Int, CaseIterable, Identifiable {
|
||||
|
||||
case fiveSeconds = 5
|
||||
case tenSeconds = 10
|
||||
case fifteenSeconds = 15
|
||||
case thirtySeconds = 30
|
||||
case oneMinute = 60
|
||||
|
|
@ -118,6 +120,10 @@ enum UpdateIntervals: Int, CaseIterable, Identifiable {
|
|||
get {
|
||||
switch self {
|
||||
|
||||
case .fiveSeconds:
|
||||
return NSLocalizedString("interval.five.seconds", comment: "Five Seconds")
|
||||
case .tenSeconds:
|
||||
return NSLocalizedString("interval.ten.seconds", comment: "Ten Seconds")
|
||||
case .fifteenSeconds:
|
||||
return NSLocalizedString("interval.fifteen.seconds", comment: "Fifteen Seconds")
|
||||
case .thirtySeconds:
|
||||
|
|
|
|||
|
|
@ -2011,38 +2011,38 @@ extension BLEManager: CBCentralManagerDelegate {
|
|||
self.peripherals.removeAll(where: { $0.lastUpdate < visibleDuration})
|
||||
}
|
||||
|
||||
// func centralManager(_ central: CBCentralManager, willRestoreState dict: [String : Any]) {
|
||||
//
|
||||
// guard let peripherals = dict[CBCentralManagerRestoredStatePeripheralsKey] as? [CBPeripheral] else {
|
||||
// return
|
||||
// }
|
||||
// print(peripherals)
|
||||
// if peripherals.count > 0 {
|
||||
// //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.
|
||||
// print("Xcode Restore")
|
||||
//
|
||||
// case .connected: // Store for connection / requesting
|
||||
// // notifications when BT starts.
|
||||
// print("Actual restore")
|
||||
// //centralManager.connect(peripheral)
|
||||
// default: break
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// // connectedPeripheral.peripheral
|
||||
// //connectedPeripheral.peripheral = peripheral
|
||||
// //connectedPeripheral.peripheral.delegate = self
|
||||
// }
|
||||
// }
|
||||
// print("willRestoreState Hit!")
|
||||
// }
|
||||
func centralManager(_ central: CBCentralManager, willRestoreState dict: [String : Any]) {
|
||||
|
||||
guard let peripherals = dict[CBCentralManagerRestoredStatePeripheralsKey] as? [CBPeripheral] else {
|
||||
return
|
||||
}
|
||||
print(peripherals)
|
||||
if peripherals.count > 0 {
|
||||
//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.
|
||||
print("Xcode Restore")
|
||||
|
||||
case .connected: // Store for connection / requesting
|
||||
// notifications when BT starts.
|
||||
print("Actual restore")
|
||||
//centralManager.connect(peripheral)
|
||||
default: break
|
||||
}
|
||||
|
||||
|
||||
|
||||
// connectedPeripheral.peripheral
|
||||
//connectedPeripheral.peripheral = peripheral
|
||||
//connectedPeripheral.peripheral.delegate = self
|
||||
}
|
||||
}
|
||||
print("willRestoreState Hit!")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue