|
|
@@ -18,8 +18,7 @@
|
|
|
|
|
|
#if defined(__APPLE__)
|
|
|
|
|
|
-#if TARGET_OS_IOS || TARGET_OS_TV || \
|
|
|
- (defined(TARGET_OS_VISION) && TARGET_OS_VISION)
|
|
|
+#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
|
|
|
#import <UIKit/UIKit.h>
|
|
|
#endif
|
|
|
|
|
|
@@ -50,7 +49,7 @@ NetworkStatus ToNetworkStatus(SCNetworkReachabilityFlags flags) {
|
|
|
return NetworkStatus::Unavailable;
|
|
|
}
|
|
|
|
|
|
-#if TARGET_OS_IPHONE || (defined(TARGET_OS_VISION) && TARGET_OS_VISION)
|
|
|
+#if TARGET_OS_IPHONE || TARGET_OS_VISION
|
|
|
if (flags & kSCNetworkReachabilityFlagsIsWWAN) {
|
|
|
return NetworkStatus::AvailableViaCellular;
|
|
|
}
|
|
|
@@ -113,8 +112,7 @@ class ConnectivityMonitorApple : public ConnectivityMonitor {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-#if TARGET_OS_IOS || TARGET_OS_TV || \
|
|
|
- (defined(TARGET_OS_VISION) && TARGET_OS_VISION)
|
|
|
+#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
|
|
|
this->observer_ = [[NSNotificationCenter defaultCenter]
|
|
|
addObserverForName:UIApplicationWillEnterForegroundNotification
|
|
|
object:nil
|
|
|
@@ -126,8 +124,7 @@ class ConnectivityMonitorApple : public ConnectivityMonitor {
|
|
|
}
|
|
|
|
|
|
~ConnectivityMonitorApple() {
|
|
|
-#if TARGET_OS_IOS || TARGET_OS_TV || \
|
|
|
- (defined(TARGET_OS_VISION) && TARGET_OS_VISION)
|
|
|
+#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:this->observer_];
|
|
|
#endif
|
|
|
|
|
|
@@ -142,8 +139,7 @@ class ConnectivityMonitorApple : public ConnectivityMonitor {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#if TARGET_OS_IOS || TARGET_OS_TV || \
|
|
|
- (defined(TARGET_OS_VISION) && TARGET_OS_VISION)
|
|
|
+#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
|
|
|
void OnEnteredForeground() {
|
|
|
SCNetworkReachabilityFlags flags{};
|
|
|
if (!SCNetworkReachabilityGetFlags(reachability_, &flags)) return;
|
|
|
@@ -171,8 +167,7 @@ class ConnectivityMonitorApple : public ConnectivityMonitor {
|
|
|
|
|
|
private:
|
|
|
SCNetworkReachabilityRef reachability_ = nil;
|
|
|
-#if TARGET_OS_IOS || TARGET_OS_TV || \
|
|
|
- (defined(TARGET_OS_VISION) && TARGET_OS_VISION)
|
|
|
+#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
|
|
|
id<NSObject> observer_ = nil;
|
|
|
#endif
|
|
|
};
|