remove CoreTelephony

This commit is contained in:
edwinQQQ
2025-10-17 14:59:03 +08:00
parent 517365879a
commit 646a767e03
5 changed files with 4 additions and 61 deletions

View File

@@ -334,7 +334,6 @@ constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
@"os" : @"iOS",
@"osVersion" : [YYUtility systemVersion],
@"netType" : ([YYUtility networkStatus] == ReachableViaWiFi) ? @2 : @1,
@"ispType" : @([YYUtility carrierIdentifier]),
@"channel" : [YYUtility getAppSource] ? : @"",
@"model" : [YYUtility modelType],
@"deviceId" : [YYUtility deviceUniqueIdentification],
@@ -345,16 +344,10 @@ constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
if (!parmars||![parmars isKindOfClass:[NSDictionary class]]){
NSMutableDictionary *dic = [NSMutableDictionary dictionaryWithDictionary:defaultBasciParame];
if(![[YYUtility getMobileCountryCode] isEqualToString:@"65535"]){
[dic setValue:[YYUtility getMobileCountryCode] forKey:@"mcc"];
}
return dic;
}
NSMutableDictionary * dic = [NSMutableDictionary dictionaryWithDictionary:parmars];
if(![[YYUtility getMobileCountryCode] isEqualToString:@"65535"]){
[dic setValue:[YYUtility getMobileCountryCode] forKey:@"mcc"];
}
[dic addEntriesFromDictionary:defaultBasciParame];
if ([[AccountInfoStorage instance] getUid].length > 0) {

View File

@@ -5,9 +5,6 @@
#import "YYUtility.h"
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>
@implementation YYUtility (App)

View File

@@ -5,58 +5,17 @@
#import "YYUtility.h"
#import <CoreTelephony/CTCarrier.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import "CarrierIdentifier.h"
@import CoreTelephony;
static NSString * const kMobileCountryCode_China = @"460";
static NSSet * kMobileNetworkCodes_ChinaMobile;
static NSSet * kMobileNetworkCodes_ChinaUnicom;
static NSSet * kMobileNetworkCodes_ChinaTelecom;
@implementation YYUtility (Carrier)
+ (void)load
{
if (self == [YYUtility self]) {
kMobileNetworkCodes_ChinaMobile = [NSSet setWithObjects:@"00", @"02", @"07", nil];
kMobileNetworkCodes_ChinaUnicom = [NSSet setWithObjects:@"01", @"06", nil];
kMobileNetworkCodes_ChinaTelecom = [NSSet setWithObjects:@"03", @"05", nil];
}
}
+ (NSString *)getMobileCountryCode{
CTCarrier *carrier = [[CTTelephonyNetworkInfo alloc] init].subscriberCellularProvider;
NSString *code = carrier.mobileCountryCode;
return code;
return @"";
}
+ (NSInteger)carrierIdentifier
{
CTCarrier *carrier = [[CTTelephonyNetworkInfo alloc] init].subscriberCellularProvider;
CarrierIdentifier identifier = CarrierIdentifier_Unknown;
if (carrier.mobileCountryCode == nil || carrier.mobileNetworkCode == nil) {
return identifier;
}
if ([carrier.mobileCountryCode isEqualToString:kMobileCountryCode_China]) {
if ([kMobileNetworkCodes_ChinaMobile containsObject:carrier.mobileNetworkCode]) {
identifier = CarrierIdentifier_ChinaMobile;
} else if ([kMobileNetworkCodes_ChinaUnicom containsObject:carrier.mobileNetworkCode]) {
identifier = CarrierIdentifier_ChinaUnicom;
} else if ([kMobileNetworkCodes_ChinaTelecom containsObject:carrier.mobileNetworkCode]) {
identifier = CarrierIdentifier_ChinaTelecom;
}
} else {
identifier = CarrierIdentifier_Otherwise;
}
return identifier;
return CarrierIdentifier_Unknown;
}
@end

View File

@@ -23,8 +23,8 @@
@interface YYUtility (Carrier)
+ (NSString *)getMobileCountryCode;
+ (NSInteger)carrierIdentifier;
+ (NSString *)getMobileCountryCode DEPRECATED_MSG_ATTRIBUTE("CoreTelephony API deprecated, always returns empty string");
+ (NSInteger)carrierIdentifier DEPRECATED_MSG_ATTRIBUTE("CoreTelephony API deprecated, always returns CarrierIdentifier_Unknown");
@end