diff options
author | Julian Rex <julian.rex@mapbox.com> | 2019-04-24 14:40:45 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-24 14:40:45 -0400 |
commit | 43553c37e98225d7951d0abb694b080075c1b4c4 (patch) | |
tree | f50aa8236a9116fff317421da3bf81e35074ebc5 /platform/darwin/src/http_file_source.mm | |
parent | 88a652542715c595105589e8356754e11245e699 (diff) | |
download | qtlocation-mapboxgl-43553c37e98225d7951d0abb694b080075c1b4c4.tar.gz |
[ios] Enable/Disable sku token handling (#14467)
Diffstat (limited to 'platform/darwin/src/http_file_source.mm')
-rw-r--r-- | platform/darwin/src/http_file_source.mm | 15 |
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; |