commit | author | age
|
aca600
|
1 |
// Copyright 2022 Google LLC |
L |
2 |
// |
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 |
// you may not use this file except in compliance with the License. |
|
5 |
// You may obtain a copy of the License at |
|
6 |
// |
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
|
8 |
// |
|
9 |
// Unless required by applicable law or agreed to in writing, software |
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 |
// See the License for the specific language governing permissions and |
|
13 |
// limitations under the License. |
|
14 |
|
|
15 |
#import <Foundation/Foundation.h> |
|
16 |
|
|
17 |
NS_ASSUME_NONNULL_BEGIN |
|
18 |
|
|
19 |
/// The type of network that the device is running with. Values should correspond to the NetworkType |
|
20 |
/// values in android/play/playlog/proto/clientanalytics.proto |
|
21 |
typedef NS_ENUM(NSInteger, GULNetworkType) { |
|
22 |
GULNetworkTypeNone = -1, |
|
23 |
GULNetworkTypeMobile = 0, |
|
24 |
GULNetworkTypeWIFI = 1, |
|
25 |
}; |
|
26 |
|
|
27 |
/// Collection of utilities to read network status information |
|
28 |
@interface GULNetworkInfo : NSObject |
|
29 |
|
|
30 |
/// Returns the cellular mobile country code (mcc) if CoreTelephony is supported, otherwise nil |
|
31 |
+ (NSString *_Nullable)getNetworkMobileCountryCode; |
|
32 |
|
|
33 |
/// Returns the cellular mobile network code (mnc) if CoreTelephony is supported, otherwise nil |
|
34 |
+ (NSString *_Nullable)getNetworkMobileNetworkCode; |
|
35 |
|
|
36 |
/** |
|
37 |
* Returns the formatted MccMnc if the inputs are valid, otherwise nil |
|
38 |
* @param mcc The Mobile Country Code returned from `getNetworkMobileCountryCode` |
|
39 |
* @param mnc The Mobile Network Code returned from `getNetworkMobileNetworkCode` |
|
40 |
* @returns A string with the concatenated mccMnc if both inputs are valid, otherwise nil |
|
41 |
*/ |
|
42 |
+ (NSString *_Nullable)formatMcc:(NSString *_Nullable)mcc andMNC:(NSString *_Nullable)mnc; |
|
43 |
|
|
44 |
/// Returns an enum indicating the network type. The enum values should be easily transferrable to |
|
45 |
/// the NetworkType value in android/play/playlog/proto/clientanalytics.proto. Right now this always |
|
46 |
/// returns None on platforms other than iOS. This should be updated in the future to return Wi-Fi |
|
47 |
/// values for the other platforms when applicable. |
|
48 |
+ (GULNetworkType)getNetworkType; |
|
49 |
|
|
50 |
/// Returns a string indicating the radio access technology used by the app. The return value will |
|
51 |
/// be one of CTRadioAccess constants defined in |
|
52 |
/// https://developer.apple.com/documentation/coretelephony/cttelephonynetworkinfo/radio_access_technology_constants |
|
53 |
+ (NSString *)getNetworkRadioType; |
|
54 |
|
|
55 |
@end |
|
56 |
|
|
57 |
NS_ASSUME_NONNULL_END |