#1033 - Adding wifi network name attribute
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
|
||||
#import <CoreTelephony/CTCarrier.h>
|
||||
#include <sys/sysctl.h>
|
||||
#import <SystemConfiguration/CaptiveNetwork.h>
|
||||
|
||||
@interface MGLMapboxEvents()
|
||||
|
||||
@@ -129,6 +130,7 @@ NSNumber *scale;
|
||||
[evt setValue:[[NSNumber alloc] initWithFloat:(100 * [UIDevice currentDevice].batteryLevel)] forKey:@"batteryLevel"];
|
||||
[evt setValue:scale forKey:@"resolution"];
|
||||
[evt setValue:carrier forKey:@"carrier"];
|
||||
[evt setValue:[self getWifiNetworkName] forKey:@"wifi"];
|
||||
[evt setValue:[NSNumber numberWithInt:[self getContentSizeScale]] forKey:@"accessibilityFontScale"];
|
||||
|
||||
for (NSString *key in [attributeDictionary allKeys]) {
|
||||
@@ -294,4 +296,23 @@ NSNumber *scale;
|
||||
return results;
|
||||
}
|
||||
|
||||
- (NSString *) getWifiNetworkName {
|
||||
|
||||
NSString *ssid = @"";
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user