@@ -34,6 +34,7 @@ public typealias HeadingMonitorStream = AsyncStream<HeadingMonitorEvent>
3434public typealias AuthorizationStream = AsyncStream < AuthorizationEvent >
3535public typealias AccuracyAuthorizationStream = AsyncStream < AccuracyAuthorizationEvent >
3636@available ( watchOS, unavailable)
37+ @available ( tvOS, unavailable)
3738public typealias BeaconsRangingStream = AsyncStream < BeaconRangeEvent >
3839
3940public final class AsyncLocationManager {
@@ -51,7 +52,9 @@ public final class AsyncLocationManager {
5152 locationDelegate = LocationDelegate ( delegateProxy: proxyDelegate)
5253 self . locationManager. delegate = locationDelegate
5354 self . locationManager. desiredAccuracy = desiredAccuracy. convertingAccuracy
55+ #if !os(tvOS)
5456 self . locationManager. allowsBackgroundLocationUpdates = allowsBackgroundLocationUpdates
57+ #endif
5558 }
5659
5760
@@ -64,7 +67,7 @@ public final class AsyncLocationManager {
6467
6568 @available ( watchOS 6 . 0 , * )
6669 public func getAuthorizationStatus( ) -> CLAuthorizationStatus {
67- if #available( iOS 14 , watchOS 7 , * ) {
70+ if #available( iOS 14 , tvOS 14 , watchOS 7 , * ) {
6871 return locationManager. authorizationStatus
6972 } else {
7073 return CLLocationManager . authorizationStatus ( )
@@ -116,7 +119,7 @@ public final class AsyncLocationManager {
116119 proxyDelegate. cancel ( for: AccuracyAuthorizationMonitoringPerformer . self)
117120 }
118121
119- @available ( iOS 14 , watchOS 7 , * )
122+ @available ( iOS 14 , tvOS 14 , watchOS 7 , * )
120123 public func getAccuracyAuthorization( ) -> CLAccuracyAuthorization {
121124 locationManager. accuracyAuthorization
122125 }
@@ -125,6 +128,7 @@ public final class AsyncLocationManager {
125128 locationManager. desiredAccuracy = newAccuracy. convertingAccuracy
126129 }
127130
131+ @available ( tvOS, unavailable)
128132 public func updateAllowsBackgroundLocationUpdates( with newAllows: Bool ) {
129133 locationManager. allowsBackgroundLocationUpdates = newAllows
130134 }
@@ -149,7 +153,7 @@ public final class AsyncLocationManager {
149153 } )
150154 }
151155
152- #if !APPCLIP
156+ #if !APPCLIP && !os(tvOS)
153157 @available ( * , deprecated, message: " Use new function requestPermission(with:) " )
154158 @available ( watchOS 7 . 0 , * )
155159 @available ( iOS 14 , * )
@@ -195,11 +199,12 @@ public final class AsyncLocationManager {
195199 }
196200 }
197201
198- @available ( iOS 14 , watchOS 7 , * )
202+ @available ( iOS 14 , tvOS 14 , watchOS 7 , * )
199203 public func requestTemporaryFullAccuracyAuthorization( purposeKey: String ) async throws -> CLAccuracyAuthorization ? {
200204 try await locationPermissionTemporaryFullAccuracy ( purposeKey: purposeKey)
201205 }
202206
207+ @available ( tvOS, unavailable)
203208 public func startUpdatingLocation( ) async -> LocationStream {
204209 let monitoringPerformer = MonitoringUpdateLocationPerformer ( )
205210 return LocationStream { streamContinuation in
@@ -231,6 +236,7 @@ public final class AsyncLocationManager {
231236 }
232237
233238 @available ( watchOS, unavailable)
239+ @available ( tvOS, unavailable)
234240 public func startMonitoring( for region: CLRegion ) async -> RegionMonitoringStream {
235241 let performer = RegionMonitoringPerformer ( region: region)
236242 return RegionMonitoringStream { streamContinuation in
@@ -244,6 +250,7 @@ public final class AsyncLocationManager {
244250 }
245251
246252 @available ( watchOS, unavailable)
253+ @available ( tvOS, unavailable)
247254 public func stopMonitoring( for region: CLRegion ) {
248255 proxyDelegate. cancel ( for: RegionMonitoringPerformer . self) { regionMonitoring in
249256 guard let regionPerformer = regionMonitoring as? RegionMonitoringPerformer else { return false }
@@ -253,6 +260,7 @@ public final class AsyncLocationManager {
253260 }
254261
255262 @available ( watchOS, unavailable)
263+ @available ( tvOS, unavailable)
256264 public func startMonitoringVisit( ) async -> VisitMonitoringStream {
257265 let performer = VisitMonitoringPerformer ( )
258266 return VisitMonitoringStream { stream in
@@ -266,6 +274,7 @@ public final class AsyncLocationManager {
266274 }
267275
268276 @available ( watchOS, unavailable)
277+ @available ( tvOS, unavailable)
269278 public func stopMonitoringVisit( ) {
270279 proxyDelegate. cancel ( for: VisitMonitoringPerformer . self)
271280 locationManager. stopMonitoringVisits ( )
@@ -292,6 +301,7 @@ public final class AsyncLocationManager {
292301#endif
293302
294303 @available ( watchOS, unavailable)
304+ @available ( tvOS, unavailable)
295305 public func startRangingBeacons( satisfying: CLBeaconIdentityConstraint ) async -> BeaconsRangingStream {
296306 let performer = BeaconsRangePerformer ( satisfying: satisfying)
297307 return BeaconsRangingStream { stream in
@@ -305,6 +315,7 @@ public final class AsyncLocationManager {
305315 }
306316
307317 @available ( watchOS, unavailable)
318+ @available ( tvOS, unavailable)
308319 public func stopRangingBeacons( satisfying: CLBeaconIdentityConstraint ) {
309320 proxyDelegate. cancel ( for: BeaconsRangePerformer . self) { beaconsMonitoring in
310321 guard let beaconsPerformer = beaconsMonitoring as? BeaconsRangePerformer else { return false }
@@ -346,12 +357,14 @@ extension AsyncLocationManager {
346357 locationManager. requestAlwaysAuthorization ( )
347358 }
348359#else
349- if #available( iOS 14 , watchOS 7 , * ) , locationManager. authorizationStatus != . notDetermined && locationManager. authorizationStatus != . authorizedWhenInUse {
360+ if #available( iOS 14 , tvOS 14 , watchOS 7 , * ) , locationManager. authorizationStatus != . notDetermined && locationManager. authorizationStatus != . authorizedWhenInUse {
350361 continuation. resume ( with: . success( locationManager. authorizationStatus) )
351362 } else {
363+ #if !os(tvOS)
352364 authorizationPerformer. linkContinuation ( continuation)
353365 proxyDelegate. addPerformer ( authorizationPerformer)
354366 locationManager. requestAlwaysAuthorization ( )
367+ #endif
355368 }
356369#endif
357370 }
@@ -360,7 +373,7 @@ extension AsyncLocationManager {
360373 } )
361374 }
362375
363- @available ( iOS 14 , watchOS 7 , * )
376+ @available ( iOS 14 , tvOS 14 , watchOS 7 , * )
364377 private func locationPermissionTemporaryFullAccuracy( purposeKey: String ) async throws -> CLAccuracyAuthorization ? {
365378 let authorizationPerformer = RequestAccuracyAuthorizationPerformer ( )
366379 return try await withTaskCancellationHandler ( operation: {
0 commit comments