Skip to content

Commit 65ffc48

Browse files
authored
feat: add visionOS support (#714)
1 parent 30d8931 commit 65ffc48

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

ios/RNCConnectionState.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
*/
77

88
#import "RNCConnectionState.h"
9-
#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST
9+
#if !TARGET_OS_TV && !TARGET_OS_MACCATALYST && !TARGET_OS_VISION
1010
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
1111
#endif
1212

13-
#if TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST
13+
#if TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST || TARGET_OS_VISION
1414
#include <ifaddrs.h>
1515
#endif
1616

@@ -41,7 +41,7 @@ - (instancetype)initWithReachabilityFlags:(SCNetworkReachabilityFlags)flags
4141
(flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0) {
4242
_type = RNCConnectionTypeNone;
4343
}
44-
#if !TARGET_OS_TV && !TARGET_OS_OSX && !TARGET_OS_MACCATALYST
44+
#if !TARGET_OS_TV && !TARGET_OS_OSX && !TARGET_OS_MACCATALYST && !TARGET_OS_VISION
4545
else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) {
4646
_type = RNCConnectionTypeCellular;
4747
_expensive = true;
@@ -73,7 +73,7 @@ - (instancetype)initWithReachabilityFlags:(SCNetworkReachabilityFlags)flags
7373
#endif
7474
else {
7575
_type = RNCConnectionTypeWifi;
76-
#if TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST
76+
#if TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST || TARGET_OS_VISION
7777
struct ifaddrs *interfaces = NULL;
7878
struct ifaddrs *temp_addr = NULL;
7979
int success = 0;

ios/RNCNetInfo.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <ifaddrs.h>
1212
#include <arpa/inet.h>
1313

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

147147
- (NSString *)carrier
148148
{
149-
#if (TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST)
149+
#if (TARGET_OS_TV || TARGET_OS_OSX || TARGET_OS_MACCATALYST || TARGET_OS_VISION)
150150
return nil;
151151
#else
152152
CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init];

react-native-netinfo.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
1010

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

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy