Manos Chorianopoulos

add deviceInfo trackers

......@@ -902,111 +902,152 @@ static const char* jailbreak_apps[] =
///////////////////////////////////////////////////////////////////////////////
// TODO: Check
- (NSDictionary *)deviceInfo:(NSString *)newDeviceToken
{
CTTelephonyNetworkInfo *telephony = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = telephony.subscriberCellularProvider;
NSArray *prefLangs = [NSLocale preferredLanguages];
NSUInteger count = [prefLangs count];
NSString *langs = [NSString stringWithFormat:@"%@, %@, %@, %@, %@",
(count > 0)?[prefLangs objectAtIndex:0]:@"-",
(count > 1)?[prefLangs objectAtIndex:1]:@"-",
(count > 2)?[prefLangs objectAtIndex:2]:@"-",
(count > 3)?[prefLangs objectAtIndex:3]:@"-",
(count > 4)?[prefLangs objectAtIndex:4]:@"-"];
// - (NSDictionary *)deviceInfo:(NSString *)newDeviceToken
// {
// CTTelephonyNetworkInfo *telephony = [[CTTelephonyNetworkInfo alloc] init];
// CTCarrier *carrier = telephony.subscriberCellularProvider;
// NSArray *prefLangs = [NSLocale preferredLanguages];
// NSUInteger count = [prefLangs count];
// NSString *langs = [NSString stringWithFormat:@"%@, %@, %@, %@, %@",
// (count > 0)?[prefLangs objectAtIndex:0]:@"-",
// (count > 1)?[prefLangs objectAtIndex:1]:@"-",
// (count > 2)?[prefLangs objectAtIndex:2]:@"-",
// (count > 3)?[prefLangs objectAtIndex:3]:@"-",
// (count > 4)?[prefLangs objectAtIndex:4]:@"-"];
// NSMutableDictionary *deviceInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
// #if (DEBUG == 1)
// @"true" , @"development",
// #else
// @"false" , @"development",
// #endif
// nil];
// if ([[[UIDevice currentDevice] systemName] length] != 0) {
// [deviceInfo setValue:[[UIDevice currentDevice] systemName] forKey:@"ios_system_name"];
// }
// if ([[[UIDevice currentDevice] systemVersion] length] != 0) {
// [deviceInfo setValue:[[UIDevice currentDevice] systemVersion] forKey:@"ios_system_version"];
// }
// if ([[[UIDevice currentDevice] platformString] length] != 0) {
// [deviceInfo setValue:[[UIDevice currentDevice] platformString] forKey:@"ios_model"];
// }
// if ([[UIDevice currentDevice] platform].length != 0) {
// [deviceInfo setValue:[[UIDevice currentDevice] platform] forKey:@"ios_device_model"];
// }
// if ([[UIDevice currentDevice] deviceFamilyString].length != 0) {
// [deviceInfo setValue:[[UIDevice currentDevice] deviceFamilyString] forKey:@"device_family"];
// }
// if (carrier.carrierName.length != 0) {
// [deviceInfo setValue:carrier.carrierName forKey:@"carrier_name"];
// }
// if (carrier.isoCountryCode.length != 0) {
// [deviceInfo setValue:carrier.isoCountryCode forKey:@"ios_iso_country_code"];
// }
// if ([[[UIDevice currentDevice] localizedModel] length] != 0) {
// [deviceInfo setValue:[[UIDevice currentDevice] localizedModel] forKey:@"ios_localized_model"];
// }
// if ([[[NSLocale currentLocale] localeIdentifier] length] != 0) {
// [deviceInfo setValue:[[NSLocale currentLocale] localeIdentifier] forKey:@"ios_locale"];
// }
// if (langs.length != 0) {
// [deviceInfo setValue:langs forKey:@"ios_languages"];
// }
NSMutableDictionary *deviceInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#if (DEBUG == 1)
@"true" , @"development",
#else
@"false" , @"development",
#endif
nil];
// [deviceInfo setValue:@"apple" forKey:@"vendor"];
if ([[[UIDevice currentDevice] systemName] length] != 0) {
[deviceInfo setValue:[[UIDevice currentDevice] systemName] forKey:@"ios_system_name"];
}
if ([[[UIDevice currentDevice] systemVersion] length] != 0) {
[deviceInfo setValue:[[UIDevice currentDevice] systemVersion] forKey:@"ios_system_version"];
}
if ([[[UIDevice currentDevice] platformString] length] != 0) {
[deviceInfo setValue:[[UIDevice currentDevice] platformString] forKey:@"ios_model"];
}
if ([[UIDevice currentDevice] platform].length != 0) {
[deviceInfo setValue:[[UIDevice currentDevice] platform] forKey:@"ios_device_model"];
}
if ([[UIDevice currentDevice] deviceFamilyString].length != 0) {
[deviceInfo setValue:[[UIDevice currentDevice] deviceFamilyString] forKey:@"device_family"];
}
if (carrier.carrierName.length != 0) {
[deviceInfo setValue:carrier.carrierName forKey:@"carrier_name"];
}
if (carrier.isoCountryCode.length != 0) {
[deviceInfo setValue:carrier.isoCountryCode forKey:@"ios_iso_country_code"];
}
if ([[[UIDevice currentDevice] localizedModel] length] != 0) {
[deviceInfo setValue:[[UIDevice currentDevice] localizedModel] forKey:@"ios_localized_model"];
}
if ([[[NSLocale currentLocale] localeIdentifier] length] != 0) {
[deviceInfo setValue:[[NSLocale currentLocale] localeIdentifier] forKey:@"ios_locale"];
}
if (langs.length != 0) {
[deviceInfo setValue:langs forKey:@"ios_languages"];
}
// [deviceInfo setValue:@"ios" forKey:@"platform"];
[deviceInfo setValue:@"apple" forKey:@"vendor"];
// [deviceInfo setValue:[[UIDevice currentDevice] systemVersion] forKey:@"os_version"];
[deviceInfo setValue:@"ios" forKey:@"platform"];
// [deviceInfo setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"unique_device_id"];
[deviceInfo setValue:[[UIDevice currentDevice] systemVersion] forKey:@"os_version"];
// [deviceInfo setValue:[[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString] forKey:@"advertising_id"];
[deviceInfo setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"unique_device_id"];
// [deviceInfo setValue:[NSString stringWithFormat:@"%.0fx%.0f",([UIScreen mainScreen].bounds.size.width * [[UIScreen mainScreen] scale]),([UIScreen mainScreen].bounds.size.height * [[UIScreen mainScreen] scale])] forKey:@"screen_resolution"];
[deviceInfo setValue:[[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString] forKey:@"advertising_id"];
// #if (WARPLY_UDID_ENABLED == 1)
// if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)]) {
// [device_info setValue:[UIDevice currentDevice].uniqueIdentifier forKey:@"ios_unique_identifier"];
// }
// #endif
[deviceInfo setValue:[NSString stringWithFormat:@"%.0fx%.0f",([UIScreen mainScreen].bounds.size.width * [[UIScreen mainScreen] scale]),([UIScreen mainScreen].bounds.size.height * [[UIScreen mainScreen] scale])] forKey:@"screen_resolution"];
// [deviceInfo setValue:[self isJailBroken]?[NSNumber numberWithBool:YES] : [NSNumber numberWithBool:NO] forKey:@"ios_is_jailbroken_phone"];
#if (WARPLY_UDID_ENABLED == 1)
if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)]) {
[device_info setValue:[UIDevice currentDevice].uniqueIdentifier forKey:@"ios_unique_identifier"];
}
#endif
// if (newDeviceToken.length != 0) {
// [deviceInfo setValue:newDeviceToken forKey:@"device_token"];
// }
[deviceInfo setValue:[self isJailBroken]?[NSNumber numberWithBool:YES] : [NSNumber numberWithBool:NO] forKey:@"ios_is_jailbroken_phone"];
// [deviceInfo setValue:[NSNumber numberWithBool:!self.apsRegistrationError] forKey:@"ios_aps_entitlement_valid"];
if (newDeviceToken.length != 0) {
[deviceInfo setValue:newDeviceToken forKey:@"device_token"];
}
// NSUInteger rntypes;
[deviceInfo setValue:[NSNumber numberWithBool:!self.apsRegistrationError] forKey:@"ios_aps_entitlement_valid"];
// if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
// [deviceInfo setValue:[NSNumber numberWithInt:_notificationOptions] forKey:@"notification_types"];
// } else {
// [deviceInfo setValue:[NSNumber numberWithInt:_notificationTypes] forKey:@"notification_types"];
// }
NSUInteger rntypes;
// if (SYSTEM_VERSION_LESS_THAN(@"8.0")) {
// #pragma clang diagnostic push
// #pragma clang diagnostic ignored "-Wdeprecated-declarations"
// rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
// #pragma clang diagnostic pop
// }else{
// rntypes = [[[UIApplication sharedApplication] currentUserNotificationSettings] types];
// }
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
[deviceInfo setValue:[NSNumber numberWithInt:_notificationOptions] forKey:@"notification_types"];
} else {
[deviceInfo setValue:[NSNumber numberWithInt:_notificationTypes] forKey:@"notification_types"];
// [deviceInfo setValue:[NSNumber numberWithInteger:rntypes] forKey:@"user_enabled_notification_types"];
// // NSMutableDictionary *apple_uuids = [NSMutableDictionary dictionaryWithCapacity:2];
// [deviceInfo setValue:[NSNumber numberWithBool:[ASIdentifierManager sharedManager].advertisingTrackingEnabled] forKey:@"advertising_tracking_enabled"];
// [deviceInfo setValue:[[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString] forKey:@"advertising_identifier"];
// [deviceInfo setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"identifier_for_vendor"];
// // [deviceInfo setValue:apple_uuids forKey: @"ios_uuids"];
// NSLog(@"%@", deviceInfo);
// return deviceInfo;
// }
///////////////////////////////////////////////////////////////////////////////
- (NSDictionary *)deviceInfo:(NSString *)newDeviceToken
{
NSMutableDictionary *deviceInfo = [[NSMutableDictionary alloc] init];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults boolForKey:@"trackersEnabled"] == YES) {
[deviceInfo setValue:@"ios" forKey:@"platform"];
[deviceInfo setValue:@"Apple" forKey:@"manufacturer"];
if ([[UIDevice currentDevice] platform].length != 0) {
[deviceInfo setValue:[[UIDevice currentDevice] platform] forKey:@"ios_device_model"];
}
if (SYSTEM_VERSION_LESS_THAN(@"8.0")) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
#pragma clang diagnostic pop
}else{
rntypes = [[[UIApplication sharedApplication] currentUserNotificationSettings] types];
[deviceInfo setValue:[[UIDevice currentDevice] systemVersion] forKey:@"os_version"];
//Application Data Hack
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *CFBundleShortVersionString = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
if (CFBundleShortVersionString.length != 0) {
[deviceInfo setValue:CFBundleShortVersionString forKey:@"app_version"];
}
}
[deviceInfo setValue:[NSNumber numberWithInteger:rntypes] forKey:@"user_enabled_notification_types"];
[deviceInfo setValue:@"apple" forKey:@"vendor"];
// NSMutableDictionary *apple_uuids = [NSMutableDictionary dictionaryWithCapacity:2];
[deviceInfo setValue:[NSNumber numberWithBool:[ASIdentifierManager sharedManager].advertisingTrackingEnabled] forKey:@"advertising_tracking_enabled"];
[deviceInfo setValue:[[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString] forKey:@"advertising_identifier"];
[deviceInfo setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"identifier_for_vendor"];
[deviceInfo setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"unique_device_id"];
// [deviceInfo setValue:apple_uuids forKey: @"ios_uuids"];
if (newDeviceToken.length != 0) {
[deviceInfo setValue:newDeviceToken forKey:@"device_token"];
}
NSLog(@"%@", deviceInfo);
NSLog(@"deviceInfo: %@", deviceInfo);
return deviceInfo;
}
......