Manos Chorianopoulos

fix sendDeviceInfo crash

...@@ -1723,7 +1723,10 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; ...@@ -1723,7 +1723,10 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
1723 1723
1724 - (void)sendDeviceInfoIfNecessary:(NSString *)newDeviceToken { 1724 - (void)sendDeviceInfoIfNecessary:(NSString *)newDeviceToken {
1725 1725
1726 + if ([Warply sharedService] != nil) {
1726 [[Warply sharedService].pushManager sendDeviceInfoIfNecessary:newDeviceToken]; 1727 [[Warply sharedService].pushManager sendDeviceInfoIfNecessary:newDeviceToken];
1728 + }
1729 +
1727 } 1730 }
1728 1731
1729 - (void)editProfileAsync:(NSString*)firstname andLastname:(NSString*)lastname andEmail:(NSString *)email andSalutation:(NSString *)salutation andMsisdn:(NSString *)msisdn andNickname:(NSString *)nickname andGender:(NSString *)gender andBirthday:(NSString *)birthday andNameDay:(NSString *)nameday andTaxID:(NSString *)taxid andProfileMetadata:(NSDictionary *)profileMetadata optin:(NSNumber *)optin newsLetter:(NSNumber *)newsletter andSMS:(NSNumber *)sms andSegmentation:(NSNumber *)segmentation andSMSSegmentation:(NSNumber *)smsSegmentation :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure { 1732 - (void)editProfileAsync:(NSString*)firstname andLastname:(NSString*)lastname andEmail:(NSString *)email andSalutation:(NSString *)salutation andMsisdn:(NSString *)msisdn andNickname:(NSString *)nickname andGender:(NSString *)gender andBirthday:(NSString *)birthday andNameDay:(NSString *)nameday andTaxID:(NSString *)taxid andProfileMetadata:(NSDictionary *)profileMetadata optin:(NSNumber *)optin newsLetter:(NSNumber *)newsletter andSMS:(NSNumber *)sms andSegmentation:(NSNumber *)segmentation andSMSSegmentation:(NSNumber *)smsSegmentation :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure {
......
...@@ -5888,14 +5888,45 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) ...@@ -5888,14 +5888,45 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
5888 old_identifier_for_vendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; 5888 old_identifier_for_vendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
5889 } 5889 }
5890 5890
5891 - NSDictionary *parameters = @{@"advertising_identifier": [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString], 5891 + // NSDictionary *parameters = @{@"advertising_identifier": [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString],
5892 - @"old_identifier_for_vendor": old_identifier_for_vendor, 5892 + // @"old_identifier_for_vendor": old_identifier_for_vendor,
5893 - @"new_identifier_for_vendor": [[[UIDevice currentDevice] identifierForVendor] UUIDString], 5893 + // @"new_identifier_for_vendor": [[[UIDevice currentDevice] identifierForVendor] UUIDString],
5894 - @"unique-device-id": [[[UIDevice currentDevice] identifierForVendor] UUIDString], 5894 + // @"unique-device-id": [[[UIDevice currentDevice] identifierForVendor] UUIDString],
5895 - @"vendor": @"apple", 5895 + // @"vendor": @"apple",
5896 - @"platform": @"ios", 5896 + // @"platform": @"ios",
5897 - @"os_version": [[UIDevice currentDevice] systemVersion], 5897 + // @"os_version": [[UIDevice currentDevice] systemVersion],
5898 - @"channel": @"mobile"}; 5898 + // @"channel": @"mobile"};
5899 +
5900 + // NEW parameters
5901 + NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
5902 +
5903 + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
5904 + if ([defaults boolForKey:@"trackersEnabled"] == YES) {
5905 +
5906 + [parameters setValue:@"ios" forKey:@"platform"];
5907 +
5908 + [parameters setValue:@"Apple" forKey:@"manufacturer"];
5909 +
5910 + if ([[UIDevice currentDevice] platform].length != 0) {
5911 + [parameters setValue:[[UIDevice currentDevice] platform] forKey:@"ios_device_model"];
5912 + }
5913 +
5914 + [parameters setValue:[[UIDevice currentDevice] systemVersion] forKey:@"os_version"];
5915 +
5916 + //Application Data Hack
5917 + NSBundle *mainBundle = [NSBundle mainBundle];
5918 +
5919 + NSString *CFBundleShortVersionString = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
5920 + if (CFBundleShortVersionString.length != 0) {
5921 + [parameters setValue:CFBundleShortVersionString forKey:@"app_version"];
5922 + }
5923 + }
5924 +
5925 + [parameters setValue:@"apple" forKey:@"vendor"];
5926 +
5927 + [parameters setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"unique_device_id"];
5928 +
5929 + WLLOG(@"Registration parameters: %@", parameters);
5899 5930
5900 5931
5901 // NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL]; 5932 // NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL];
...@@ -6090,7 +6121,8 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) ...@@ -6090,7 +6121,8 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
6090 /////////////////////////////////////////////////////////////////////////////// 6121 ///////////////////////////////////////////////////////////////////////////////
6091 - (void)registration 6122 - (void)registration
6092 { 6123 {
6093 - [self registrationWithSuccessBlock:nil andFailureBlock:nil]; 6124 + // [self registrationWithSuccessBlock:nil andFailureBlock:nil];
6125 + [self registrationWithSuccessBlock2:nil andFailureBlock:nil];
6094 } 6126 }
6095 6127
6096 /////////////////////////////////////////////////////////////////////////////// 6128 ///////////////////////////////////////////////////////////////////////////////
......