[iOS] Remove wifi SSID from metrics

Wifi SSID was never stored and was only used for additional verification
of wifi networkedness. Instead, we now do this on device and don't need
the SSID name.

IDFA was previously included in metrics events if the AdSupport framework was
linked.
This commit is contained in:
Jason Wray
2015-09-24 18:07:20 -04:00
committed by Minh Nguyễn
parent 8b6f928718
commit 6fb9c439bd

View File

@@ -1,11 +1,12 @@
#import "MGLMapboxEvents.h"
#import <UIKit/UIKit.h>
#import <SystemConfiguration/CaptiveNetwork.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>
#import <CoreLocation/CoreLocation.h>
#include <mbgl/platform/darwin/reachability.h>
#import "MGLAccountManager.h"
#import "NSProcessInfo+MGLAdditions.h"
#import "NSBundle+MGLAdditions.h"
@@ -55,7 +56,6 @@ const NSTimeInterval MGLFlushInterval = 60;
// All of the following properties are written to only from
// the main thread, but can be read on any thread.
//
@property (atomic) NSString *advertiserId;
@property (atomic) NSString *vendorId;
@property (atomic) NSString *model;
@property (atomic) NSString *iOSVersion;
@@ -68,23 +68,6 @@ const NSTimeInterval MGLFlushInterval = 60;
- (instancetype)init {
if (self = [super init]) {
// Dynamic detection of ASIdentifierManager from Mixpanel
// https://github.com/mixpanel/mixpanel-iphone/blob/master/LICENSE
_advertiserId = @"";
Class ASIdentifierManagerClass = NSClassFromString(@"ASIdentifierManager");
if (ASIdentifierManagerClass) {
SEL sharedManagerSelector = NSSelectorFromString(@"sharedManager");
id sharedManager = ((id (*)(id, SEL))[ASIdentifierManagerClass methodForSelector:sharedManagerSelector])(ASIdentifierManagerClass, sharedManagerSelector);
// Add check here
SEL isAdvertisingTrackingEnabledSelector = NSSelectorFromString(@"isAdvertisingTrackingEnabled");
BOOL trackingEnabled = ((BOOL (*)(id, SEL))[sharedManager methodForSelector:isAdvertisingTrackingEnabledSelector])(sharedManager, isAdvertisingTrackingEnabledSelector);
if (trackingEnabled) {
SEL advertisingIdentifierSelector = NSSelectorFromString(@"advertisingIdentifier");
NSUUID *uuid = ((NSUUID* (*)(id, SEL))[sharedManager methodForSelector:advertisingIdentifierSelector])(sharedManager, advertisingIdentifierSelector);
_advertiserId = [uuid UUIDString];
}
}
_vendorId = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
_model = [self sysInfoByName:"hw.machine"];
@@ -504,7 +487,6 @@ const NSTimeInterval MGLFlushInterval = 60;
[evt setObject:@(version) forKey:@"version"];
[evt setObject:[strongSelf.rfc3339DateFormatter stringFromDate:[NSDate date]] forKey:@"created"];
[evt setObject:strongSelf.instanceID forKey:@"instance"];
[evt setObject:strongSelf.data.advertiserId forKey:@"advertiserId"];
[evt setObject:strongSelf.data.vendorId forKey:@"vendorId"];
[evt setObject:strongSelf.appBundleId forKeyedSubscript:@"appBundleId"];
@@ -523,12 +505,8 @@ const NSTimeInterval MGLFlushInterval = 60;
[evt setObject:[NSNull null] forKey:@"cellularNetworkType"];
}
NSString *wifi = [strongSelf wifiNetworkName];
if (wifi) {
[evt setValue:wifi forKey:@"wifi"];
} else {
[evt setObject:[NSNull null] forKey:@"wifi"];
}
MGLReachability *reachability = [MGLReachability reachabilityForLocalWiFi];
[evt setValue:([reachability isReachableViaWiFi] ? @YES : @NO) forKey:@"wifi"];
[evt setValue:@([strongSelf contentSizeScale]) forKey:@"accessibilityFontScale"];
@@ -735,23 +713,6 @@ const NSTimeInterval MGLFlushInterval = 60;
return result;
}
// Can be called from any thread.
//
- (NSString *) wifiNetworkName {
NSString *ssid = nil;
CFArrayRef interfaces = CNCopySupportedInterfaces();
if (interfaces) {
NSDictionary *info = CFBridgingRelease(CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(interfaces, 0)));
if (info) {
ssid = info[@"SSID"];
}
CFRelease(interfaces);
}
return ssid;
}
// Can be called from any thread.
//
- (NSString *) currentCellularNetworkConnectionType {