UNPKG

1.56 kBtext/x-cView Raw
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
11NS_ASSUME_NONNULL_BEGIN
12
13// Based on the ConnectionType enum described in the W3C Network Information API spec
14// (https://wicg.github.io/netinfo/).
15static NSString *const RNCConnectionTypeUnknown = @"unknown";
16static NSString *const RNCConnectionTypeNone = @"none";
17static NSString *const RNCConnectionTypeWifi = @"wifi";
18static NSString *const RNCConnectionTypeCellular = @"cellular";
19static 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/).
23static NSString *const RNCCellularGeneration2g = @"2g";
24static NSString *const RNCCellularGeneration3g = @"3g";
25static NSString *const RNCCellularGeneration4g = @"4g";
26static 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
41NS_ASSUME_NONNULL_END