UNPKG

1.5 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";
26
27@interface RNCConnectionState : NSObject
28
29- (instancetype)init;
30- (instancetype)initWithReachabilityFlags:(SCNetworkReachabilityFlags)flags;
31- (BOOL)isEqualToConnectionState:(RNCConnectionState *)otherState;
32
33@property (nonatomic, strong, readonly) NSString *type;
34@property (nullable, nonatomic, strong, readonly) NSString *cellularGeneration;
35@property (nonatomic, readonly) BOOL connected;
36@property (nonatomic, readonly) BOOL expensive;
37
38@end
39
40NS_ASSUME_NONNULL_END