Start location updates more agressively.

This commit is contained in:
Garth Vander Houwen 2023-12-23 17:03:30 -08:00
parent 0dbc426c50
commit 6c8db4e381
4 changed files with 11 additions and 12 deletions

View file

@ -1486,7 +1486,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.2.16;
MARKETING_VERSION = 2.2.17;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
@ -1520,7 +1520,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.2.16;
MARKETING_VERSION = 2.2.17;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
@ -1642,7 +1642,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.2.16;
MARKETING_VERSION = 2.2.17;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -1675,7 +1675,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.2.16;
MARKETING_VERSION = 2.2.17;
PRODUCT_BUNDLE_IDENTIFIER = gvh.MeshtasticClient.Widgets;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";

View file

@ -39,7 +39,7 @@ import CoreLocation
private init() {
self.manager = CLLocationManager() // Creating a location manager instance is safe to call here in `MainActor`.
locationsArray = [CLLocation]()
enableSmartPosition = true
enableSmartPosition = false
}
func startLocationUpdates() {
@ -54,7 +54,6 @@ import CoreLocation
for try await update in updates {
if !self.updatesStarted { break } // End location updates by breaking out of the loop.
if let loc = update.location {
self.lastLocation = loc
self.isStationary = update.isStationary
self.count += 1
var locationAdded: Bool
@ -62,6 +61,7 @@ import CoreLocation
locationAdded = addLocation(loc)
} else {
locationsArray.append(loc)
self.lastLocation = loc
locationAdded = true
}
if !locationAdded {
@ -96,6 +96,7 @@ import CoreLocation
return false
}
locationsArray.append(location)
lastLocation = location
return true
}

View file

@ -18,11 +18,8 @@ class MeshtasticAppDelegate: NSObject, UIApplicationDelegate, UNUserNotification
UNUserNotificationCenter.current().delegate = self
if #available(iOS 17.0, macOS 14.0, *) {
let locationsHandler = LocationsHandler.shared
// If location updates were previously active, restart them after the background launch.
if locationsHandler.updatesStarted {
locationsHandler.startLocationUpdates()
}
locationsHandler.startLocationUpdates()
// If a background activity session was previously active, reinstantiate it after the background launch.
if locationsHandler.backgroundActivity {
locationsHandler.backgroundActivity = true

View file

@ -50,7 +50,8 @@ struct PositionLog: View {
Text(speed.formatted())
}
TableColumn("Heading") { position in
let heading = Measurement(value: Double(position.heading), unit: UnitAngle.degrees)
let degrees = Angle.degrees(Double(position.heading))
let heading = Measurement(value: degrees.degrees, unit: UnitAngle.degrees)
Text("\(heading.formatted())")
}
TableColumn("SNR") { position in