Bug fixes

This commit is contained in:
Garth Vander Houwen 2021-11-04 08:36:55 -07:00
parent c3a44c61e8
commit a02f2201d8
6 changed files with 38 additions and 37 deletions

View file

@ -72,7 +72,7 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
if central.state == .poweredOn {
isSwitchedOn = true
//startScanning()
startScanning()
}
else {
@ -114,22 +114,22 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
self.timeoutTimerCount += 1
if timeoutTimerCount == 6 {
if timeoutTimerCount == 10 {
if connectedPeripheral != nil && connectedPeripheral.peripheral.state != CBPeripheralState.connected {
if connectedPeripheral != nil {
self.centralManager?.cancelPeripheralConnection(connectedPeripheral.peripheral)
connectedNode = nil
connectedPeripheral = nil
if meshLoggingEnabled { Logger.log("BLE Connecting Timeout Timer disconnected orphaned radio: \(name) in state: \(connectedPeripheral.peripheral.state.rawValue)") }
}
self.lastConnectionError = "Timeout while connecting to \(name)."
print("BLE Connecting 2 Second Timeout Timer Fired \(timeoutTimerCount) Times and failed: \(name)")
if meshLoggingEnabled { Logger.log("BLE Connecting 2 Second Timeout Timer Fired \(timeoutTimerCount) Times and failed: \(name)") }
connectedNode = nil
connectedPeripheral = nil
self.lastConnectionError = "BLE Connecting Timeout after making \(timeoutTimerCount) attempts to connect to \(name)."
print("BLE Connecting Timeout after making \(timeoutTimerCount) attempts to connect to \(name).")
if meshLoggingEnabled { Logger.log("BLE Connecting Timeout after making \(timeoutTimerCount) attempts to connect to \(String(name)).") }
self.timeoutTimer?.invalidate()
self.timeoutTimerCount = 0
self.timeoutTimer?.invalidate()
}
else {
print("BLE Connecting 2 Second Timeout Timer Fired \(timeoutTimerCount) Time(s): \(name)")

View file

@ -29,7 +29,7 @@
<key>NSBluetoothAlwaysUsageDescription</key>
<string>We use bluetooth to connect to nearby Meshtastic Devices</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>Bluetooth is used to connect an iPhone to a user&apos;s meshtastic device to allow text messaging and location data for the mesh network.</string>
<string>Bluetooth is used to connect an iPhone to a user's meshtastic device to allow text messaging and location data for the mesh network.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>We use your location to center maps of the mesh</string>
<key>Privacy Bluetooth Always Usage Description</key>

View file

@ -6,11 +6,11 @@
<true/>
<key>com.apple.security.device.bluetooth</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
</dict>
</plist>

View file

@ -6,7 +6,7 @@ struct MeshtasticClientApp: App {
@ObservedObject private var bleManager: BLEManager = BLEManager()
@ObservedObject private var userSettings: UserSettings = UserSettings()
//let persistenceController = PersistenceController.shared
//@Environment(\.scenePhase) var scenePhase
@Environment(\.scenePhase) var scenePhase
var body: some Scene {
WindowGroup {
@ -15,18 +15,18 @@ struct MeshtasticClientApp: App {
.environmentObject(userSettings)
//.environment(\.managedObjectContext, persistenceController.container.viewContext)
}
//.onChange(of: scenePhase) { (newScenePhase) in
// switch newScenePhase {
// case .background:
// print("Scene is in the background")
// persistenceController.save()
// case .inactive:
// print("Scene is inactive")
// case .active:
// print("Scene is active")
// @unknown default:
// print("Apple must have changed something")
// }
//}
.onChange(of: scenePhase) { (newScenePhase) in
switch newScenePhase {
case .background:
print("Scene is in the background")
//persistenceController.save()
case .inactive:
print("Scene is inactive")
case .active:
print("Scene is active")
@unknown default:
print("Apple must have changed something")
}
}
}
}

View file

@ -1,16 +1,16 @@
import Foundation
import CoreData
extension NodeInfoEntity {
@nonobjc public class func createFetchRequest() -> NSFetchRequest<NodeInfoEntity> {
return NSFetchRequest<Commit>(entityName: "NodeInfoEntity")
}
//extension NodeInfoEntity {
// @nonobjc public class func createFetchRequest() -> NSFetchRequest<NodeInfoEntity> {
// return NSFetchRequest<Commit>(entityName: "NodeInfoEntity")
// }
@NSManaged public var id: UInt32
@NSManaged public var num: UInt32
@NSManaged public var sha: String
@NSManaged public var url: String
// @NSManaged public var id: UInt32
// @NSManaged public var num: UInt32
// @NSManaged public var sha: String
// @NSManaged public var url: String
}
//}

View file

@ -2,6 +2,7 @@
* Update NodeList SwipeAction Button to be role: Destructive
* Added com.apple.security.files.user-selected.read-write entitlement to AppSandbox for MacOS for Mesh log download
* Cleaned up bluetooth connecting timeout errors and logic, run 10 2 second timers now