Skip to content

Commit 171f818

Browse files
authored
Remove references to deprecated CTCarrier for Sessions (#11144)
1 parent 4961c0b commit 171f818

File tree

10 files changed

+5
-90
lines changed

10 files changed

+5
-90
lines changed

Crashlytics/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Unreleased
2+
- [changed] Removed references to deprecated CTCarrier API in FirebaseSessions. (#11144)
3+
14
# 10.9.0
25
- [fixed] Updated upload-symbols to 3.15. Disabled dSYM uploads for Flutter
36
apps building with --obfuscate and added instructions for uploading through

FirebaseSessions/Sources/ApplicationInfo.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ protocol ApplicationInfoProtocol {
4747
/// Model of the device
4848
var deviceModel: String { get }
4949

50-
/// Validated Mobile Country Code and Mobile Network Code
51-
var mccMNC: String { get }
52-
5350
/// Network information for the application
5451
var networkInfo: NetworkInfoProtocol { get }
5552

@@ -93,10 +90,6 @@ class ApplicationInfo: ApplicationInfoProtocol {
9390
return GULAppEnvironmentUtil.deviceSimulatorModel() ?? ""
9491
}
9592

96-
var mccMNC: String {
97-
return FIRSESValidateMccMnc(networkInfo.mobileCountryCode, networkInfo.mobileNetworkCode) ?? ""
98-
}
99-
10093
var networkInfo: NetworkInfoProtocol {
10194
return networkInformation
10295
}

FirebaseSessions/Sources/Development/DevEventConsoleLogger.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ class DevEventConsoleLogger: EventGDTLoggerProtocol {
6262
mobile_subtype: \(proto.application_info.apple_app_info.network_connection_info
6363
.mobile_subtype.rawValue)
6464
os_name: \(proto.application_info.apple_app_info.os_name.description)
65-
mcc_mnc: \(proto.application_info.apple_app_info.mcc_mnc.description)
6665
log_environment: \(proto.application_info.log_environment)
6766
"""
6867

FirebaseSessions/Sources/NetworkInfo.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,12 @@ import Foundation
2626
#endif // SWIFT_PACKAGE
2727

2828
protocol NetworkInfoProtocol {
29-
var mobileCountryCode: String? { get }
30-
31-
var mobileNetworkCode: String? { get }
32-
3329
var networkType: GULNetworkType { get }
3430

3531
var mobileSubtype: String { get }
3632
}
3733

3834
class NetworkInfo: NetworkInfoProtocol {
39-
var mobileCountryCode: String? {
40-
return GULNetworkInfo.getNetworkMobileCountryCode()
41-
}
42-
43-
var mobileNetworkCode: String? {
44-
return GULNetworkInfo.getNetworkMobileNetworkCode()
45-
}
46-
4735
var networkType: GULNetworkType {
4836
return GULNetworkInfo.getNetworkType()
4937
}

FirebaseSessions/Sources/SessionStartEvent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class SessionStartEvent: NSObject, GDTCOREventDataObject {
130130
switch subscriber {
131131
case .Performance:
132132
let oldString = proto.application_info.apple_app_info.mcc_mnc
133-
proto.application_info.apple_app_info.mcc_mnc = makeProtoString(appInfo.mccMNC)
133+
proto.application_info.apple_app_info.mcc_mnc = makeProtoString("")
134134
nanopb_free(oldString)
135135
proto.application_info.apple_app_info.network_connection_info
136136
.network_type = convertNetworkType(networkType: appInfo.networkInfo.networkType)

FirebaseSessions/SourcesObjC/NanoPB/FIRSESNanoPBHelpers.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ pb_size_t FIRSESGetAppleApplicationInfoTag(void);
9191
/// private method in GULAppEnvironmentUtil.
9292
NSString* _Nullable FIRSESGetSysctlEntry(const char* sysctlKey);
9393

94-
/// Returns the validated MccMnc if it is available, or nil if the device does not support telephone
95-
NSString* _Nullable FIRSESValidateMccMnc(NSString* _Nullable mcc, NSString* _Nullable mnc);
96-
9794
NS_ASSUME_NONNULL_END
9895

9996
#endif /* FIRSESNanoPBHelpers_h */

FirebaseSessions/SourcesObjC/NanoPB/FIRSESNanoPBHelpers.m

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -182,29 +182,4 @@ pb_size_t FIRSESGetAppleApplicationInfoTag(void) {
182182
}
183183
}
184184

185-
NSString *_Nullable FIRSESValidateMccMnc(NSString *_Nullable mcc, NSString *_Nullable mnc) {
186-
// These are both nil if the target does not support mobile connectivity
187-
if (mcc == nil && mnc == nil) {
188-
return nil;
189-
}
190-
191-
if (mcc.length != 3 || mnc.length < 2 || mnc.length > 3) {
192-
return nil;
193-
}
194-
195-
// If the resulting appended mcc + mnc contains characters that are not
196-
// decimal digits, return nil
197-
static NSCharacterSet *notDigits;
198-
static dispatch_once_t token;
199-
dispatch_once(&token, ^{
200-
notDigits = [[NSCharacterSet decimalDigitCharacterSet] invertedSet];
201-
});
202-
NSString *mccMnc = [mcc stringByAppendingString:mnc];
203-
if ([mccMnc rangeOfCharacterFromSet:notDigits].location != NSNotFound) {
204-
return nil;
205-
}
206-
207-
return mccMnc;
208-
}
209-
210185
NS_ASSUME_NONNULL_END

FirebaseSessions/Tests/Unit/ApplicationInfoTests.swift

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,42 +27,6 @@ class ApplicationInfoTests: XCTestCase {
2727
appInfo = ApplicationInfo(appID: "testAppID", networkInfo: mockNetworkInfo)
2828
}
2929

30-
func test_mccMNC_validatesCorrectly() {
31-
let expectations: [(mobileCountryCode: String, mobileNetworkCode: String, expected: String)] = [
32-
("310", "004", "310004"),
33-
("310", "01", "31001"),
34-
("001", "50", "00150"),
35-
]
36-
37-
expectations
38-
.forEach { (mobileCountryCode: String, mobileNetworkCode: String, expected: String) in
39-
mockNetworkInfo.mobileCountryCode = mobileCountryCode
40-
mockNetworkInfo.mobileNetworkCode = mobileNetworkCode
41-
42-
XCTAssertEqual(appInfo.mccMNC, expected)
43-
}
44-
}
45-
46-
func test_mccMNC_isEmptyWhenInvalid() {
47-
let expectations: [(mobileCountryCode: String?, mobileNetworkCode: String?)] = [
48-
("3100", "004"), // MCC too long
49-
("31", "01"), // MCC too short
50-
("310", "0512"), // MNC too long
51-
("L00", "003"), // MCC contains non-decimal characters
52-
("300", "00T"), // MNC contains non-decimal characters
53-
(nil, nil), // Handle nils gracefully
54-
(nil, "001"),
55-
("310", nil),
56-
]
57-
58-
expectations.forEach { (mobileCountryCode: String?, mobileNetworkCode: String?) in
59-
mockNetworkInfo.mobileCountryCode = mobileCountryCode
60-
mockNetworkInfo.mobileNetworkCode = mobileNetworkCode
61-
62-
XCTAssertEqual(appInfo.mccMNC, "")
63-
}
64-
}
65-
6630
func test_LogEnvironment_hasProdAsDefault() {
6731
XCTAssertEqual(appInfo.environment, .prod)
6832
}

FirebaseSessions/Tests/Unit/Mocks/MockApplicationInfo.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ class MockApplicationInfo: ApplicationInfoProtocol {
3434

3535
var deviceModel: String = ""
3636

37-
var mccMNC: String = ""
38-
3937
var environment: DevEnvironment = .prod
4038

4139
var appBuildVersion: String = ""
@@ -52,7 +50,6 @@ class MockApplicationInfo: ApplicationInfoProtocol {
5250
static let testBundleID = "testBundleID"
5351
static let testSDKVersion = "testSDKVersion"
5452
static let testOSName = "ios"
55-
static let testMCCMNC = "testMCCMNC"
5653
static let testDeviceModel = "testDeviceModel"
5754
static let testEnvironment: DevEnvironment = .prod
5855
static let testAppBuildVersion = "testAppBuildVersion"
@@ -67,7 +64,6 @@ class MockApplicationInfo: ApplicationInfoProtocol {
6764
bundleID = MockApplicationInfo.testBundleID
6865
sdkVersion = MockApplicationInfo.testSDKVersion
6966
osName = MockApplicationInfo.testOSName
70-
mccMNC = MockApplicationInfo.testMCCMNC
7167
deviceModel = MockApplicationInfo.testDeviceModel
7268
environment = MockApplicationInfo.testEnvironment
7369
appBuildVersion = MockApplicationInfo.testAppBuildVersion

FirebaseSessions/Tests/Unit/SessionStartEventTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class SessionStartEventTests: XCTestCase {
268268
#endif
269269
assertEqualProtoString(
270270
proto.application_info.apple_app_info.mcc_mnc,
271-
expected: MockApplicationInfo.testMCCMNC,
271+
expected: "",
272272
fieldName: "mcc_mnc"
273273
)
274274
}

0 commit comments

Comments
 (0)