1 /** 2 * Copyright (c) Facebook, Inc. and its affiliates. 3 * 4 * This source code is licensed under the MIT license found in the 5 * LICENSE file in the root directory of this source tree. 6 */ 7 8 #import <Foundation/Foundation.h> 9 #import <SystemConfiguration/SystemConfiguration.h> 10 11 NS_ASSUME_NONNULL_BEGIN 12 13 // Based on the ConnectionType enum described in the W3C Network Information API spec 14 // (https://wicg.github.io/netinfo/). 15 static NSString *const RNCConnectionTypeUnknown = @"unknown"; 16 static NSString *const RNCConnectionTypeNone = @"none"; 17 static NSString *const RNCConnectionTypeWifi = @"wifi"; 18 static NSString *const RNCConnectionTypeCellular = @"cellular"; 19 static NSString *const RNCConnectionTypeEthernet = @"ethernet"; 20 21 // Based on the EffectiveConnectionType enum described in the W3C Network Information API spec 22 // (https://wicg.github.io/netinfo/). 23 static NSString *const RNCCellularGeneration2g = @"2g"; 24 static NSString *const RNCCellularGeneration3g = @"3g"; 25 static NSString *const RNCCellularGeneration4g = @"4g"; 26 static NSString *const RNCCellularGeneration5g = @"5g"; 27 28 @interface RNCConnectionState : NSObject 29 30 - (instancetype)init; 31 - (instancetype)initWithReachabilityFlags:(SCNetworkReachabilityFlags)flags; 32 - (BOOL)isEqualToConnectionState:(RNCConnectionState *)otherState; 33 34 @property (nonatomic, strong, readonly) NSString *type; 35 @property (nullable, nonatomic, strong, readonly) NSString *cellularGeneration; 36 @property (nonatomic, readonly) BOOL connected; 37 @property (nonatomic, readonly) BOOL expensive; 38 39 @end 40 41 NS_ASSUME_NONNULL_END 42