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