1818
1919#if defined(__APPLE__)
2020
21- #if TARGET_OS_IOS || TARGET_OS_TV
21+ #if TARGET_OS_IOS || TARGET_OS_TV || \
22+ (defined (TARGET_OS_VISION) && TARGET_OS_VISION)
2223#import < UIKit/UIKit.h>
2324#endif
2425
@@ -49,7 +50,7 @@ NetworkStatus ToNetworkStatus(SCNetworkReachabilityFlags flags) {
4950 return NetworkStatus::Unavailable;
5051 }
5152
52- #if TARGET_OS_IPHONE
53+ #if TARGET_OS_IPHONE || (defined(TARGET_OS_VISION) && TARGET_OS_VISION)
5354 if (flags & kSCNetworkReachabilityFlagsIsWWAN ) {
5455 return NetworkStatus::AvailableViaCellular;
5556 }
@@ -112,7 +113,8 @@ explicit ConnectivityMonitorApple(
112113 return ;
113114 }
114115
115- #if TARGET_OS_IOS || TARGET_OS_TV
116+ #if TARGET_OS_IOS || TARGET_OS_TV || \
117+ (defined (TARGET_OS_VISION) && TARGET_OS_VISION)
116118 this ->observer_ = [[NSNotificationCenter defaultCenter ]
117119 addObserverForName: UIApplicationWillEnterForegroundNotification
118120 object: nil
@@ -124,7 +126,8 @@ explicit ConnectivityMonitorApple(
124126 }
125127
126128 ~ConnectivityMonitorApple () {
127- #if TARGET_OS_IOS || TARGET_OS_TV
129+ #if TARGET_OS_IOS || TARGET_OS_TV || \
130+ (defined (TARGET_OS_VISION) && TARGET_OS_VISION)
128131 [[NSNotificationCenter defaultCenter ] removeObserver: this ->observer_];
129132#endif
130133
@@ -139,7 +142,8 @@ explicit ConnectivityMonitorApple(
139142 }
140143 }
141144
142- #if TARGET_OS_IOS || TARGET_OS_TV
145+ #if TARGET_OS_IOS || TARGET_OS_TV || \
146+ (defined (TARGET_OS_VISION) && TARGET_OS_VISION)
143147 void OnEnteredForeground () {
144148 SCNetworkReachabilityFlags flags{};
145149 if (!SCNetworkReachabilityGetFlags (reachability_, &flags)) return ;
@@ -167,7 +171,8 @@ void OnReachabilityChanged(SCNetworkReachabilityFlags flags) {
167171
168172 private:
169173 SCNetworkReachabilityRef reachability_ = nil ;
170- #if TARGET_OS_IOS || TARGET_OS_TV
174+ #if TARGET_OS_IOS || TARGET_OS_TV || \
175+ (defined (TARGET_OS_VISION) && TARGET_OS_VISION)
171176 id <NSObject > observer_ = nil ;
172177#endif
173178};
0 commit comments