summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-03-05 21:49:57 -0800
committerMinh Nguyễn <mxn@1ec5.org>2016-03-05 21:49:57 -0800
commit0875a066cbcfdd65784c3bf838a1039dbe865a6d (patch)
tree2c15afa779d080d481a7707148d7eddb53a482f7 /platform
parent2d2ba3a482e68dcd39f12b8c8f8d2ea89ceb254d (diff)
downloadqtlocation-mapboxgl-0875a066cbcfdd65784c3bf838a1039dbe865a6d.tar.gz
[ios] Cleaned up NSLocalizedString usage
The format string would be localized, not the string resulting from expanding its placeholders. Also unindented a wildly indented block of code.
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/src/MGLAPIClient.m32
1 files changed, 16 insertions, 16 deletions
diff --git a/platform/ios/src/MGLAPIClient.m b/platform/ios/src/MGLAPIClient.m
index 601edd6a4e..441c7c16f9 100644
--- a/platform/ios/src/MGLAPIClient.m
+++ b/platform/ios/src/MGLAPIClient.m
@@ -44,22 +44,22 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST";
- (void)postEvents:(nonnull NS_ARRAY_OF(MGLMapboxEventAttributes *) *)events completionHandler:(nullable void (^)(NSError * _Nullable error))completionHandler {
__block NSURLSessionDataTask *dataTask = [self.session dataTaskWithRequest:[self requestForEvents:events]
completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
- NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
- NSError *statusError = nil;
- if (httpResponse.statusCode >= 400) {
- NSString *description = [NSString stringWithFormat:@"The session data task failed. Original request was: %@", dataTask.originalRequest];
- NSString *reason = [NSString stringWithFormat:@"The status code was %@", @(httpResponse.statusCode)];
- NSDictionary *userInfo = @{NSLocalizedDescriptionKey: NSLocalizedString(description, nil),
- NSLocalizedFailureReasonErrorKey: NSLocalizedString(reason, nil)};
- statusError = [NSError errorWithDomain:MGLErrorDomain code:1 userInfo:userInfo];
- }
- if (completionHandler) {
- error = error ? error : statusError;
- completionHandler(error);
- }
- [self.dataTasks removeObject:dataTask];
- dataTask = nil;
- }];
+ NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
+ NSError *statusError = nil;
+ if (httpResponse.statusCode >= 400) {
+ NSString *description = [NSString stringWithFormat:NSLocalizedString(@"The session data task failed. Original request was: %@", nil), dataTask.originalRequest];
+ NSString *reason = [NSString stringWithFormat:NSLocalizedString(@"The status code was %ld", nil), (long)httpResponse.statusCode];
+ NSDictionary *userInfo = @{NSLocalizedDescriptionKey: description,
+ NSLocalizedFailureReasonErrorKey: reason};
+ statusError = [NSError errorWithDomain:MGLErrorDomain code:1 userInfo:userInfo];
+ }
+ if (completionHandler) {
+ error = error ? error : statusError;
+ completionHandler(error);
+ }
+ [self.dataTasks removeObject:dataTask];
+ dataTask = nil;
+ }];
[dataTask resume];
[self.dataTasks addObject:dataTask];
}