From d85ce77deba12167f1c25a911ef81f44e35daa2a Mon Sep 17 00:00:00 2001 From: Jordan Kiley Date: Tue, 21 Jan 2020 20:31:51 -0800 Subject: [PATCH] [ios, macos] Include SKU token for offline requests (#16130) (#16133) --- circle.yml | 2 +- platform/darwin/src/http_file_source.mm | 5 ++--- platform/darwin/test/MGLResourceTests.mm | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/circle.yml b/circle.yml index 7aa497708cd..0e2f4c3fb51 100644 --- a/circle.yml +++ b/circle.yml @@ -1219,7 +1219,7 @@ jobs: - install-ios-packaging-dependencies - run: name: Build dynamic framework for device and simulator - command: make iframework + command: make iframework BUILD_DOCS=false no_output_timeout: 5m - deploy: name: Upload snapshot build to s3 diff --git a/platform/darwin/src/http_file_source.mm b/platform/darwin/src/http_file_source.mm index a72a97e2994..6132ba7f9bb 100644 --- a/platform/darwin/src/http_file_source.mm +++ b/platform/darwin/src/http_file_source.mm @@ -207,10 +207,9 @@ BOOL isValidMapboxEndpoint(NSURL *url) { if (resource.usage == Resource::Usage::Offline) { [queryItems addObject:[NSURLQueryItem queryItemWithName:@"offline" value:@"true"]]; - } else { - // Only add SKU token to requests not tagged as "offline" usage. - [queryItems addObject:[NSURLQueryItem queryItemWithName:@"sku" value:MGLNativeNetworkManager.sharedManager.skuToken]]; } + + [queryItems addObject:[NSURLQueryItem queryItemWithName:@"sku" value:MGLNativeNetworkManager.sharedManager.skuToken]]; if (components.queryItems) { [queryItems addObjectsFromArray:components.queryItems]; diff --git a/platform/darwin/test/MGLResourceTests.mm b/platform/darwin/test/MGLResourceTests.mm index 7fcccc535c8..cf6a997ceae 100644 --- a/platform/darwin/test/MGLResourceTests.mm +++ b/platform/darwin/test/MGLResourceTests.mm @@ -60,13 +60,12 @@ - (void)testOfflineQueryParameterIsAddedForOfflineResource { for (NSURLQueryItem *item in components.queryItems) { if (([item.name isEqualToString:@"offline"] && [item.value isEqualToString:@"true"]) || ([item.name isEqualToString:@"a"] && [item.value isEqualToString:@"one"]) || - ([item.name isEqualToString:@"b"] && [item.value isEqualToString:@"two"])) { + ([item.name isEqualToString:@"b"] && [item.value isEqualToString:@"two"]) || [item.name isEqualToString:@"sku"]) { foundCount++; } - XCTAssertFalse([item.name isEqualToString:@"sku"]); } - XCTAssert(foundCount == 3); + XCTAssert(foundCount == 4); #else // NOTE: Currently the macOS SDK does not supply the sku or offline query parameters for (NSURLQueryItem *item in components.queryItems) {