Manos Chorianopoulos

fix sendDeviceInfo crash

......@@ -1723,7 +1723,10 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
- (void)sendDeviceInfoIfNecessary:(NSString *)newDeviceToken {
[[Warply sharedService].pushManager sendDeviceInfoIfNecessary:newDeviceToken];
if ([Warply sharedService] != nil) {
[[Warply sharedService].pushManager sendDeviceInfoIfNecessary:newDeviceToken];
}
}
- (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)
old_identifier_for_vendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
}
NSDictionary *parameters = @{@"advertising_identifier": [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString],
@"old_identifier_for_vendor": old_identifier_for_vendor,
@"new_identifier_for_vendor": [[[UIDevice currentDevice] identifierForVendor] UUIDString],
@"unique-device-id": [[[UIDevice currentDevice] identifierForVendor] UUIDString],
@"vendor": @"apple",
@"platform": @"ios",
@"os_version": [[UIDevice currentDevice] systemVersion],
@"channel": @"mobile"};
// NSDictionary *parameters = @{@"advertising_identifier": [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString],
// @"old_identifier_for_vendor": old_identifier_for_vendor,
// @"new_identifier_for_vendor": [[[UIDevice currentDevice] identifierForVendor] UUIDString],
// @"unique-device-id": [[[UIDevice currentDevice] identifierForVendor] UUIDString],
// @"vendor": @"apple",
// @"platform": @"ios",
// @"os_version": [[UIDevice currentDevice] systemVersion],
// @"channel": @"mobile"};
// NEW parameters
NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults boolForKey:@"trackersEnabled"] == YES) {
[parameters setValue:@"ios" forKey:@"platform"];
[parameters setValue:@"Apple" forKey:@"manufacturer"];
if ([[UIDevice currentDevice] platform].length != 0) {
[parameters setValue:[[UIDevice currentDevice] platform] forKey:@"ios_device_model"];
}
[parameters setValue:[[UIDevice currentDevice] systemVersion] forKey:@"os_version"];
//Application Data Hack
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *CFBundleShortVersionString = [mainBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
if (CFBundleShortVersionString.length != 0) {
[parameters setValue:CFBundleShortVersionString forKey:@"app_version"];
}
}
[parameters setValue:@"apple" forKey:@"vendor"];
[parameters setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"unique_device_id"];
WLLOG(@"Registration parameters: %@", parameters);
// NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL];
......@@ -6090,7 +6121,8 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
///////////////////////////////////////////////////////////////////////////////
- (void)registration
{
[self registrationWithSuccessBlock:nil andFailureBlock:nil];
// [self registrationWithSuccessBlock:nil andFailureBlock:nil];
[self registrationWithSuccessBlock2:nil andFailureBlock:nil];
}
///////////////////////////////////////////////////////////////////////////////
......