diff options
Diffstat (limited to 'platform/ios')
-rw-r--r-- | platform/ios/MGLMapboxEvents.m | 25 |
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]) { |