#1215 - Refactoring cellularNetworkType and wifi to support nil data if no cell type or wifi is found.
This commit is contained in:
@@ -265,8 +265,21 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
|
||||
[evt setValue:@(100 * [UIDevice currentDevice].batteryLevel) forKey:@"batteryLevel"];
|
||||
[evt setValue:@(weakSelf.scale) forKey:@"resolution"];
|
||||
[evt setValue:weakSelf.carrier forKey:@"carrier"];
|
||||
[evt setValue:[weakSelf getCurrentCellularNetworkConnectionType] forKey:@"cellularNetworkType"];
|
||||
[evt setValue:[weakSelf getWifiNetworkName] forKey:@"wifi"];
|
||||
|
||||
NSString *cell = [weakSelf getCurrentCellularNetworkConnectionType];
|
||||
if (cell) {
|
||||
[evt setValue:cell forKey:@"cellularNetworkType"];
|
||||
} else {
|
||||
[evt setObject:[NSNull null] forKey:@"cellularNetworkType"];
|
||||
}
|
||||
|
||||
NSString *wifi = [weakSelf getWifiNetworkName];
|
||||
if (wifi) {
|
||||
[evt setValue:wifi forKey:@"wifi"];
|
||||
} else {
|
||||
[evt setObject:[NSNull null] forKey:@"wifi"];
|
||||
}
|
||||
|
||||
[evt setValue:@([weakSelf getContentSizeScale]) forKey:@"accessibilityFontScale"];
|
||||
|
||||
// Make Immutable Version
|
||||
@@ -505,17 +518,13 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
|
||||
//
|
||||
- (NSString *) getWifiNetworkName {
|
||||
|
||||
NSString *ssid = @"";
|
||||
NSString *ssid = nil;
|
||||
CFArrayRef interfaces = CNCopySupportedInterfaces();
|
||||
if (interfaces) {
|
||||
NSDictionary *info = (__bridge NSDictionary *)CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(interfaces, 0));
|
||||
if (info) {
|
||||
ssid = info[@"SSID"];
|
||||
} else {
|
||||
ssid = @"NONE";
|
||||
}
|
||||
} else {
|
||||
ssid = @"NONE";
|
||||
}
|
||||
|
||||
return ssid;
|
||||
@@ -528,7 +537,7 @@ NSString *const MGLEventGestureRotateStart = @"Rotation";
|
||||
NSString *radioTech = telephonyInfo.currentRadioAccessTechnology;
|
||||
|
||||
if (radioTech == nil) {
|
||||
return @"NONE";
|
||||
return nil;
|
||||
} else if ([radioTech isEqualToString:CTRadioAccessTechnologyGPRS]) {
|
||||
return @"GPRS";
|
||||
} else if ([radioTech isEqualToString:CTRadioAccessTechnologyEdge]) {
|
||||
|
||||
Reference in New Issue
Block a user