Manos Chorianopoulos

crash 1 possible fix

......@@ -4872,13 +4872,36 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
// }
[_httpClient.requestSerializer setValue:[@"Bearer " stringByAppendingString:accessToken] forHTTPHeaderField:@"Authorization"];
}
NSString *loyaltyDate = @"";
NSString *loyaltySignature = @"";
NSString *bundleId = @"";
@try {
loyaltyDate = [NSString stringWithFormat:@"%lu", timestamp];
loyaltySignature = [[NSString stringWithFormat:@"%@%lu", _apiKey, timestamp] SHA256Sum];
bundleId = [NSString stringWithFormat:@"ios:%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]];
}
@catch (NSException *exception) {
NSLog(@"HTTPHeaders error: %@", exception.reason);
if (failureBlock) {
NSError *error = nil;
failureBlock(error);
}
}
@finally {
// NSLog(@"Finally condition");
}
[_httpClient.requestSerializer setValue:_webId forHTTPHeaderField:@"loyalty-web-id"];
[_httpClient.requestSerializer setValue:[NSString stringWithFormat:@"%lu", timestamp] forHTTPHeaderField:@"loyalty-date"];
[_httpClient.requestSerializer setValue:[[NSString stringWithFormat:@"%@%lu", _apiKey, timestamp] SHA256Sum] forHTTPHeaderField:@"loyalty-signature"];
// [_httpClient.requestSerializer setValue:[NSString stringWithFormat:@"%lu", timestamp] forHTTPHeaderField:@"loyalty-date"];
// [_httpClient.requestSerializer setValue:[[NSString stringWithFormat:@"%@%lu", _apiKey, timestamp] SHA256Sum] forHTTPHeaderField:@"loyalty-signature"];
[_httpClient.requestSerializer setValue:loyaltyDate forHTTPHeaderField:@"loyalty-date"];
[_httpClient.requestSerializer setValue:loyaltySignature forHTTPHeaderField:@"loyalty-signature"];
[_httpClient.requestSerializer setValue:@"gzip" forHTTPHeaderField:@"Accept-Encoding"];
[_httpClient.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[_httpClient.requestSerializer setValue:@"gzip" forHTTPHeaderField:@"User-Agent"];
[_httpClient.requestSerializer setValue:[NSString stringWithFormat:@"ios:%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]] forHTTPHeaderField:@"loyalty-bundle-id"];
// [_httpClient.requestSerializer setValue:[NSString stringWithFormat:@"ios:%@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]]
[_httpClient.requestSerializer setValue:bundleId forHTTPHeaderField:@"loyalty-bundle-id"];
[_httpClient.requestSerializer setValue:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forHTTPHeaderField:@"unique-device-id"];
[_httpClient.requestSerializer setValue:@"apple" forHTTPHeaderField:@"vendor"];
[_httpClient.requestSerializer setValue:@"platform" forHTTPHeaderField:@"ios"];
......