Skip to content

Commit 6929e8b

Browse files
committed
Remove references to deprecated CTCarrier
1 parent 871d431 commit 6929e8b

File tree

3 files changed

+0
-122
lines changed

3 files changed

+0
-122
lines changed

GoogleUtilities/Environment/NetworkInfo/GULNetworkInfo.m

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#if __has_include("CoreTelephony/CTTelephonyNetworkInfo.h") && !TARGET_OS_MACCATALYST && \
2121
!TARGET_OS_OSX && !TARGET_OS_TV && !TARGET_OS_WATCH
2222
#define TARGET_HAS_MOBILE_CONNECTIVITY
23-
#import <CoreTelephony/CTCarrier.h>
2423
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
2524
#import <SystemConfiguration/SystemConfiguration.h>
2625
#endif
@@ -38,61 +37,6 @@ + (CTTelephonyNetworkInfo *)getNetworkInfo {
3837
}
3938
#endif
4039

41-
+ (NSString *_Nullable)getNetworkMobileCountryCode {
42-
#ifdef TARGET_HAS_MOBILE_CONNECTIVITY
43-
CTTelephonyNetworkInfo *networkInfo = [GULNetworkInfo getNetworkInfo];
44-
#pragma clang diagnostic push
45-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
46-
CTCarrier *provider = networkInfo.subscriberCellularProvider;
47-
#pragma clang diagnostic push
48-
return provider.mobileCountryCode;
49-
#endif
50-
return nil;
51-
}
52-
53-
+ (NSString *_Nullable)getNetworkMobileNetworkCode {
54-
#ifdef TARGET_HAS_MOBILE_CONNECTIVITY
55-
CTTelephonyNetworkInfo *networkInfo = [GULNetworkInfo getNetworkInfo];
56-
#pragma clang diagnostic push
57-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
58-
CTCarrier *provider = networkInfo.subscriberCellularProvider;
59-
#pragma clang diagnostic push
60-
return provider.mobileNetworkCode;
61-
#endif
62-
return nil;
63-
}
64-
65-
/**
66-
* Returns the formatted MccMnc if the inputs are valid, otherwise nil
67-
* @param mcc The Mobile Country Code returned from `getNetworkMobileCountryCode`
68-
* @param mnc The Mobile Network Code returned from `getNetworkMobileNetworkCode`
69-
* @returns A string with the concatenated mccMnc if both inputs are valid, otherwise nil
70-
*/
71-
+ (NSString *_Nullable)formatMcc:(NSString *)mcc andMNC:(NSString *)mnc {
72-
// These are both nil if the target does not support mobile connectivity
73-
if (mcc == nil && mnc == nil) {
74-
return nil;
75-
}
76-
77-
if (mcc.length != 3 || mnc.length < 2 || mnc.length > 3) {
78-
return nil;
79-
}
80-
81-
// If the resulting appended mcc + mnc contains characters that are not
82-
// decimal digits, return nil
83-
static NSCharacterSet *notDigits;
84-
static dispatch_once_t token;
85-
dispatch_once(&token, ^{
86-
notDigits = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];
87-
});
88-
NSString *mccMnc = [mcc stringByAppendingString:mnc];
89-
if ([mccMnc rangeOfCharacterFromSet:notDigits].location != NSNotFound) {
90-
return nil;
91-
}
92-
93-
return mccMnc;
94-
}
95-
9640
+ (GULNetworkType)getNetworkType {
9741
GULNetworkType networkType = GULNetworkTypeNone;
9842

GoogleUtilities/Environment/Public/GoogleUtilities/GULNetworkInfo.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,6 @@ typedef NS_ENUM(NSInteger, GULNetworkType) {
2727
/// Collection of utilities to read network status information
2828
@interface GULNetworkInfo : NSObject
2929

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-
4430
/// Returns an enum indicating the network type. The enum values should be easily transferrable to
4531
/// the NetworkType value in android/play/playlog/proto/clientanalytics.proto. Right now this always
4632
/// returns None on platforms other than iOS. This should be updated in the future to return Wi-Fi

GoogleUtilities/Tests/SwiftUnit/GULNetworkInfoTests.swift

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)