Improve Live Location Sharing with reduced accuracy mode (#5461)

This commit is contained in:
Mauro
2026-04-22 13:12:03 +02:00
committed by GitHub
parent a17b097029
commit 55f82e69b1
4 changed files with 60 additions and 133 deletions
@@ -2209,6 +2209,11 @@ class CLLocationManagerMock: CLLocationManagerProtocol, @unchecked Sendable {
set(value) { underlyingDistanceFilter = value }
}
var underlyingDistanceFilter: CLLocationDistance!
var pausesLocationUpdatesAutomatically: Bool {
get { return underlyingPausesLocationUpdatesAutomatically }
set(value) { underlyingPausesLocationUpdatesAutomatically = value }
}
var underlyingPausesLocationUpdatesAutomatically: Bool!
var authorizationStatus: CLAuthorizationStatus {
get { return underlyingAuthorizationStatus }
set(value) { underlyingAuthorizationStatus = value }
@@ -2325,76 +2330,6 @@ class CLLocationManagerMock: CLLocationManagerProtocol, @unchecked Sendable {
stopUpdatingLocationCallsCount += 1
stopUpdatingLocationClosure?()
}
//MARK: - startMonitoringSignificantLocationChanges
var startMonitoringSignificantLocationChangesUnderlyingCallsCount = 0
var startMonitoringSignificantLocationChangesCallsCount: Int {
get {
if Thread.isMainThread {
return startMonitoringSignificantLocationChangesUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = startMonitoringSignificantLocationChangesUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
startMonitoringSignificantLocationChangesUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
startMonitoringSignificantLocationChangesUnderlyingCallsCount = newValue
}
}
}
}
var startMonitoringSignificantLocationChangesCalled: Bool {
return startMonitoringSignificantLocationChangesCallsCount > 0
}
var startMonitoringSignificantLocationChangesClosure: (() -> Void)?
func startMonitoringSignificantLocationChanges() {
startMonitoringSignificantLocationChangesCallsCount += 1
startMonitoringSignificantLocationChangesClosure?()
}
//MARK: - stopMonitoringSignificantLocationChanges
var stopMonitoringSignificantLocationChangesUnderlyingCallsCount = 0
var stopMonitoringSignificantLocationChangesCallsCount: Int {
get {
if Thread.isMainThread {
return stopMonitoringSignificantLocationChangesUnderlyingCallsCount
} else {
var returnValue: Int? = nil
DispatchQueue.main.sync {
returnValue = stopMonitoringSignificantLocationChangesUnderlyingCallsCount
}
return returnValue!
}
}
set {
if Thread.isMainThread {
stopMonitoringSignificantLocationChangesUnderlyingCallsCount = newValue
} else {
DispatchQueue.main.sync {
stopMonitoringSignificantLocationChangesUnderlyingCallsCount = newValue
}
}
}
}
var stopMonitoringSignificantLocationChangesCalled: Bool {
return stopMonitoringSignificantLocationChangesCallsCount > 0
}
var stopMonitoringSignificantLocationChangesClosure: (() -> Void)?
func stopMonitoringSignificantLocationChanges() {
stopMonitoringSignificantLocationChangesCallsCount += 1
stopMonitoringSignificantLocationChangesClosure?()
}
}
class CXProviderMock: CXProviderProtocol, @unchecked Sendable {