summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Leege <bleege@gmail.com>2015-04-06 17:36:54 -0500
committerBrad Leege <bleege@gmail.com>2015-04-06 17:36:54 -0500
commit17ded82d87ae46e788378e746acf4603c3647d12 (patch)
treeb7e8fa8564d1602d0e30eb613c41a65be11607fc
parent760c0f0f19aa00bdec063556d76ba5cceb150e93 (diff)
downloadqtlocation-mapboxgl-17ded82d87ae46e788378e746acf4603c3647d12.tar.gz
#1215 - Refactoring cellularNetworkType and wifi to support nil data if no cell type or wifi is found.
-rw-r--r--platform/ios/MGLMapboxEvents.m25
1 files changed, 17 insertions, 8 deletions
diff --git a/platform/ios/MGLMapboxEvents.m b/platform/ios/MGLMapboxEvents.m
index d21a723d94..c9c125dee1 100644
--- a/platform/ios/MGLMapboxEvents.m
+++ b/platform/ios/MGLMapboxEvents.m
@@ -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]) {