summaryrefslogtreecommitdiff
path: root/platform/darwin/src/http_file_source.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/darwin/src/http_file_source.mm')
-rw-r--r--platform/darwin/src/http_file_source.mm24
1 files changed, 5 insertions, 19 deletions
diff --git a/platform/darwin/src/http_file_source.mm b/platform/darwin/src/http_file_source.mm
index 29f8f7db68..c26568d8bc 100644
--- a/platform/darwin/src/http_file_source.mm
+++ b/platform/darwin/src/http_file_source.mm
@@ -7,14 +7,9 @@
#include <mbgl/util/version.hpp>
#import <Foundation/Foundation.h>
-
#import "MGLLoggingConfiguration_Private.h"
#import "MGLNetworkConfiguration_Private.h"
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
-#import "MGLAccountManager_Private.h"
-#endif
-
#include <mutex>
#include <chrono>
@@ -201,25 +196,16 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
auto shared = request->shared; // Explicit copy so that it also gets copied into the completion handler block below.
@autoreleasepool {
- NSURL *url = [NSURL URLWithString:@(resource.url.c_str())];
+ NSURL* url = [NSURL URLWithString:@(resource.url.c_str())];
MGLLogDebug(@"Requesting URI: %@", url.relativePath);
-
-#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
if (impl->accountType == 0 &&
([url.host isEqualToString:@"mapbox.com"] || [url.host hasSuffix:@".mapbox.com"])) {
- NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
- NSArray *newQueryItems = @[
- [NSURLQueryItem queryItemWithName:@"events" value:@"true"],
- [NSURLQueryItem queryItemWithName:@"sku" value:MGLAccountManager.skuToken]
- ];
-
- components.queryItems = components.queryItems ? [components.queryItems arrayByAddingObjectsFromArray:newQueryItems] : newQueryItems;
-
- url = components.URL;
+ NSString* absoluteString = [url.absoluteString
+ stringByAppendingFormat:(url.query ? @"&%@" : @"?%@"), @"events=true"];
+ url = [NSURL URLWithString:absoluteString];
}
-#endif
- NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
+ NSMutableURLRequest* req = [NSMutableURLRequest requestWithURL:url];
if (resource.priorEtag) {
[req addValue:@(resource.priorEtag->c_str())
forHTTPHeaderField:@"If-None-Match"];