Manos Chorianopoulos

add deviceInfo trackers

...@@ -902,111 +902,152 @@ static const char* jailbreak_apps[] = ...@@ -902,111 +902,152 @@ static const char* jailbreak_apps[] =
902 902
903 /////////////////////////////////////////////////////////////////////////////// 903 ///////////////////////////////////////////////////////////////////////////////
904 // TODO: Check 904 // TODO: Check
905 -- (NSDictionary *)deviceInfo:(NSString *)newDeviceToken 905 +// - (NSDictionary *)deviceInfo:(NSString *)newDeviceToken
906 -{ 906 +// {
907 - CTTelephonyNetworkInfo *telephony = [[CTTelephonyNetworkInfo alloc] init]; 907 +// CTTelephonyNetworkInfo *telephony = [[CTTelephonyNetworkInfo alloc] init];
908 - CTCarrier *carrier = telephony.subscriberCellularProvider; 908 +// CTCarrier *carrier = telephony.subscriberCellularProvider;
909 - NSArray *prefLangs = [NSLocale preferredLanguages]; 909 +// NSArray *prefLangs = [NSLocale preferredLanguages];
910 - NSUInteger count = [prefLangs count]; 910 +// NSUInteger count = [prefLangs count];
911 - NSString *langs = [NSString stringWithFormat:@"%@, %@, %@, %@, %@", 911 +// NSString *langs = [NSString stringWithFormat:@"%@, %@, %@, %@, %@",
912 - (count > 0)?[prefLangs objectAtIndex:0]:@"-", 912 +// (count > 0)?[prefLangs objectAtIndex:0]:@"-",
913 - (count > 1)?[prefLangs objectAtIndex:1]:@"-", 913 +// (count > 1)?[prefLangs objectAtIndex:1]:@"-",
914 - (count > 2)?[prefLangs objectAtIndex:2]:@"-", 914 +// (count > 2)?[prefLangs objectAtIndex:2]:@"-",
915 - (count > 3)?[prefLangs objectAtIndex:3]:@"-", 915 +// (count > 3)?[prefLangs objectAtIndex:3]:@"-",
916 - (count > 4)?[prefLangs objectAtIndex:4]:@"-"]; 916 +// (count > 4)?[prefLangs objectAtIndex:4]:@"-"];
917 - 917 +
918 - NSMutableDictionary *deviceInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys: 918 +// NSMutableDictionary *deviceInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
919 -#if (DEBUG == 1) 919 +// #if (DEBUG == 1)
920 - @"true" , @"development", 920 +// @"true" , @"development",
921 -#else 921 +// #else
922 - @"false" , @"development", 922 +// @"false" , @"development",
923 -#endif 923 +// #endif
924 - nil]; 924 +// nil];
925 - 925 +
926 - if ([[[UIDevice currentDevice] systemName] length] != 0) { 926 +// if ([[[UIDevice currentDevice] systemName] length] != 0) {
927 - [deviceInfo setValue:[[UIDevice currentDevice] systemName] forKey:@"ios_system_name"]; 927 +// [deviceInfo setValue:[[UIDevice currentDevice] systemName] forKey:@"ios_system_name"];
928 - } 928 +// }
929 - if ([[[UIDevice currentDevice] systemVersion] length] != 0) { 929 +// if ([[[UIDevice currentDevice] systemVersion] length] != 0) {
930 - [deviceInfo setValue:[[UIDevice currentDevice] systemVersion] forKey:@"ios_system_version"]; 930 +// [deviceInfo setValue:[[UIDevice currentDevice] systemVersion] forKey:@"ios_system_version"];
931 - } 931 +// }
932 - if ([[[UIDevice currentDevice] platformString] length] != 0) { 932 +// if ([[[UIDevice currentDevice] platformString] length] != 0) {
933 - [deviceInfo setValue:[[UIDevice currentDevice] platformString] forKey:@"ios_model"]; 933 +// [deviceInfo setValue:[[UIDevice currentDevice] platformString] forKey:@"ios_model"];
934 - } 934 +// }
935 - if ([[UIDevice currentDevice] platform].length != 0) { 935 +// if ([[UIDevice currentDevice] platform].length != 0) {
936 - [deviceInfo setValue:[[UIDevice currentDevice] platform] forKey:@"ios_device_model"]; 936 +// [deviceInfo setValue:[[UIDevice currentDevice] platform] forKey:@"ios_device_model"];
937 - } 937 +// }
938 - if ([[UIDevice currentDevice] deviceFamilyString].length != 0) { 938 +// if ([[UIDevice currentDevice] deviceFamilyString].length != 0) {
939 - [deviceInfo setValue:[[UIDevice currentDevice] deviceFamilyString] forKey:@"device_family"]; 939 +// [deviceInfo setValue:[[UIDevice currentDevice] deviceFamilyString] forKey:@"device_family"];
940 - } 940 +// }
941 - if (carrier.carrierName.length != 0) { 941 +// if (carrier.carrierName.length != 0) {
942 - [deviceInfo setValue:carrier.carrierName forKey:@"carrier_name"]; 942 +// [deviceInfo setValue:carrier.carrierName forKey:@"carrier_name"];
943 - } 943 +// }
944 - if (carrier.isoCountryCode.length != 0) { 944 +// if (carrier.isoCountryCode.length != 0) {
945 - [deviceInfo setValue:carrier.isoCountryCode forKey:@"ios_iso_country_code"]; 945 +// [deviceInfo setValue:carrier.isoCountryCode forKey:@"ios_iso_country_code"];
946 - } 946 +// }
947 - if ([[[UIDevice currentDevice] localizedModel] length] != 0) { 947 +// if ([[[UIDevice currentDevice] localizedModel] length] != 0) {
948 - [deviceInfo setValue:[[UIDevice currentDevice] localizedModel] forKey:@"ios_localized_model"]; 948 +// [deviceInfo setValue:[[UIDevice currentDevice] localizedModel] forKey:@"ios_localized_model"];
949 - } 949 +// }
950 - if ([[[NSLocale currentLocale] localeIdentifier] length] != 0) { 950 +// if ([[[NSLocale currentLocale] localeIdentifier] length] != 0) {
951 - [deviceInfo setValue:[[NSLocale currentLocale] localeIdentifier] forKey:@"ios_locale"]; 951 +// [deviceInfo setValue:[[NSLocale currentLocale] localeIdentifier] forKey:@"ios_locale"];
952 - } 952 +// }
953 - if (langs.length != 0) { 953 +// if (langs.length != 0) {
954 - [deviceInfo setValue:langs forKey:@"ios_languages"]; 954 +// [deviceInfo setValue:langs forKey:@"ios_languages"];
955 - } 955 +// }
956 956
957 - [deviceInfo setValue:@"apple" forKey:@"vendor"]; 957 +// [deviceInfo setValue:@"apple" forKey:@"vendor"];
958 958
959 - [deviceInfo setValue:@"ios" forKey:@"platform"]; 959 +// [deviceInfo setValue:@"ios" forKey:@"platform"];
960 960
961 - [deviceInfo setValue:[[UIDevice currentDevice] systemVersion] forKey:@"os_version"]; 961 +// [deviceInfo setValue:[[UIDevice currentDevice] systemVersion] forKey:@"os_version"];
962 962
963 - [deviceInfo setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"unique_device_id"]; 963 +// [deviceInfo setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"unique_device_id"];
964 964
965 - [deviceInfo setValue:[[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString] forKey:@"advertising_id"]; 965 +// [deviceInfo setValue:[[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString] forKey:@"advertising_id"];
966 966
967 - [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"]; 967 +// [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"];
968 968
969 -#if (WARPLY_UDID_ENABLED == 1) 969 +// #if (WARPLY_UDID_ENABLED == 1)
970 - if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)]) { 970 +// if ([[UIDevice currentDevice] respondsToSelector:@selector(uniqueIdentifier)]) {
971 - [device_info setValue:[UIDevice currentDevice].uniqueIdentifier forKey:@"ios_unique_identifier"]; 971 +// [device_info setValue:[UIDevice currentDevice].uniqueIdentifier forKey:@"ios_unique_identifier"];
972 - } 972 +// }
973 -#endif 973 +// #endif
974 974
975 - [deviceInfo setValue:[self isJailBroken]?[NSNumber numberWithBool:YES] : [NSNumber numberWithBool:NO] forKey:@"ios_is_jailbroken_phone"]; 975 +// [deviceInfo setValue:[self isJailBroken]?[NSNumber numberWithBool:YES] : [NSNumber numberWithBool:NO] forKey:@"ios_is_jailbroken_phone"];
976 976
977 - if (newDeviceToken.length != 0) { 977 +// if (newDeviceToken.length != 0) {
978 - [deviceInfo setValue:newDeviceToken forKey:@"device_token"]; 978 +// [deviceInfo setValue:newDeviceToken forKey:@"device_token"];
979 - } 979 +// }
980 980
981 - [deviceInfo setValue:[NSNumber numberWithBool:!self.apsRegistrationError] forKey:@"ios_aps_entitlement_valid"]; 981 +// [deviceInfo setValue:[NSNumber numberWithBool:!self.apsRegistrationError] forKey:@"ios_aps_entitlement_valid"];
982 982
983 - NSUInteger rntypes; 983 +// NSUInteger rntypes;
984 984
985 - if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) { 985 +// if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) {
986 - [deviceInfo setValue:[NSNumber numberWithInt:_notificationOptions] forKey:@"notification_types"]; 986 +// [deviceInfo setValue:[NSNumber numberWithInt:_notificationOptions] forKey:@"notification_types"];
987 - } else { 987 +// } else {
988 - [deviceInfo setValue:[NSNumber numberWithInt:_notificationTypes] forKey:@"notification_types"]; 988 +// [deviceInfo setValue:[NSNumber numberWithInt:_notificationTypes] forKey:@"notification_types"];
989 - } 989 +// }
990 990
991 - if (SYSTEM_VERSION_LESS_THAN(@"8.0")) { 991 +// if (SYSTEM_VERSION_LESS_THAN(@"8.0")) {
992 -#pragma clang diagnostic push 992 +// #pragma clang diagnostic push
993 -#pragma clang diagnostic ignored "-Wdeprecated-declarations" 993 +// #pragma clang diagnostic ignored "-Wdeprecated-declarations"
994 - rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; 994 +// rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
995 -#pragma clang diagnostic pop 995 +// #pragma clang diagnostic pop
996 - }else{ 996 +// }else{
997 - rntypes = [[[UIApplication sharedApplication] currentUserNotificationSettings] types]; 997 +// rntypes = [[[UIApplication sharedApplication] currentUserNotificationSettings] types];
998 - } 998 +// }
999 999
1000 - [deviceInfo setValue:[NSNumber numberWithInteger:rntypes] forKey:@"user_enabled_notification_types"]; 1000 +// [deviceInfo setValue:[NSNumber numberWithInteger:rntypes] forKey:@"user_enabled_notification_types"];
1001 1001
1002 - // NSMutableDictionary *apple_uuids = [NSMutableDictionary dictionaryWithCapacity:2]; 1002 +// // NSMutableDictionary *apple_uuids = [NSMutableDictionary dictionaryWithCapacity:2];
1003 - [deviceInfo setValue:[NSNumber numberWithBool:[ASIdentifierManager sharedManager].advertisingTrackingEnabled] forKey:@"advertising_tracking_enabled"]; 1003 +// [deviceInfo setValue:[NSNumber numberWithBool:[ASIdentifierManager sharedManager].advertisingTrackingEnabled] forKey:@"advertising_tracking_enabled"];
1004 - [deviceInfo setValue:[[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString] forKey:@"advertising_identifier"]; 1004 +// [deviceInfo setValue:[[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString] forKey:@"advertising_identifier"];
1005 - [deviceInfo setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"identifier_for_vendor"]; 1005 +// [deviceInfo setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"identifier_for_vendor"];
1006 1006
1007 - // [deviceInfo setValue:apple_uuids forKey: @"ios_uuids"]; 1007 +// // [deviceInfo setValue:apple_uuids forKey: @"ios_uuids"];
1008 1008
1009 - NSLog(@"%@", deviceInfo); 1009 +// NSLog(@"%@", deviceInfo);
1010 +
1011 +// return deviceInfo;
1012 +// }
1013 +
1014 +///////////////////////////////////////////////////////////////////////////////
1015 +
1016 +- (NSDictionary *)deviceInfo:(NSString *)newDeviceToken
1017 +{
1018 + NSMutableDictionary *deviceInfo = [[NSMutableDictionary alloc] init];
1019 +
1020 + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1021 + if ([defaults boolForKey:@"trackersEnabled"] == YES) {
1022 +
1023 + [deviceInfo setValue:@"ios" forKey:@"platform"];
1024 +
1025 + [deviceInfo setValue:@"Apple" forKey:@"manufacturer"];
1026 +
1027 + if ([[UIDevice currentDevice] platform].length != 0) {
1028 + [deviceInfo setValue:[[UIDevice currentDevice] platform] forKey:@"ios_device_model"];
1029 + }
1030 +
1031 + [deviceInfo setValue:[[UIDevice currentDevice] systemVersion] forKey:@"os_version"];
1032 +
1033 + //Application Data Hack
1034 + NSBundle *mainBundle = [NSBundle mainBundle];
1035 +
1036 + NSString *CFBundleShortVersionString = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
1037 + if (CFBundleShortVersionString.length != 0) {
1038 + [deviceInfo setValue:CFBundleShortVersionString forKey:@"app_version"];
1039 + }
1040 + }
1041 +
1042 + [deviceInfo setValue:@"apple" forKey:@"vendor"];
1043 +
1044 + [deviceInfo setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"unique_device_id"];
1045 +
1046 + if (newDeviceToken.length != 0) {
1047 + [deviceInfo setValue:newDeviceToken forKey:@"device_token"];
1048 + }
1049 +
1050 + NSLog(@"deviceInfo: %@", deviceInfo);
1010 1051
1011 return deviceInfo; 1052 return deviceInfo;
1012 } 1053 }
......