11import Foundation
22import Network
33
4- #if !os(watchOS) && !((swift(>=5.9) && os(visionOS)) && SENTRY_NO_UIKIT)
5-
64// MARK: - SentryConectivity
7- @objc
5+ #if DEBUG || SENTRY_TEST || SENTRY_TEST_CI
6+ @objc @_spi ( Private)
87public enum SentryConnectivity : Int {
98 case cellular
109 case wiFi
1110 case none
12-
11+ }
12+ #else
13+ @objc
14+ enum SentryConnectivity : Int {
15+ case cellular
16+ case wiFi
17+ case none
18+ }
19+ #endif // DEBUG || SENTRY_TEST || SENTRY_TEST_CI
20+
21+ extension SentryConnectivity {
1322 func toString( ) -> String {
1423 switch self {
1524 case . cellular:
@@ -68,7 +77,7 @@ public class SentryReachability: NSObject {
6877 }
6978#endif // DEBUG || SENTRY_TEST || SENTRY_TEST_CI
7079
71- if #available( iOS 12 . 0 , macOS 10 . 14 , tvOS 12 . 0 , * ) {
80+ if #available( iOS 12 . 0 , macOS 10 . 14 , tvOS 12 . 0 , visionOS 1 . 0 , watchOS 5 . 0 , * ) {
7281 // If we don't use the main queue to start the monitor, the app seems to freeze on iOS 14.8 (SauceLabs)
7382 // Also do it async to avoid blocking the main thread
7483 // Right now `SentryDispatchQueueWrapper.dispatchAsyncOnMainQueue` is not used because the SDK starts on the main thread,
@@ -125,7 +134,7 @@ public class SentryReachability: NSObject {
125134 currentConnectivity = . none
126135
127136 // Clean up NWPathMonitor
128- if #available( iOS 12 . 0 , macOS 10 . 14 , tvOS 12 . 0 , * ) {
137+ if #available( iOS 12 . 0 , macOS 10 . 14 , tvOS 12 . 0 , visionOS 1 . 0 , watchOS 5 . 0 , * ) {
129138 if let monitor = pathMonitor as? NWPathMonitor {
130139 SentrySDKLog . debug ( " Stopping NWPathMonitor " )
131140 monitor. cancel ( )
@@ -136,7 +145,7 @@ public class SentryReachability: NSObject {
136145 SentrySDKLog . debug ( " Cleaning up reachability queue. " )
137146 }
138147
139- @available ( iOS 12 . 0 , macOS 10 . 14 , tvOS 12 . 0 , * )
148+ @available ( iOS 12 . 0 , macOS 10 . 14 , tvOS 12 . 0 , visionOS 1 . 0 , watchOS 5 . 0 , * )
140149 private func pathUpdateHandler( _ path: NWPath ) {
141150 SentrySDKLog . debug ( " SentryPathUpdateHandler called with path status: \( path. status) " )
142151
@@ -151,7 +160,7 @@ public class SentryReachability: NSObject {
151160 connectivityCallback ( connectivity)
152161 }
153162
154- @available ( iOS 12 . 0 , macOS 10 . 14 , tvOS 12 . 0 , * )
163+ @available ( iOS 12 . 0 , macOS 10 . 14 , tvOS 12 . 0 , visionOS 1 . 0 , watchOS 5 . 0 , * )
155164 private func connectivityFromPath( _ path: NWPath ) -> SentryConnectivity {
156165 guard path. status == . satisfied else {
157166 return . none
@@ -211,7 +220,7 @@ public class SentryReachability: NSObject {
211220
212221// MARK: - Test utils
213222#if DEBUG || SENTRY_TEST || SENTRY_TEST_CI
214- @available ( iOS 12 . 0 , macOS 10 . 14 , tvOS 12 . 0 , * )
223+ @available ( iOS 12 . 0 , macOS 10 . 14 , tvOS 12 . 0 , visionOS 1 . 0 , watchOS 5 . 0 , * )
215224extension SentryReachability {
216225 @objc public func setReachabilityIgnoreActualCallback( _ value: Bool ) {
217226 SentrySDKLog . debug ( " Setting ignore actual callback to \( value) " )
@@ -229,5 +238,3 @@ extension SentryReachability {
229238 }
230239}
231240#endif // DEBUG || SENTRY_TEST || SENTRY_TEST_CI
232-
233- #endif // !os(watchOS) && !((swift(>=5.9) && os(visionOS)) && SENTRY_NO_UIKIT)
0 commit comments