Drop deprecated MapKit and ActivityKit calls, and a dead capture
- RoadDistanceService builds route endpoints with MKMapItem(location:address:) instead of the MKPlacemark path deprecated in iOS 26. - LiveActivityManager updates through ActivityContent, replacing the ActivityKit update(using:) call deprecated in iOS 16.2. - The location-update hook no longer captures an unused state object; the closure body already runs on self, so behaviour is unchanged.
This commit is contained in:
@@ -161,7 +161,7 @@ struct ContentView: View {
|
||||
}
|
||||
|
||||
private func installLocationUpdateHook() {
|
||||
locationManager.onLocationUpdate = { [weak monitor] in
|
||||
locationManager.onLocationUpdate = {
|
||||
self.updateAlertMonitor()
|
||||
// The Live Activity follows the same wake-ups — this hook
|
||||
// fires on every fix incl. background significant-change
|
||||
|
||||
@@ -79,7 +79,7 @@ enum LiveActivityManager {
|
||||
currentStartDate = nil
|
||||
start(attributes: attributes, state: state)
|
||||
} else {
|
||||
Task { await current.update(using: state) }
|
||||
Task { await current.update(ActivityContent(state: state, staleDate: nil)) }
|
||||
}
|
||||
} else {
|
||||
start(attributes: attributes, state: state)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
// every row at once; the mode must also be ON for any pass to run at all.
|
||||
|
||||
import Foundation
|
||||
import CoreLocation
|
||||
import MapKit
|
||||
import UIKit
|
||||
import WidgetKit
|
||||
@@ -407,8 +408,14 @@ enum RoadDistanceService {
|
||||
/// Driving distance (metres) between two coordinates via Apple Maps routing.
|
||||
private static func roadMeters(from: CLLocationCoordinate2D, to: CLLocationCoordinate2D) async -> Double? {
|
||||
let request = MKDirections.Request()
|
||||
request.source = MKMapItem(placemark: MKPlacemark(coordinate: from))
|
||||
request.destination = MKMapItem(placemark: MKPlacemark(coordinate: to))
|
||||
request.source = MKMapItem(
|
||||
location: CLLocation(latitude: from.latitude, longitude: from.longitude),
|
||||
address: nil
|
||||
)
|
||||
request.destination = MKMapItem(
|
||||
location: CLLocation(latitude: to.latitude, longitude: to.longitude),
|
||||
address: nil
|
||||
)
|
||||
request.transportType = .automobile
|
||||
request.requestsAlternateRoutes = false
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user