summaryrefslogtreecommitdiff
path: root/platform/darwin/src/http_file_source.mm
diff options
context:
space:
mode:
authorJulian Rex <julian.rex@mapbox.com>2019-04-24 15:44:42 -0400
committerGitHub <noreply@github.com>2019-04-24 15:44:42 -0400
commit4920cec4d9b5abf7a8d7a56924e07b562e10c40b (patch)
tree99f65640f6375e96befa26768e584d12f3604af7 /platform/darwin/src/http_file_source.mm
parenta4ab7b43857f080c58e0957e34d69e949ae9d120 (diff)
downloadqtlocation-mapboxgl-4920cec4d9b5abf7a8d7a56924e07b562e10c40b.tar.gz
[ios] CP #14467 - Enable/Disable sku token handling (#14502)
Diffstat (limited to 'platform/darwin/src/http_file_source.mm')
-rw-r--r--platform/darwin/src/http_file_source.mm15
1 files changed, 11 insertions, 4 deletions
diff --git a/platform/darwin/src/http_file_source.mm b/platform/darwin/src/http_file_source.mm
index 29f8f7db68..c4b18ffd3c 100644
--- a/platform/darwin/src/http_file_source.mm
+++ b/platform/darwin/src/http_file_source.mm
@@ -208,10 +208,17 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource,
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]
- ];
+
+ NSMutableArray *newQueryItems = [NSMutableArray arrayWithArray:@[
+ [NSURLQueryItem queryItemWithName:@"events" value:@"true"]
+ ]];
+
+ // Only add the token if we have enabled the accounts SDK
+ if (MGLAccountManager.isAccountsSDKEnabled)
+ {
+ NSCAssert(MGLAccountManager.skuToken, @"skuToken should be non-nil if the accounts SDK is enabled");
+ [newQueryItems addObject:[NSURLQueryItem queryItemWithName:@"sku" value:MGLAccountManager.skuToken]];
+ }
components.queryItems = components.queryItems ? [components.queryItems arrayByAddingObjectsFromArray:newQueryItems] : newQueryItems;