Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ios/RNCConnectionState.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
*/

#import "RNCConnectionState.h"
#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST
#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST && !TARGET_OS_VISION
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#endif

#if TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST
#if TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST || TARGET_OS_VISION
#include <ifaddrs.h>
#endif

Expand Down Expand Up @@ -41,7 +41,7 @@ - (instancetype)initWithReachabilityFlags:(SCNetworkReachabilityFlags)flags
(flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0) {
_type = RNCConnectionTypeNone;
}
#if !TARGET_OS_TV && !TARGET_OS_OSX && !TARGET_OS_MACCATALYST
#if !TARGET_OS_TV && !TARGET_OS_OSX && !TARGET_OS_MACCATALYST && !TARGET_OS_VISION
else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) {
_type = RNCConnectionTypeCellular;
_expensive = true;
Expand Down Expand Up @@ -73,7 +73,7 @@ - (instancetype)initWithReachabilityFlags:(SCNetworkReachabilityFlags)flags
#endif
else {
_type = RNCConnectionTypeWifi;
#if TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST
#if TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST || TARGET_OS_VISION
struct ifaddrs *interfaces = NULL;
struct ifaddrs *temp_addr = NULL;
int success = 0;
Expand Down
6 changes: 3 additions & 3 deletions ios/RNCNetInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <ifaddrs.h>
#include <arpa/inet.h>

#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST
#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST && !TARGET_OS_VISION
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#endif
Expand Down Expand Up @@ -130,7 +130,7 @@ - (NSMutableDictionary *)detailsFromInterface:(nonnull NSString *)requestedInter
} else if ([requestedInterface isEqualToString: RNCConnectionTypeWifi] || [requestedInterface isEqualToString: RNCConnectionTypeEthernet]) {
details[@"ipAddress"] = [self ipAddress] ?: NSNull.null;
details[@"subnet"] = [self subnet] ?: NSNull.null;
#if !TARGET_OS_TV && !TARGET_OS_OSX && !TARGET_OS_MACCATALYST
#if !TARGET_OS_TV && !TARGET_OS_OSX && !TARGET_OS_MACCATALYST && !TARGET_OS_VISION
/*
Without one of the conditions needed to use CNCopyCurrentNetworkInfo, it will leak memory.
Clients should only set the shouldFetchWiFiSSID to true after ensuring requirements are met to get (B)SSID.
Expand All @@ -146,7 +146,7 @@ Clients should only set the shouldFetchWiFiSSID to true after ensuring requireme

- (NSString *)carrier
{
#if (TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST)
#if (TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST || TARGET_OS_VISION)
return nil;
#else
CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];
Expand Down
2 changes: 1 addition & 1 deletion react-native-netinfo.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pod::Spec.new do |s|

s.authors = package['author']
s.homepage = package['homepage']
s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" }
s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14", :visionos => "1.0" }

s.source = { :git => "https://github.com/react-native-community/react-native-netinfo.git", :tag => "v#{s.version}" }
s.source_files = "ios/**/*.{h,m}"
Expand Down